Last active
April 26, 2017 15:57
-
-
Save shapr/e33a9dd61b5800b8141939e7b0768764 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Main where | |
| import Data.Char | |
| main = do | |
| text <- getContents | |
| let linesList = lines text | |
| let results = map doThing linesList | |
| mapM_ print results | |
| let other = map doOtherThing linesList | |
| mapM_ print other | |
| doThing oneline = map toUpper oneline | |
| doOtherThing ('a':_) = "starts with a" | |
| doOtherThing ('b':_) = "start with b" | |
| doOtherThing ('t':_) = "starts with t" | |
| doOtherThing x = "we don't handle this case: " ++ x | |
| doThatThing thatLine = case (head thatLine) of | |
| 'a' -> "probably starts with a" | |
| x -> "we don't handle this thing: " ++ [x] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment