Formalizing the Debugging Process in Haskell

  • Alberto de la Encina
  • Luis Llana
  • Fernando Rubio
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3722)


Due to its absence of side effects, it is usually claimed that reasoning about functional programs is simpler than reasoning about their imperative counterparts. Unfortunately, due to the absence of practical debuggers, finding bugs in lazy functional languages has been much more complex until quite recently. One of the easiest to use Haskell debuggers is Hood, whose behavior is based on the concept of observation of intermediate data structures. However, it can be hard to understand how it works when dealing with complex situations.

In this paper, we introduce debugging facilities in the STG abstract machine. Our goal is to obtain debugging information as close to the one obtained by the Hood debugger as possible. By extending the STG abstract machine, we do not only provide a formal framework to the debugging process, but also an alternative method to implement debuggers.


Functional programming debugging abstract machines 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Chitil, O., Runciman, C., Wallace, M.: Freja, Hat and Hood — a comparative evaluation of three systems for tracing and debugging lazy functional programs. In: Mohnen, M., Koopman, P. (eds.) IFL 2000. LNCS, vol. 2011, pp. 176–193. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  2. 2.
    Encina, A., Llana, L., Rubio, F.: Formalizing the debugging process in Haskell, extended version (2005),
  3. 3.
    Encina, A., Peña, R.: Proving the correctness of the STG machine. In: Arts, T., Mohnen, M. (eds.) IFL 2002. LNCS, vol. 2312, pp. 88–104. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  4. 4.
    Encina, A., Peña, R.: Formally deriving an STG machine. In: Principles and Practice of Declarative Programming (PPDP 2003), pp. 102–112. ACM, New York (2003)Google Scholar
  5. 5.
    Ennals, R., Peyton Jones, S.: HsDebug: Debugging lazy programs by not being lazy. In: 7th Haskell Workshop, pp. 84–87. ACM, New York (2003)CrossRefGoogle Scholar
  6. 6.
    Gill, A.: Debugging Haskell by observing intermediate data structures. In: 4th Haskell Workshop. Technical Report of the University of Nottingham (2000)Google Scholar
  7. 7.
    Gill, A.: Hood homepage (2005),
  8. 8.
    Hidalgo-Herrero, M., Ortega-Mallén, Y.: Continuation semantics for parallel Haskell dialects. In: Riis Nielson, H. (ed.) ESOP 1996. LNCS, vol. 1058, pp. 303–321. Springer, Heidelberg (1996)Google Scholar
  9. 9.
    Klusik, U., Loogen, R., Priebe, S., Rubio, F.: Implementation skeletons in Eden: Low-effort parallel programming. In: Mohnen, M., Koopman, P. (eds.) IFL 2000. LNCS, vol. 2011, pp. 71–88. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  10. 10.
    Nilsson, H.: Declarative debugging for lazy functional languages. PhD thesis, Dpt. Computer and Information Science, Linköping University, Sweden (1998)Google Scholar
  11. 11.
    Nilsson, H.: How to look busy while being as lazy as ever: The implementation of a lazy functional debugger. Journal of Functional Programming 11(6), 629–671 (2001)zbMATHCrossRefMathSciNetGoogle Scholar
  12. 12.
    Peyton Jones, S.: Implementing lazy functional languages on stock hardware: The spineless tagless G-machine, version 2.5. Journal of Functional Programming 2(2), 127–202 (1992)zbMATHCrossRefGoogle Scholar
  13. 13.
    Peyton Jones, S., Hughes, J. (eds.): Report on the Programming Language Haskell 1998 (February 1999),
  14. 14.
    Pope, B., Naish, L.: Practical aspects of declarative debugging in Haskell 98. In: Principles and Practice of Declarative Programming (PPDP 2003), pp. 230–240. ACM, New York (2003)Google Scholar
  15. 15.
    Reinke, C.: GHood — graphical visualization and animation of Haskell object observations. In: 5th Haskell Workshop. ENTCS, vol. 59. Elsevier Science, Amsterdam (2001)Google Scholar
  16. 16.
    Sparud, J., Runciman, C.: Tracing lazy functional computations using redex trails. In: Hartel, P.H., Kuchen, H. (eds.) PLILP 1997. LNCS, vol. 1292, pp. 291–308. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  17. 17.
    Wadler, P.: Functional programming: Why no one uses functional languages. SIGPLAN Notices 33(8), 23–27 (1998) Functional Programming ColumnCrossRefGoogle Scholar
  18. 18.
    Wallace, M., Chitil, O., Brehm, T., Runciman, C.: Multipleview tracing for Haskell: a new Hat. In: 5th Haskell Workshop, pp. 151–170 (2001)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Alberto de la Encina
    • 1
  • Luis Llana
    • 1
  • Fernando Rubio
    • 1
  1. 1.Departamento de Sistemas Informáticos y ProgramaciónUniversidad Complutense de MadridSpain

Personalised recommendations