CSI

Haskell - Tracing Lazy Evaluations in a Functional Language

Conference Paper (2023)
Authors

Matthías Páll Gissurarson (Chalmers University of Technology)

L.H. Applis (TU Delft - Software Engineering)

Research Group
Software Engineering
To reference this document use:
https://doi.org/10.1145/3652561.3652562
More Info
expand_more
Publication Year
2023
Language
English
Research Group
Software Engineering
ISBN (electronic)
9798400716317
DOI:
https://doi.org/10.1145/3652561.3652562
Reuse Rights

Other than for strictly personal use, it is not permitted to download, forward or distribute the text or part of it, without the consent of the author(s) and/or copyright holder(s), unless the work is under an open content license such as Creative Commons.

Abstract

In non-strict languages such as Haskell the execution of individual expressions in a program significantly deviates from the order in which they appear in the source code. This can make it difficult to find bugs related to this deviation, since the evaluation of expressions does not occur in the same order as in the source code. At the moment, Haskell errors focus on values being produced, whereas it is often the case that faults are due to values being consumed. For non-strict languages, values involved in a bug are often generated immediately prior to the evaluation of the buggy code. This creates an opportunity for evaluation traces, tracking recently evaluated locations (which can deviate from call-order) to help establish the origin of values involved in faults. In this paper, we describe an extension of GHC's Haskell Program Coverage with evaluation traces, recording recent evaluations in the coverage file, and reporting an evaluation trace alongside the call stack on exception. This lets us reconstruct the chain of events and locate the origin of faults. As a case study, we applied our initial implementation to the nofib-buggy data set and found that some runtime errors greatly benefit from trace information.