Cabal: Conditional code and dependencies
igloo at earth.li
Thu Jul 21 10:12:27 EDT 2005
On Thu, Jul 21, 2005 at 12:32:21AM -0500, Brian Smith wrote:
> (3) It would be useful if Cabal/GHC/Hugs/etc. #defined symbols for
> installed packages. This would allow us to write:
> module My.Program.Compat.Lib(foo1, foo2,foo3)
> #if __PACKAGE_foo__ >= 110 -- Is package foo-1.1 or later available?
> import Foo(foo1,foo2,foo3)
Perhaps this is something cpphs could provide?
#if cabal(foo >= 1.1.0)
(or whatever syntax you like).
It can import the relevant stuff from Distribution.* to do the version
checking bit. It would probably need to take a command line parameter of
some form that allowed it to know what was being compiled with.
More information about the Libraries