Created
July 22, 2016 14:19
-
-
Save berdario/2416b3bcd07a503822fff0579f4f7ca5 to your computer and use it in GitHub Desktop.
Constant Applicative Form sharing/evaluation (will get different output in ghci or when compiled)
This file contains 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
foo :: String -> IO () | |
foo dummy = do | |
let (x, y) = (1, 1) | |
(x, y) <- pure $ (trace "x" (x+1), (trace "y" y*3) | |
print $ show (y + y) <> dummy | |
print $ show (x + x) <> dummy | |
foo2 x = foo (trace "outerfoo" "foo") | |
foo3 xs dummy = print $ show (map (+1) xs) <> dummy | |
foo4 = foo3 [trace "1" 1,2,3] | |
foo5 dummy = print $ show (map (+1) [trace "1" 1,2,3]) <> dummy | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment