Reporting Failures in Functional Logic

Computing with failures is a typical programming technique in functional logic programs. However, there are also situations where a program should not fail (e.g., in a deterministic top-level computation) but the evaluation fails accidentally, e.g., due to missing pattern combinations in an operation defined by pattern matching. In this case, the program developer is interested in the context of the failed program point in order to analyze the reason of the failure. Therefore, this paper discusses techniques for reporting failures and proposes a new one that has been integrated in a Prolog-based compiler for the declarative multi-paradigm language Curry. Our new technique supports separate compilation of modules, i.e., the compilation of modules has not taken into account whether failures should be reported or not. The failure reporting is only considered in some linking code for modules. In contrast to previous approaches, the execution of programs in the failure reporting mode causes only a small overhead so that it can be also used in larger applications.

[1]  Michael Hanus,et al.  An implementation of narrowing strategies , 2001, PPDP '01.

[2]  Rita Loogen,et al.  A Demand Driven Computation Strategy for Lazy Narrowing , 1993, PLILP.

[3]  Michael Hanus,et al.  A Functional Logic Programming Approach to Graphical User Interfaces , 2000, PADL.

[4]  Michael Hanus,et al.  A unified computation model for functional and logic programming , 1997, POPL '97.

[5]  Philip Wadler,et al.  How to declare an imperative , 1997, CSUR.

[6]  Gill Andy Debugging Haskell by Observing Intermediate Data Structures , 2001 .

[7]  Michael Hanus,et al.  Compiling Multi-Paradigm Declarative Programs into Prolog , 2000, FroCoS.

[8]  J. S anchez Hern andez TO Y: A Multiparadigm Declarative System ? , 1999 .

[9]  Michael Hanus,et al.  Functional Logic Design Patterns , 2002, FLOPS.

[10]  Leon Sterling,et al.  The Art of Prolog , 1987, IEEE Expert.

[11]  Michael Hanus,et al.  High-Level Server Side Web Scripting in Curry , 2001, PADL.

[12]  Colin Runciman,et al.  Freja, Hat and Hood - A Comparative Evaluation of Three Systems for Tracing and Debugging Lazy Functional Programs , 2000, IFL.

[13]  Laurent Fribourg,et al.  Implementation of narrowing: the Prolog-based approach , 1993 .

[14]  Wolfgang Lux Implementing Encapsulated Search for a Lazy Functional Logic Language , 1999, Fuji International Symposium on Functional and Logic Programming.

[15]  Germán Vidal,et al.  A semantics for tracing declarative multi-paradigm programs , 2004, PPDP '04.

[16]  Germán Vidal,et al.  Operational semantics for declarative multi-paradigm languages , 2005, J. Symb. Comput..

[17]  Ramin Sadre,et al.  An Abstract Machine for Curry and Its Concurrent Implementation in Java , 1999, J. Funct. Log. Program..

[18]  Sergio Antoy Non-Determinism and Lazy Evaluation in Logic Programming , 1991, LOPSTR.

[19]  Michael Hanus,et al.  The Integration of Functions into Logic Programming: From Theory to Practice , 1994, J. Log. Program..

[20]  Michael Hanus,et al.  Encapsulating Non-Determinism in Functional Logic Computations , 2004, J. Funct. Log. Program..

[21]  Sebastian Fischer,et al.  A Program Transformation for Tracing Functional Logic Computations , 2006, LOPSTR.

[22]  Michael Hanus,et al.  A Virtual Machine for Functional Logic Computations , 2004, IFL.

[23]  Ramin Sadre,et al.  Pakcs: The portland aachen kiel curry system , 2000 .

[24]  Michael Hanus,et al.  Observing Functional Logic Computations , 2004, PADL.

[25]  Michael Hanus,et al.  Type-oriented construction of web user interfaces , 2006, PPDP '06.

[26]  Michael Hanus,et al.  Efficient Translation of Lazy Functional Logic Programs into Prolog , 1995, LOPSTR.

[27]  Michael Hanus,et al.  Controlling Search in Declarative Programs , 1998, PLILP/ALP.