Error when using Control.Exception.handle

64 views
Skip to first unread message

Alexey Kamenev

unread,
Feb 14, 2009, 3:14:08 PM2/14/09
to Real World Haskell Book Club
Hello,
I'm getting the following error when trying to use handle function
(Ch8, p. 209):

:t handle (const (return []))

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

listMatches code fails with
Ambiguous type variable `e' in the constraint:
`GHC.Exception.Exception e'
arising from a use of `handle'

Note that when I use catch everything is fine. I've tried playing with
hiding etc but it did not work.
Is there something I'm doing wrong?
GHC 6.10.1

Thank you.

Don Stewart

unread,
Feb 14, 2009, 3:18:09 PM2/14/09
to Real World Haskell Book Club
The exception interface changed between GHC 6.8.x and GHC 6.10.x

RWH uses the old interface. This is available in two ways to 6.10
users:

* via Control.OldException, using the module system
* by using --constraint="base < 4" if building with cabal.

-- Don

Alexey Kamenev

unread,
Feb 15, 2009, 8:22:24 PM2/15/09
to Real World Haskell Book Club
Thank you for the reply - Control.OldException worked just fine.

I've got one more question (it maybe stupid, but anyway): where can I
read about extensible exceptions? I've found only release notes
mentioning that old style will be removed in next versions of GHC and
couple of wiki pages (http://haskell.org/haskellwiki/Exception,
http://hackage.haskell.org/trac/haskell-prime/wiki/ExtensibleExceptions)
but not sure I got it right.

Thanks.

Reply all
Reply to author
Forward
0 new messages