[Haskell-cafe] Real World Haskell Chapter 19 and GHC 6.10

Gregory Collins greg at gregorycollins.net
Wed Oct 21 10:36:20 EDT 2009


Michael Mossey <mpm at alumni.caltech.edu> writes:

> The examples in the "error handling" chapter (19) of RWH don't run under GHC
> 6.10.
>
> For instance, an example might be
>
> main = handle (\_ -> putStrLn "error") (print $ 5 `div` 0)

I usually use:

    main = handle (\(_ :: SomeException) -> putStrLn "error") (print $ 5 `div` 0)

...but you need the "ScopedTypeVariables" language extension.

G
-- 
Gregory Collins <greg at gregorycollins.net>


More information about the Haskell-Cafe mailing list