On Sat, Nov 27, 2010 at 6:59 PM, Jinjing Wang <nfjinj...@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

Hi Jinjing,

I've done this in Yesod. I'm not sure if it's the best way, but
basically I've added a ghc7 flag to the cabal file, and a block for
the library that reads:

    if flag(ghc7)
        build-depends:   base                      >= 4.3      && < 5
        cpp-options:     -DGHC7
    else
        build-depends:   base                      >= 4        && < 4.3

Then whenever I want to quasi-quote in the code, I write:

#if GHC7
    [quasiquoter|
#else
    [$quasiquoter|
#endif

Michael
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to