Skip to content

Instantly share code, notes, and snippets.

@psyomn
Created March 5, 2014 18:35
Show Gist options
  • Select an option

  • Save psyomn/9373623 to your computer and use it in GitHub Desktop.

Select an option

Save psyomn/9373623 to your computer and use it in GitHub Desktop.
Functor / IO Gripes
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