Created
March 5, 2014 18:35
-
-
Save psyomn/9373623 to your computer and use it in GitHub Desktop.
Functor / IO Gripes
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
| import Data.Char | |
| str2Upper :: String -> String | |
| str2Upper name = map toUpper name | |
| main = do | |
| -- LHS line becomes string; RHS is IO String | |
| line <- fmap reverse getLine | |
| -- Since line is now String, we can assign using let to line2, | |
| -- meanwhile applying the __pure__ function str2Upper | |
| let line2 = str2Upper line | |
| putStrLn $ "HI THERE, " ++ line2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment