Skip to content

Instantly share code, notes, and snippets.

@truthadjustr
Created August 4, 2018 15:02
Show Gist options
  • Save truthadjustr/45ef520cb9710ce891f4b2a37688c158 to your computer and use it in GitHub Desktop.
Save truthadjustr/45ef520cb9710ce891f4b2a37688c158 to your computer and use it in GitHub Desktop.
who are you?
module Main where
import qualified Data.Map as M
errorsPerLine = M.fromList
[ ("Chris", 472), ("Don", 100), ("Simon", -5) ]
main = do putStrLn "Who are you?"
name <- getLine
case M.lookup name errorsPerLine of
Nothing -> putStrLn "I don't know you"
Just n -> do putStr "Errors per line: "
print n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment