Transforming Haskell for Tracing
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.
KeywordsOriginal Program Abstract Syntax Program Transformation Functional Language Type Constructor
Unable to display preview. Download preview PDF.
- 1.M. Chakravarty et al. The Haskell 98 foreign function interface 1.0: An addendum to the Haskell 98 report. http://www.haskell.org/definition/, 2002.
- 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.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.H. Nilsson. Declarative Debugging for Lazy Functional Languages. PhD thesis, Linköping, Sweden, May 1998.Google Scholar
- 5.A. Penney. Augmenting Trace-based Functional Debugging. PhD thesis, University of Bristol, UK, September 1999.Google Scholar
- 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.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
- 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.R. D. Watson. Tracing Lazy Evaluation by Program Transformation. PhD thesis, Southern Cross, Australia, Oct. 1996.Google Scholar