[Haskell-cafe] Control.Exception base-3/base-4 woes

David Menendez dave at zednenem.com
Fri Sep 11 11:42:41 EDT 2009


On Fri, Sep 11, 2009 at 11:26 AM, Neil Brown <nccb2 at kent.ac.uk> wrote:
>
> Can anyone tell me how to fix this?  I don't think that changing to always
> use Control.Exception would fix this, because I need to give a different
> type for catch in base-3 to base-4, so there's still the incompatibility to
> be dealt with.

I'd try using a cabal flag to set a CPP flag.

E.g., from cabal

    Flag Base3
        Description: Use Version 3 of Base
        Default: False

    Library/Executable
        if flag(Base3)
            CPP-Options: -D _BASE_3_
            Build-Depends: base >= 3 && < 4

        else
            Build-Depends: base >= 4 && < 5

And then do,

    #if _BASE_3_
    import qualified Control.Exception as C
    #else
    import qualified Control.OldException as C
    #endif

-- 
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>


More information about the Haskell-Cafe mailing list