Reporting Failures in Functional Logic Programs

by Michael Hanus

Proc. of the 15th International Workshop on Functional and (Constraint) Logic Programming (WFLP 2006), (final version to appear in ENTCS), 2006

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.

Preprint (PDF) BibTeX-Entry