Hi

Yes, that's much better than what I was thinking! It also allows me to
write my library and provide (or not) the flag when using GHC - so I
can explicitly choose whether to require the extra features or not.

Thanks

Neil

On 6/15/07, Thomas Schilling <[EMAIL PROTECTED]> wrote:

On 15 jun 2007, at 14.09, Neil Mitchell wrote:

> Hi
>
>> I thought we'd all agreed that a library package should always export
>> the same modules (and class, functions, type signatures etc), so
>> that if
>> foo depends on bar and you have bar installed then you know that
>> you can
>> build foo.
>>
>> In fact, I thought you were one of the people arguing in favour of
>> this
>> for the base package!
>
> I was, for the base package. I want other people to obey these rules,
> but occasionally I want to violate them :)
>
> I'm not sure if in general it should be possible to change the export
> list. Perhaps we can rely on a large number of evil stares to stop
> this being common practice, and yet permit it occasionally.
>
> One thing I would like is given a package _data, which provides a data
> type, and a package _class which provides a class and various
> instances, I'd like to write in the _class cabal file:
>
> #if has _data
>    module Class.InstanceForData
> #endif
>
> Perhaps configurations can support that?
>

You mean like this?

Name: demo
Cabal-version: >= 1.3

Description: This is a test file
   with a description longer than two lines.

flag Debug {
   Description: Enable debug information
   Default: False
}

library {
   build-depends: blub
   exposed-modules: Demo.Main, Demo

   if flag(debug) {
     build-depends: hunit
     ghc-options: -DDEBUG
     exposed-modules: Demo.Internal
   }
}

executable foo-bar {
   Main-is: Foo.hs
}

Of course in this case we'd need to add some flags to the version
number, to indicate, that tho installed version has a certain feature
enabled.

This could be solved with a different package name of course, but I
think it should be easy to add tags to a package version number:

   if flag(debug) {
     build-depends: hunit
     ghc-options: -DDEBUG
     tag: debug
     exposed-modules: Demo.Internal
   }

Testing for the tag is (almost) already supported:

   build-depends: demo >= 1.1-debug,

It should be used often, but it could if necessary.


_______________________________________________
cabal-devel mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cabal-devel

Reply via email to