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

2010-12-14 Thread Henning Thielemann
On Mon, 13 Dec 2010, John Meacham wrote: A better plan would be to start depending on 'haskell2010' or 'haskell98' and get rid of explicit dependencies on 'base' altogether. Since those are standardized between compilers. I admit that once in the past I have replaced all dependencies on

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

2010-12-13 Thread John Meacham
A better plan would be to start depending on 'haskell2010' or 'haskell98' and get rid of explicit dependencies on 'base' altogether. Since those are standardized between compilers. John On Tue, Dec 7, 2010 at 6:59 PM, Brandon S Allbery KF8NH allb...@ece.cmu.edu wrote: -BEGIN PGP SIGNED

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

2010-12-13 Thread Duncan Coutts
On 1 December 2010 03:54, Michael Snoyman mich...@snoyman.com wrote: On Wed, Dec 1, 2010 at 4:07 AM, Thomas Schilling nomin...@googlemail.com wrote: 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

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

2010-12-07 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/7/10 06:00 , Henning Thielemann wrote: Brandon S Allbery KF8NH wrote: Since the base package is (with good reason) part of the compiler, anyone smart enough to get that to work is smart enough to edit the cabal file. There are good reasons

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

2010-12-05 Thread Henning Thielemann
Jason Dagit schrieb: I see that others have provided answers on here, but another way is to change the check from: if flag(ghc7) build-depends: base = 4.35 cpp-options: -DGHC7 else build-depends: base =

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

2010-12-05 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/5/10 17:05 , Henning Thielemann wrote: Isn't it better to move the dependency on 'base' out of the If block? I mean, someone might succeed to use GHC-7 with base-4.2 or GHC7 or a different compiler with base-4.3. Since the base package is

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

2010-11-30 Thread Jason Dagit
On Sat, Nov 27, 2010 at 9:59 AM, Jinjing Wang nfjinj...@gmail.com wrote: Thanks Michael, So the user should use `cabal install --flags -ghc7 package-name` to install the package, if I'm not mistaken? Will it work if the package is installed as a dependency? Will the flag environment be

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

2010-11-30 Thread Thomas Schilling
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

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

2010-11-30 Thread Michael Snoyman
On Wed, Dec 1, 2010 at 4:07 AM, Thomas Schilling nomin...@googlemail.com wrote: 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

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

2010-11-27 Thread Michael Snoyman
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,

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

2010-11-27 Thread Jinjing Wang
Thanks Michael, So the user should use `cabal install --flags -ghc7 package-name` to install the package, if I'm not mistaken? Will it work if the package is installed as a dependency? Will the flag environment be passed down from the root package? Is there a way to detect GHC version

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

2010-11-27 Thread Jinjing Wang
Sorry, should be `cabal install --flags=ghc7 package-name`. On Sun, Nov 28, 2010 at 1:59 AM, Jinjing Wang nfjinj...@gmail.com wrote: Thanks Michael, So the user should use `cabal install --flags -ghc7 package-name` to install the package, if I'm not mistaken? Will it work if the package is

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

2010-11-27 Thread Michael Snoyman
No, the user doesn't need to do anything. By splitting up the base range into pre-7 and post-7, cabal automatically applies the ghc7 flag (and thus adds the GHC7 CPP declaration) as appropriate. Michael On Sat, Nov 27, 2010 at 7:59 PM, Jinjing Wang nfjinj...@gmail.com wrote: Thanks Michael,

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

2010-11-27 Thread Antoine Latter
On Sat, Nov 27, 2010 at 10:59 AM, 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

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

2010-11-27 Thread Michael Snoyman
On Sat, Nov 27, 2010 at 9:41 PM, Antoine Latter aslat...@gmail.com wrote: On Sat, Nov 27, 2010 at 10:59 AM, 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

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

2010-11-27 Thread Jinjing Wang
Hi Michael, you are absolutely correct, cabal did set the flags automatically. To sum up, here's what needs to be done: * add `flag ghc7` as a field in cabal * add: if flag(ghc7) build-depends: base = 4.35 cpp-options: -DGHC7 else

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

2010-11-27 Thread Antoine Latter
On Sat, Nov 27, 2010 at 8:38 PM, Jinjing Wang nfjinj...@gmail.com wrote: Hi Michael, you are absolutely correct, cabal did set the flags automatically. To sum up, here's what needs to be done: * add `flag ghc7` as a field in cabal * add:    if flag(ghc7)        build-depends:   base      

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

2010-11-27 Thread Jinjing Wang
Hi Antoine, Thanks for pointing out, it did work. By using a record style constructor, the code can be made to support both version, something like here = QuasiQuoter { quoteExp = (litE . stringL) , quotePat = (litP . stringL) } in GHC7 there's a warning:

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

2010-11-27 Thread Jinjing Wang
Thanks for explaining, it's a nice trick. On Sun, Nov 28, 2010 at 11:16 AM, Antoine Latter aslat...@gmail.com wrote: On Sat, Nov 27, 2010 at 8:38 PM, Jinjing Wang nfjinj...@gmail.com wrote: Hi Michael, you are absolutely correct, cabal did set the flags automatically. To sum up, here's what