Skip to content

Use HasCallStack and error in GHC.List and .NonEmpty

Oleg Grenrus requested to merge phadej/ghc:callstack-in-list into master

In addition to providing stack traces, the scary HasCallStack will hopefully make people think whether they want to use these functions, i.e. act as a documentation hint that something weird might happen.

I'm also seriously considering adding HasCallStack to partial methods in Foldable and Bifoldable, so the overloaded uses of e.g. foldr1 (from Prelude) would get stack traces as well.

Needless to say, I have spent some time tracing the head and !! errors in particular (often burried in some dependency), See the edit of comment in GHC.Err.

EDIT: After CI run I'll post a message to libraries@ to discuss this change.

Edited by Oleg Grenrus

Merge request reports