[Haskell-cafe] Problem with a sample from RWH

C K Kashyap ckkashyap at gmail.com
Thu Sep 30 01:23:00 EDT 2010


Hi,
I was going over the Error Handling chapter in RWH and tried out this sample -

Prelude> :m Control.Exception
Prelude Control.Exception> let x=5 `div` 0
Prelude Control.Exception> let y=5 `div` 1
Prelude Control.Exception> handle (\_ -> putStrLn "Text") (print x)

<interactive>:1:0:
    Ambiguous type variable `e' in the constraint:
      `Exception e'
        arising from a use of `handle' at <interactive>:1:0-39
    Probable fix: add a type signature that fixes these type variable(s)
Prelude Control.Exception>

Could someone please tell me what the problem is and how to resolve it?

-- 
Regards,
Kashyap


More information about the Haskell-Cafe mailing list