MIN_VERSION macros
Reid Barton
rwbarton at gmail.com
Fri Sep 25 19:36:48 UTC 2015
On Fri, Sep 25, 2015 at 12:18 PM, Eric Seidel <eric at seidel.io> 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.
>
This would certainly be nice, but...
GHC certainly has enough information to generate these macros, as it
> knows which packages (and versions) it's compiling against.
>
It knows at some point, but it doesn't necessarily know before parsing the
module, at which point it is too late. I can have two versions of a package
A, and two other packages B and C that depend on different versions of A,
and depending on whether a module M uses package B or package C, M will see
different versions of package A automatically. This is all slightly
magical, and I have to say I don't entirely understand how GHC decides
which versions to expose in general, but that's how GHC works today and
it's quite convenient.
GHC could provide MIN_VERSION_* macros for packages that have had their
versions specified with -package or similar flags (which is how Cabal
invokes GHC). That would go only a small way towards the original goals
though.
(Also, I wonder how MIN_VERSION_* fits into a Backpack world...)
Regards,
Reid Barton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20150925/42431e39/attachment.html>
More information about the ghc-devs
mailing list