[Haskell-cafe] Conditional compilation for different versions of GHC?

Thomas Schilling nominolo at googlemail.com
Wed Dec 1 03:07:57 CET 2010


I think a nicer way to solve that issue is to use Cabal's MIN_VERSION macros.

 1. Add CPP to your extensions.  This will cause cabal to
auto-generate a file with MIN_VERSION_<pkg> macros for each <pkg> in
build-depends.

 2. GHC 6.12.* comes with template-haskell 2.4, so to test for that use:

#ifdef MIN_VERSION_template_haskell(2,4,0)
  .. ghc-6.12.* code here.
#endif

This should make it more transparent to the user.

On 27 November 2010 16:59, Jinjing Wang <nfjinjing at gmail.com> wrote:
> Dear list,
>
> >From ghc 7.0.1 release notes:
>
>> The Language.Haskell.TH.Quote.QuasiQuoter type has two new fields: quoteType and quoteDec.
>
> Some of my code needs to be conditionally compiled to support both
> version 6 and 7, what is the recommended way to do it?
>
> ref:
>
> * http://new-www.haskell.org/ghc/docs/7.0.1/html/users_guide/release-7-0-1.html
>
> --
> jinjing
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
Push the envelope. Watch it bend.



More information about the Haskell-Cafe mailing list