Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Implement "package()" configurations predicate #202

Closed
bos opened this Issue · 5 comments

4 participants

@bos
Owner

(Imported from Trac #209, reported by @dcoutts on 2008-01-21)

We often have to write things like:

flag splitBase
description: Choose the new smaller, split-up base package.
library
if flag(splitBase)
build-depends: base >= 3, containers
else
build-depends: base < 3
Which is verbose and annoying. It would be nicer to say:

library
build-depends: base
if package(base >= 3)
build-depends: containers
This is syntactic sugar only. It translates into the existing constructs so no new behaviour is being introduced. It would translate into:

flag _1
library
build-depends: base
if flag(_1)
build-depends: base >= 3
build-depends: containers
else
build-depends: base < 3
It is described in more detail in this thread:
http://www.haskell.org/pipermail/cabal-devel/2007-October/001189.html
http://www.haskell.org/pipermail/cabal-devel/2007-November/001336.html

@nominolo nominolo was assigned
@bos
Owner

(Imported comment by ross on 2008-01-21)

Another variant would be to support anonymous flags directly, allowing a syntax like:

library
  if _
    build-depends: base >= 3, containers
  else
    build-depends: base < 3
@bos
Owner

(Imported comment by @dcoutts on 2008-03-07)

Replying to ross:

Another variant would be to support anonymous flags directly

True though I suspect it looks a bit weird to the uninitiated. We know to read the conditional syntax as an implication constraint which can be applied in either direction but I suspect many people read it in a directed functional way. I have a feeling that the anonymous flag would really throw people :-)

Perhaps we should ask opinions on the libraries list.

@bos
Owner

(Imported comment by @dcoutts on 2008-03-07)

Punting.

@bos
Owner

(Imported comment by @dcoutts on 2008-03-19)

Of course if we want it for build-depends then we may also want it for other dependencies like pkgconfig-depends or build-tools. So we should bear that in mind in designing a syntax.

For example darcs might like to use:

  pkgconfig-depends: libcurl
if pkgconfig-depends(libcurl >= 7.19.1)
-- curl 7.19.1 has bug-free pipelining
cpp-options: -DCURL_PIPELINING_DEFAULT
as syntactic sugar for:

flag curl-pipelining
description: Use libcurl's HTTP pipelining.
...
pkgconfig-depends: libcurl
if flag(curl-pipelining)
-- curl 7.19.1 has bug-free pipelining
pkgconfig-depends: libcurl >= 7.19.1
cpp-options: -DCURL_PIPELINING_DEFAULT
else
pkgconfig-depends: libcurl < 7.19.1
Note of course the above doesn't work well yet anyway, it needs #342 to be implemented.

@jsl

Given that there is no activity since 2008, I propose closing this issue. Please re-open or create another ticket if this is still desired.

/cc @tibbe

@tibbe tibbe closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.