Test Cases for Configurations

Ian Lynagh igloo at earth.li
Fri Jun 15 10:06:18 EDT 2007


On Fri, Jun 15, 2007 at 03:06:07PM +0200, Thomas Schilling wrote:
> 
> On 15 jun 2007, at 14.09, Neil Mitchell wrote:
> 
> >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?

This has the same problem, in that different versions of the same
package provide different things.

Also, if you install _class first and _data second then you don't get
Class.InstanceForData, whereas installing them the other way round you
do.

> 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
>   }

One thing I have considered proposing is rather than just

    exposed-modules: ...
    other-modules: ...

we could have (I'm not particularly advocating this syntax):

    modules: ...
    modules[testing]: ...
    modules[internal]: ...

(you can put any string inside [...])

and you can then, in another package, say

    depends: foo[testing,internal]

> Testing for the tag is (almost) already supported:
> 
>   build-depends: demo >= 1.1-debug,

IIRC tags are designed to be ignored when comparing version numbers, so
this also has the same problem.


Thanks
Ian



More information about the cabal-devel mailing list