aesiniath / unbeliever

Opinionated Haskell Interoperability
https://hackage.haskell.org/package/unbeliever
MIT License
33 stars 11 forks source link

Better implementation for invalid? #176

Open istathar opened 1 year ago

istathar commented 1 year ago

A long while ago we added invalid in Core.Program to make it clear when you'd hit an illegal state (when in monadic context). https://github.com/aesiniath/unbeliever/blob/e55e65fd8278e81e374d6e501335227078d257df/core-program/lib/Core/Program/Execute.hs#L1103-L1108 is the current implementation

I bet that could be done better.

At the very least an HasCallStack => constraint might be good, but is there something better than using error here? MonadFail fail?