- Create a new project shopping-cart using the simple Stack template:
stack new shopping-cart simple
- Open shopping-cart.cabal and add a dependency on the containers library in the build-depends subsection of the executable subsection:
executable shopping-cart hs-source-dirs: src main-is: Main.lhs default-language: Haskell2010 build-depends: base >= 4.7 && < 5 , containers
- Open src/Main.hs; we will add our code here. Import the module Data.Set:
module Main where import Data.Set as Set
- Create a type to represent a book. The book contains the ISBN number, title of the book, and name of the author:
data Book = Book { isbn :: String , title :: String , author :: String } deriving Show
- Create the equality and ordering ...