haskell / haskell/cabal

Implement boolean assertion "statement"

Open
#3,072 8 comments 0 reactions 0 assignees View on GitHub
cabal-install: solver Cabal: file format type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

I hereby propose to add a new property/field

```
assert:
```

which would effectively provide syntax sugar for the following construct:

```
if !()
build-depends: base<0
```

(or instead of `base<0` we could use an [`unbuildable`](http://hackage.haskell.org/package/unbuildable-0/candidate) package)

This would allow us to write things like

```
assert: impl(ghc >= 7.0 && < 8.0)
```

Or e.g. specify in platform specific packages such as Win32:

```
assert: os(win32)
```

Or even specify an unconditional `assert: False` for a broken package release.

The benefit of having a distinct form as opposed to the `if/build-depends` construct is that Cabal can recognise such forms easier, and provide better solver error messages. Moreover, the cabal edit validation in Hackage would be allowed to edit `assert`-properties, and be easier to implement robustly.
(currently you are not allowed to edit add/remove/change `if`-conditionals, and it's not trivial to specify under which circumstances such an edit would be safe)

/cc @kosmikus @dcoutts @bergmark @phadej

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.