haskell / haskell/cabal

Constraint language: add a positive way to automatically enable flags

Open
#7,293 6 comments 0 reactions 0 assignees View on GitHub
Cabal: file format re: flag type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

If I want to enable a flag based on some conditions, I have to do hackery like (N) [1]:
```
if os(windows)
if flag(_regex-posix-clib)
build-depends: base<0
```
I'd rather be able to state this positively, e.g. (P):
```
if os(windows)
flag: _regex-posix-clib
```

It seems like (N) isn't understood by `stack` [2].

In general, it seems that logic isn't first-class in the cabal language. Some propositions can only occur negatively, it seems (like `flag`, `os`, `true`, `false`). Positive occurrence seems to be reserved to `build-depends` propositions (and maybe some few more).
For a start, why cannot `false` occur positively?, to allow me to write:
```
if os(windows)
if flag(_regex-posix-clib)
false
```
(That's not my ultimate goal, of course.)

[1] https://github.com/haskell-hvr/regex-posix/commit/13c28e9195a13af2ac68b91f76fc975df1156f97#r47401775
[2] https://github.com/commercialhaskell/stack/issues/5404

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.