[Haskell-cafe] Exceptions

Alastair Reid alastair at reid-consulting-uk.ltd.uk
Fri Oct 1 13:14:37 EDT 2004

> >6. Can I get a stack trace from ghc or hugs if an exception is never
> >caught and thus causes the program to terminate?
> Stack traces in lazy laguages are not very useful. Best work-around is
> to produce an explicit call trace by inserting prints into functions...
> obviously this requires the functions to be in the IOMonad. Things are
> still odd because of lazyness though.

I don't think this is completely true.

What typical Haskell compilers have on their stack is not especially useful 
because it reveals the context in which something was being evaluated and 
will depend on details of the compiler, what optimizations it performs, etc.

But, being able to see the context in which a thunk was constructed would be 
extremely useful.  Such a context would be more or less equivalent to the 
context (or 'stack dump') printed when the same program is evaluated strictly 
- by a Caml compiler, say.  

I think the York folk have the best story on stack traces - I don't know if 
non-deterministic exceptions have been integrated into their system - 
probably so.

Alastair Reid

More information about the Haskell-Cafe mailing list