ghc-6.10 and Exception vs OldException

Duncan Coutts duncan.coutts at
Tue Jan 13 18:32:16 EST 2009

On Tue, 2009-01-13 at 13:44 +0000, Alistair Bayley wrote:
> I'm upgrading Takusen to compile with ghc-6.10, and I'm wondering what
> the recommended approach is for dealing with the new Exception module.
> What does one do if one wants to maintain a library that will build
> with ghc-6.10 and also older versions, as far back as 6.4, say? CPP
> hackery, or is there something more elegant?

There is the extensible-exceptions package. It provides the base-4
exceptions and works with at least base-3 (ghc-6.8). I don't know if it
works with older versions of base that come with 6.4 or 6.6. Try it. It
may well be possible to add support if it does not work yet.

Otherwise another approach is to use cpp to define a few exception
functions. See Cabal's Distribution/Compat/Exception.hs for an example
of this approach, eg:

catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
catchIO = Exception.catch
catchIO = Exception.catchJust Exception.ioErrors


More information about the Libraries mailing list