Last active
November 29, 2019 13:21
-
-
Save kztk-m/5548b2d027e07646b4cb938a8830c7fd to your computer and use it in GitHub Desktop.
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
{-# LANGUAGE RecursiveDo #-} | |
f = do rec a <- do a <- b | |
putStrLn "Hello" | |
return a | |
b <- do return $ return a :: IO (IO ()) | |
return a | |
f' = do rec b <- do return $ return a :: IO (IO ()) | |
a <- do a <- b | |
putStrLn "Hello" | |
return a | |
return a | |
g = do rec a <- do a <- return a | |
putStrLn "Hello" | |
return a | |
b <- return $ return a :: IO (IO ()) | |
return a | |
{- | |
*Main> g | |
Hello | |
*Main> f | |
*** Exception: cyclic evaluation in fixIO | |
*Main> f' | |
Hello | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment