patch applied (packages/regex-base): Make setupscriptcompileagain after recent Cabal changes

Claus Reinke claus.reinke at
Sat Sep 1 18:48:34 EDT 2007

> That wouldn't work, as packages can't re-export modules.  And even if
> they could, this method would be very awkward.  This is about the third
> time that base has shrunk, and hopefully not the last.  This protocol
> would leave us with some rather awkward names.

that sounds like a design flaw (and i believe it isn't the first time
module re-export has come up?). yes, proxies are awkward, but
less so than breakage. and nice names that don't do what they say
are not nice at all, either. it is the problem itself that is awkward,
and proxies are the only solution i know that works without relying
on all clients following your development changes manually.

the idea of such proxies is to allow refactorings to cross externally
visible apis, from library code to client code, without breaking code:
you refactor your library, so that the old api becomes a thin proxy
over your new api; then you release your new library, together with
the proxy; then you deprecate the proxy; clients who can't or don't
want to refactor their code can keep using the proxies, whereas
clients who do get around to cleaning up their code can continue
the refactoring you started in your library code, in their client code,
eliminating their uses of the proxy.

i just did a little experiment, with ghc-6.6.1. consider:

    -- Y.hs
    module Main where
    import Data.Time
    main = print =<< getCurrentTime

this module will not compile without '-package time' or --make:

    $ ghc  Y.hs
    Y.o(.text+0xb1):fake: undefined reference to 
    Y.o(.text+0x115):fake: undefined reference to 
    Y.o(.rodata+0xc):fake: undefined reference to 
    Y.o(.rodata+0x10):fake: undefined reference to 
    collect2: ld returned 1 exit status

now, consider this cabal package, the only purpose of which will
be to make Y.hs compileable:

    -- P.cabal
    License:        BSD3
    Build-Depends:  base, time
    Synopsis:       testing proxy packaging
    Exposed-modules: Data

    -- Setup.hs
    import Distribution.Simple
    main = defaultMain

    -- Data.hs (yes..)
    module Data(module Time) where
    import Data.Time as Time

configure, build, install, and 'ghc -package P Y.hs' seems to work.

    $ ghc -package P Y.hs

    $ ./main.exe
    2007-09-01 22:35:05 UTC

would something like this work for base splitting?

> Cabal really is a special case.  The API is still much too immature to
> stabilize, which is why it's handled differently from the other libraries.
> It was never claimed to be stable.

it is now in use. therefore (apart from differences between theory
and practice;-) there should be a stable version. i assume most
cabal-specific breakage is due to early use beyond that stable api?


More information about the Libraries mailing list