- Create a new project working-with-set using the simple Stack template:
stack new working-with-set simple
- In the project folder, open the working-with-set.cabal file. Add the new dependency containers in the subsection build-depends of section executable:
executable working-with-set hs-source-dirs: src main-is: Main.lhs default-language: Haskell2010 build-depends: base >= 4.7 && < 5 , Containers
The containers library is a commonly used library that implements containers such as set, map, and so on.
- Open src/Main.hs for editing. We will work with sets in this file:
module Main where
- Import Data.Set for using set and related functions:
import Data.Set as S
- Write main; we will write set examples in the main function: ...