Skip to content

Instantly share code, notes, and snippets.

@ingted
ingted / shooping_cart.hs
Created October 19, 2016 08:57 — forked from afiore/shooping_cart.hs
Minimalist Shopping cart implementation in Haskell
import qualified Data.Map as DM
data Product = Product String Float deriving (Show)
type ProductMap = DM.Map String [Product]
type DiscountTimes = (ProductMap -> Int)
data Discount = Discount Float DiscountTimes
products :: [Product]
products = milk ++ marsBars
where milk = replicate 7 $ Product "milk" 1.30