darcs patch: [PROOF OF CONCEPT] build readline package
robdockins at fastmail.fm
Tue Feb 19 12:52:09 EST 2008
On Tuesday 19 February 2008 09:22:34 am Christian Maeder wrote:
> 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.
> exposed-modules: System.Console.Shell.Backend.Readline
> 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
I don't think so. I personally view such "top level" overloading as
undesirable. There might possibly be a legitimate reason to want both
modules avaliable simultaneously. Punning the module name would make that
If you want a package that multiplexes the editline package or the readline
package depending on avaliability, that would be easy to do. It would just
require wraping up the #ifdef stuff needed into a single place. I can
probably find a few minutes this afternoon/evening to do this.
> 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