MIN_VERSION macros

Eric Seidel eric at seidel.io
Fri Sep 25 16:18:31 UTC 2015


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
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


More information about the ghc-devs mailing list