Skip to content

Support || (or) in build-depends #2033

@tibbe

Description

@tibbe

Currently build-depends don't support "or" between package constraints. All the package constraints are implicitly and-ed together. This means that users have to encode or-constraints using flags, which is verbose and can be more error prone (e.g. users might set the flag to manual).

Consider the planned split of network into network and network-uri, where the Network.URI module is moved out of network into network-uri. Users that want to use that module need to specify the following dependency:

flag network-uri
  description: Get Network.URI from the network-uri package.
  default: True

library
  if flag(network-uri)
    build-depends:
      network >= 2.6 && network-uri >= 2.6
  else
    build-depends:
      network < 2.6

What if we could instead write

library
  if flag(network-uri)
    build-depends:
      network >= 2.6 && network-uri >= 2.6 || network < 2.6

(The syntax probably need to be different, as build-depends already supports ||, with a different meaning.)

The implementation could still be in terms of flags.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions