haskell / haskell/cabal

How to specify flag A XOR flag B / reject install plan? (from darcs)

Open
#3,742 9 comments 0 reactions 0 assignees View on GitHub
documentation old-milestone: ⊥
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

In Darcs, there is some code that looks like this:

```
if (!flag(curl) && !flag(http))
buildable: False
```

I think the intent is to say, "Darcs needs either the curl or http flag to be turned on." But I don't think this is the right way to go about doing it: this says that it is acceptable for Cabal to set curl and http false; the only consequence is the library isn't buildable. If we somehow have a constraint that the library must be buildable, I suppose this has the desired effect if darcs is a dependency (I imagine the solver then requires the library to be buildable), but if you run `cabal configure` there's no reason to enable the library (well, if we want to build the executable there is, but you could also set the executable flag false and now nothing is built.)

Question 1: What's the right way to write the logic program that is desired here?

Question 2: How should we document this, and educate users to write logic programs that actually work?

I got this from #3740.

Contributor guide

Open the contributing guide

Research direction

Start by reading this issue alongside #3740 and reviewing Cabal's package-flag constraint and solver documentation. Determine how an XOR requirement should be expressed and documented, including the behavior of configure, dependency solving, and disabled components; done means the guidance answers both questions with a validated example.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system, documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.