Transforming Haskell for Tracing

  • Olaf Chitil
  • Colin Runciman
  • Malcolm Wallace
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2670)


Hat is a programmer’s tool for generating a trace of a computation of a Haskell 98 program and viewing such a trace in various different ways. Applications include program comprehension and debugging. A new version of Hat uses a stand-alone program transformation to produce self-tracing Haskell programs. The transformation is small and works with any Haskell 98 compiler that implements the standard foreign function interface. We present general techniques for building compiler independent tools similar to Hat based on program transformation. We also point out which features of Haskell 98 caused us particular grief.


Original Program Abstract Syntax Program Transformation Functional Language Type Constructor 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    M. Chakravarty et al. The Haskell 98 foreign function interface 1.0: An addendum to the Haskell 98 report., 2002.
  2. 2.
    K. Claessen, C. Runciman, O. Chitil, J. Hughes, and M. Wallace. Testing and tracing lazy functional programs using QuickCheck and Hat. 4th Summer School in Advanced Functional Programming, Oxford, to appear in LNCS, 2002.Google Scholar
  3. 3.
    A. Gill. Debugging Haskell by observing intermediate data structures. Electronic Notes in Theoretical Computer Science, 41(1), 2001. 2000 ACM SIGPLAN Haskell Workshop.Google Scholar
  4. 4.
    H. Nilsson. Declarative Debugging for Lazy Functional Languages. PhD thesis, Linköping, Sweden, May 1998.Google Scholar
  5. 5.
    A. Penney. Augmenting Trace-based Functional Debugging. PhD thesis, University of Bristol, UK, September 1999.Google Scholar
  6. 6.
    J. Sparud and C. Runciman. Complete and partial redex trails of functional computations. In C. Clack, K. Hammond, and T. Davie, editors, Selected papers from 9th Intl. Workshop on the Implementation of Functional Languages (IFL’97), pages 160–177. Springer LNCS Vol. 1467, Sept. 1997.Google Scholar
  7. 7.
    J. Sparud and C. Runciman. Tracing lazy functional computations using redex trails. In H. Glaser, P. Hartel, and H. Kuchen, editors, Proc. 9th Intl. Symposium on Programming Languages, Implementations, Logics and Programs (PLILP’97), pages 291–308. Springer LNCS Vol. 1292, Sept. 1997.CrossRefGoogle Scholar
  8. 8.
    P. Wadler. Functional programming: Why no one uses functional languages. SIGPLAN Notices, 33(8): 23–27, Aug. 1998. Functional programming column.CrossRefGoogle Scholar
  9. 9.
    M. Wallace, O. Chitil, T. Brehm, and C. Runciman. Multiple-view tracing for Haskell: a new Hat. In Preliminary Proceedings of the 2001 ACM SIGPLAN Haskell Workshop, UU-CS-2001-23. Universiteit Utrecht, 2001.Google Scholar
  10. 10.
    R. D. Watson. Tracing Lazy Evaluation by Program Transformation. PhD thesis, Southern Cross, Australia, Oct. 1996.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Olaf Chitil
    • 1
  • Colin Runciman
    • 1
  • Malcolm Wallace
    • 1
  1. 1.The University of YorkUK

Personalised recommendations