+
1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
+13
+14
+15 | #! /usr/bin/env nix-shell
+#! nix-shell -p "haskellPackages.ghcWithPackages (p: [p.containers])"
+#! nix-shell -i runghc
+
+import Data.Map
+
+m :: Map String Int
+m = fromList [("cats", 3), ("dogs", 2)]
+
+main :: IO ()
+main = do
+ let cats = findWithDefault 0 "cats" m
+ let dogs = findWithDefault 0 "dogs" m
+ let zebras = findWithDefault 0 "zebras" m
+ print $ "I have " ++ show cats ++ " cats, " ++ show dogs ++ " dogs, and " ++ show zebras ++ " zebras."
+ |
+