I've run into this issue, too. Post a feature request! I can't imagine it's too 
hard to implement.

Richard

On Sep 25, 2015, at 12:18 PM, Eric Seidel <[email protected]> wrote:

> I've been meaning to ask about this as well. It also forces tools like
> ghc-mod and hdevtools to be cabal-aware, which is an unnecessary source
> of complexity IMO.
> 
> GHC certainly has enough information to generate these macros, as it
> knows which packages (and versions) it's compiling against. I think it's
> just a matter of adding the logic.
> 
> I would love to see the MIN_VERSION macros moved to GHC. 
> 
> Eric
> 
> On Fri, Sep 25, 2015, at 09:06, David Feuer wrote:
>> Cabal defines MIN_VERSION_* macros that allow CPP in a Haskell source
>> file
>> to get information about the versions of the packages that module is
>> being
>> compiled against. Unfortunately, these macros are not available when not
>> compiling with cabal, so packages must either
>> 
>> 1. Insist on cabal compilation. This is not very friendly to developers.
>> 2. Make "pessimistic" assumptions, assuming that all the packages are
>> old.
>> This makes it annoying to test new features while also leading to
>> compilation or run-time failures when packages have removed it changed
>> features.
>> 3. Attempt to guess the version based on the GHC version. This works
>> reasonably well for base, ghc-prim, containers, etc., but not so well/at
>> all for others.
>> 
>> Would there be some way to get GHC itself to provide these macros to all
>> modules that request CPP?
>> 
>> David Feuer
>> _______________________________________________
>> ghc-devs mailing list
>> [email protected]
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
> _______________________________________________
> ghc-devs mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

_______________________________________________
ghc-devs mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Reply via email to