haskell / haskell/cabal

Roll our own assert framework

Open
#4,985 1 comment 0 reactions 0 assignees View on GitHub
type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

Current status:
- We use Haskell's built-in `assert` functionality, which is toggled at compile time with optimization level and/or `-f(no-)ignore-assert`
- We have a compile-time package flag which triggers expensive asserts or not

Problems with the current approach:
- You have to do some unnatural work to extend the built-in asserts with more useful information, because GHC doesn't make available a boolean "you compiled with asserts enabled". The "usual" way of doing it is to catch the thrown AssertionError and then rewrite it with extra information, but this is awfully indirect

Proposed alternate approach:
- We add a specific new flag to Cabal, cabal-install specifically for enabling asserts
- We build our own infrastructure using CallStack to throw assert failures

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.