
14 Dec
2015
14 Dec
'15
12:36 p.m.
Hello Haskellers! I'd appreciate help understanding the origin of the extra 'map' in 'Map.lookup lockerNumber map', from the following example taken from chapter 8 of "Learn You a Haskell for Great Good" http://learnyouahaskell.com/making-our-own-types-and-typeclasses#type-synony... lockerLookup :: Int -> LockerMap -> Either String Code lockerLookup lockerNumber map = case Map.lookup lockerNumber map of Nothing -> Left $ "Locker number " ++ show lockerNumber ++ " doesn't exist!" Just (state, code) -> if state /= Taken then Right code else Left $ "Locker " ++ show lockerNumber ++ " is already taken!" Regards, - Olumide