Skip to content

Instantly share code, notes, and snippets.

@kztk-m
Last active November 29, 2019 13:21
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 kztk-m/5548b2d027e07646b4cb938a8830c7fd to your computer and use it in GitHub Desktop.
Save kztk-m/5548b2d027e07646b4cb938a8830c7fd to your computer and use it in GitHub Desktop.
{-# 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