[Haskell-cafe] What unsafeInterleaveIO is unsafe

Henning Thielemann lemming at henning-thielemann.de
Mon Mar 16 17:12:10 EDT 2009


On Sun, 15 Mar 2009, Claus Reinke wrote:

> import Data.IORef
> import Control.Exception
>
> main = do
>   r <- newIORef 0
>   let v = undefined
>   handle (\(ErrorCall _)->print "hi">>return 42) $ case f v of
>     0 -> return 0
>     n -> return (n - 1)
>   y <- readIORef r
>   print y

I don't see what this has to do with strictness. It's just the hacky 
"exception handling" which allows to "catch" programming errors.



More information about the Haskell-Cafe mailing list