Created
August 6, 2017 19:03
-
-
Save jw3126/37e7dab69fe99bea9ee0355f405b2720 to your computer and use it in GitHub Desktop.
Mapping from IO type to a "pure" type
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
-- 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