Skip to content

Roll our own assert framework #4985

@ezyang

Description

@ezyang

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

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