{-# LANGUAGE ScopedTypeVariables #-} module Main where import System.IO.Unsafe import Control.DeepSeq import Control.Exception foo :: [Int] foo = [1..10] print' :: [Int] -> [Int] print' [] = [] print' (x:xs) = unsafePerformIO $ do putStrLn "lol" return $ (unsafePerformIO $ do print x return x) : print' xs main = do let x = print' foo f1 <- evaluate $ force x f2 <- evaluate $ force x print "--------" print (last f1) print (last f2)