[Haskell-cafe] Control.Exception base-3/base-4 woes
Antoine Latter
aslatter at gmail.com
Fri Sep 11 13:14:24 EDT 2009
On Fri, Sep 11, 2009 at 10:42 AM, David Menendez<dave at zednenem.com> wrote:
> 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
>
I've had success with this. See:
http://hackage.haskell.org/packages/archive/uuid/1.0.2/uuid.cabal
Antoine
More information about the Haskell-Cafe
mailing list