I wrote this package up as a test prototype for propagating HasCallStack
constraints so our Bugsnag reports aren’t “Well at some point you called a database function and then it all went to hell.” It pairs nicely (and does not replace) the annotated-exception
package as a means of understanding error provenance in a large codebase.
12 Likes
Nice! I was wondering yesterday if this was possible and I decided it was impossible, because if you were to define class HasCallStack => RequireCallStack
then GHC wouldn’t do the plumbing properly (and on trying it, it’s not even legal because HasCallStack
actually an implicit parameter). I didn’t think of type RequireCallStack = (HasCallStack, RequireCallStackImpl)
. That’s clever!
It pairs nicely (and does not replace) the
annotated-exception
package
Helpful link:
https://hackage.haskell.org/package/annotated-exception-0.2.0.4/docs/Data-Annotation.html
4 Likes