[Haskell-cafe] Re: [Haskell] Re: Trying to install binary-0.4
simonmarhaskell at gmail.com
Tue Oct 16 08:21:03 EDT 2007
Claus Reinke wrote:
>>> - if you provide a 'base' configuration that pulls in the stuff that
>>> used to be in base, the package will work
>> I don't know of a way to do that. The name of the package is baked
>> into the object files at compile time, so you can't use the same
>> compiled module in more than one package.
> i've been wrong about this before, so check before you believe,-) but
> here is a hack i arrived at the last time we discussed this:
> [using time:Data.Time as a small example; ghc-6.6.1]
> 1. create, build, and install a package QTime, with default Setup.hs
> 2. create, build, and install a package Time2, with default Setup.hs
> 3. write and build a client module
Ok, when I said above "I don't know a way to do that", I really meant
there's no way to do it by modifying the package database alone, which I
think is what Udo was after.
Your scheme does work, and you have discovered how to make a package that
re-exports modules from other packages (I made a similar discovery recently
when looking into how to add support to Cabal for this). As you can see,
it's rather cumbersome, in that you need an extra dummy package, and two
stub modules for each module to be re-exported.
One way to make this easier is to add a little extension to GHC, one that
we've discussed before:
module Data.Time (module Base1.Data.Time) where
import "base-1.0" Data.Time as Base1.Data.Time
the extension is the "base-1.0" package qualifier on the import, which GHC
very nearly supports (only the syntax is missing).
Now you don't need the dummy package, and only one stub module per module
to be re-exported. Cabal could generate these automatically, given some
appropriate syntax. Furthermore, this is better than doing something at
the package level, because you're not stuck with module granularity, you
can re-export just parts of a module, which is necessary if you're trying
to recreate an old version of an API.
I was going to propose this at some point. Comments?
More information about the Haskell-Cafe