replace definition of error with errorWithStackTrace

Bertram Felgenhauer bertram.felgenhauer at
Thu Dec 25 20:10:27 UTC 2014

Johan Tibell wrote:
> Why don't we use the DWARF information instead? It has no runtime overhead
> so it can actually be turned on always. It also integrates with all the
> standard open source tooling.

I think there are two backtrace-like chains of interest for every
Haskell value: There is one "static" chain that tracks how values are
created, and one "dynamic" chain that tracks the actual evaluation.
For example, for

  makePair :: (Int, Int)
  makePair = (error "The first component is actually undefined", 42)

  sumPair :: (Int, Int) -> Int
  sumPair (a, b) = a + b

  main = print $ sumPair makePair

the static chain up to the error call would be

  main -> makePair -> error

while the dynamic chain that actually produces the error is something

  main -> print -> show -> sumPair -> (+) -> error

As far as I understand, DWARF information will give us the dynamic
chain, while the ImplicitLocations idea will give us fragments of the
static chain. So I believe these two features are complementary, and
most useful if combined.



More information about the Libraries mailing list