Closed recursion-ninja closed 3 years ago
Replacing error
with panic
does not provide stack traces by default. Best to stick with error
.
Using panic
gives us this unhelpful and misleading error message:
user@box:~/$ pcg < input.pcg
pcg: pcg: panic! (the 'impossible' happened)
(GHC version 8.10.2:
Impossible happened in 'deriveImpliedAlignment'
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
We currently call
error
in a number of places where "impossible" conditions occur or unimplemented features exist on a codepath. The functionerror
will not supply a stack-trace (unless built with profiling, usually). The functionpanic
will provide a stack-trace and additional contextual information.Since rebuilding with profiling is time intensive, we should replace all occurrences of
error
withpanic
to ease our development experience.