Abstract

Even Haskell programs can occasionally go wrong. Programs calling head onanemptylist,andincompletepatternsinfunctiondefinitions can cause program crashes, reporting little more than the preciselocationwhere error wasultimatelycalled.Beingtoldthat one application of the head function in your program went wrong, withoutknowingwhichuseofhead wentwrongcanbeinfuriating. Wepresentourworkonaddingtheabilitytogetstacktracesout of GHC, for example that our crashing head was used during the evaluation of foo, which was called during the evaluation of bar, during the evaluation of main. We provide a transformation that converts GHC Core programs into ones that pass a stack around, and a stack library that ensures bounded heap usage despite the highly recursive nature of Haskell. We call our extension to GHC StackTrace.