Abstract
Reasoning about functional programs is simpler than reasoning about their imperative counterparts. However, finding bugs in lazy functional languages has been more complex until quite recently. The reason was that not much work was done on developing practical debuggers. Fortunately, several debuggers exist nowadays. One of the easiest to use Haskell debuggers is Hood, whose behavior is based on the concept of observation of intermediate data structures. However, although using Hood can be simple when observing some structures, it is known that it can be hard to understand how it works when dealing with complex situations.
In this paper, we formalize the behavior of the Hood debugger by extending Sestoft’s natural semantics. Moreover, we also indicate how to derive an abstract machine including such debugging information. By doing so, we do not only provide a formal foundation, but we also provide an alternative method to implement debuggers. In fact, we have already implemented a prototype of the abstract machine commented in this paper.
Work partially supported by the MCYT project TIC2003-07848-C02-01, the JCCLM project PAC-03-001, and the Marie Curie project MRTN-CT-2003-505121/TAROT.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
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)
Encina, A., Llana, L., Rubio, F.: Introducing debugging capabilities to natural semantics (extended version) (2006), http://dalila.sip.ucm.es/~albertoe/publics/psiExtd.ps
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)
Encina, A., Peña, R.: Formally deriving an STG machine. In: Principles and Practice of Declarative Programming (PPDP’03), pp. 102–112. ACM Press, New York (2003)
Encina, A., Rodríguez, I., Rubio, F.: Testing speculative work in a lazy/eager parallel functional language. In: Ayguadé, E., et al. (eds.) LCPC 2005. LNCS, vol. 4339, Springer, Heidelberg (2006)
Ennals, R., Peyton Jones, S.: HsDebug: Debugging lazy programs by not being lazy. In: Proceedings of the 7th Haskell Workshop, pp. 84–87. ACM Press, New York (2003)
Gill, A.: Debugging Haskell by observing intermediate data structures. In: Proceedings of the 4th Haskell Workshop. Technical Report of the University of Nottingham (2000)
Gill, A.: Hood homepage (2006), http://www.haskell.org/hood
Ortega-Mallén, Y., Hidalgo-Herrero, M.: Continuation Semantics for Parallel Haskell Dialects. In: Ohori, A. (ed.) APLAS 2003. LNCS, vol. 2895, pp. 303–321. Springer, Heidelberg (2003)
Jones, N., Mycroft, A.: Data flow analysis of applicative programs using minimal function graphs. In: Symposium on Principles of Programming Languages (POPL’86), pp. 296–306. ACM Press, New York (1986)
Jones, N., Rosendahl, M.: Higher order minimal function graphs. Journal of Functional and Logic Programming 2 (1997)
Klusik, U., et al.: 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)
Launchbury, J.: A Natural Semantics for Lazy Evaluation. In: Proc. Conference on Principles of Programming Languages, POPL’93, ACM Press, New York (1993)
Nilsson, H.: Declarative debugging for lazy functional languages. PhD thesis, Depat. of Computer and Information Science, Linköping University, Sweden (1998)
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)
Pareja, C., et al.: Adding traces to a lazy functional evaluator. In: Moreno-Díaz Jr., R., Buchberger, B., Freire, J.-L. (eds.) EUROCAST 2001. LNCS, vol. 2178, pp. 627–641. Springer, Heidelberg (2001)
Peña, R., Rubio, F.: Parallel functional programming at two levels of abstraction. In: Principles and Practice of Declarative Programming (PPDP’01), pp. 187–198. ACM Press, New York (2001)
Peyton Jones, S., Hughes, J. (eds.): Report on the Programming Language Haskell 98 (February 1999), http://www.haskell.org
Pope, B., Naish, L.: Practical aspects of declarative debugging in Haskell 98. In: Principles and Practice of Declarative Programming (PPDP’03), pp. 230–240. ACM Press, New York (2003)
Reinke, C.: GHood — graphical visualization and animation of Haskell object observations. In: Proceedings of the 5th Haskell Workshop. ENTCS, vol. 59, Elsevier Science, Amsterdam (2001)
Sestoft, P.: Deriving a Lazy Abstract Machine. Journal of Functional Programming 7(3), 231–264 (1997)
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)
Wadler, P.: Functional programming: Why no one uses functional languages. SIGPLAN Notices (Functional Programming Column) 33(8), 23–27 (1998)
Wallace, M., et al.: Multipleview tracing for Haskell: a new Hat. In: Proc. of the 5th Haskell Workshop, pp. 151–170 (2001)
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 2007 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
de la Encina, A., Llana, L., Rubio, F. (2007). Introducing Debugging Capabilities to Natural Semantics. In: Virbitskaite, I., Voronkov, A. (eds) Perspectives of Systems Informatics. PSI 2006. Lecture Notes in Computer Science, vol 4378. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-70881-0_18
Download citation
DOI: https://doi.org/10.1007/978-3-540-70881-0_18
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-70880-3
Online ISBN: 978-3-540-70881-0
eBook Packages: Computer ScienceComputer Science (R0)