Created
April 26, 2016 13:28
-
-
Save cblp/324cd56609f5f6f36fd38e360516eeb7 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
import System.IO.Unsafe | |
heavy y = unsafePerformIO $ do | |
putStrLn "heavy" | |
return y | |
f1 x = heavy 10 + x | |
f2 x = let y = heavy 10 in y + x | |
f3 x = y + x where y = heavy 10 | |
main = do | |
print $ map f1 [1..3] | |
print $ map f2 [1..3] | |
print $ map f3 [1..3] |
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
heavy | |
heavy | |
heavy | |
[11,12,13] | |
heavy | |
heavy | |
heavy | |
[11,12,13] | |
heavy | |
heavy | |
heavy | |
[11,12,13] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment