Skip to content

Instantly share code, notes, and snippets.

@jw3126
Created August 6, 2017 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jw3126/37e7dab69fe99bea9ee0355f405b2720 to your computer and use it in GitHub Desktop.
Save jw3126/37e7dab69fe99bea9ee0355f405b2720 to your computer and use it in GitHub Desktop.
Mapping from IO type to a "pure" type
-- we can define functions that discard IO
io :: IO Int
io = print "wehaa" >> return 17
supress :: IO Int -> Int
supress _ = 42
supress io
-- I don't think there is a way to preserve the
-- integer returned in io in supress
-- after all it could be read from a file etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment