darcs patch: [PROOF OF CONCEPT] build readline package with libedit

Christian Maeder Christian.Maeder at dfki.de
Tue Feb 19 09:22:34 EST 2008


Duncan Coutts wrote:
> On Tue, 2008-02-19 at 12:01 +0100, Henning Thielemann wrote:
>> On Tue, 19 Feb 2008, Christian Maeder wrote:
>>
>>> In order to avoid several #ifdefs (maybe differently or suboptimal
>>> given) in user sources (to achieve 1.) such #ifdefs (or wrappers)
>>> should be part of the libraries (including the documentation for the
>>> license differences)!
>> Can Cabal-1.2's flag capability manage such a task?
> 
> I don't think I understand the problem clearly enough to say. Perhaps
> someone can try explaining it in more detail.

Currently, we have packages Shellac-readline and Shellac-editline.
with

exposed-modules: System.Console.Shell.Backend.Readline

resp.

exposed-modules: System.Console.Shell.Backend.Editline

Each module exports a single constant:

Prelude> :browse System.Console.Shell.Backend.Editline
editlineBackend :: System.Console.Shell.Backend.ShellBackend ()
Prelude> :browse System.Console.Shell.Backend.Readline
readlineBackend :: System.Console.Shell.Backend.ShellBackend ()

On Macs I want to use Editline, under Linux Readline, Therefore I #ifdef
my sources. (The functionality seems to be the same for both packages)

My questions are:

1. Should not the exported constants have the same name
2. Should not even the module name be the same in both packages

As long as not both packages are installed the compiler would pick the
proper package without my #ifdefs.

HTH Christian


More information about the Libraries mailing list