Reporting Failures in Functional Logic Programs

Michael Hanus
<span title="">2007</span> <i title="Elsevier BV"> <a target="_blank" rel="noopener" href="" style="color: black;">Electronical Notes in Theoretical Computer Science</a> </i> &nbsp;
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 programmer is interested in the context of the failed program point in order to analyze the reason of the failure. Therefore, this paper discusses
more &raquo; ... niques 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. Motivation Functional logic languages (see [17] for a survey) integrate the most important features of functional and logic languages to provide a variety of programming concepts to the programmer. For instance, the concepts of demand-driven evaluation, higher-order functions, and polymorphic typing from functional programming are combined with logic programming features like computing with partial information (logic variables), constraint solving, and nondeterministic search for solutions. This combination, supported by optimal evaluation strategies [3] and new design patterns [5], leads to better abstractions in application programs such as implementing graphical user interfaces [20] or programming dynamic web pages [21, 23] .
<span class="external-identifiers"> <a target="_blank" rel="external noopener noreferrer" href="">doi:10.1016/j.entcs.2007.01.002</a> <a target="_blank" rel="external noopener" href="">fatcat:wun4ucznqfbj3eqeoox3gmszii</a> </span>
<a target="_blank" rel="noopener" href="" title="fulltext PDF download" data-goatcounter-click="serp-fulltext" data-goatcounter-title="serp-fulltext"> <button class="ui simple right pointing dropdown compact black labeled icon button serp-button"> <i class="icon ia-icon"></i> Web Archive [PDF] <div class="menu fulltext-thumbnail"> <img src="" alt="fulltext thumbnail" loading="lazy"> </div> </button> </a> <a target="_blank" rel="external noopener noreferrer" href=""> <button class="ui left aligned compact blue labeled icon button serp-button"> <i class="unlock alternate icon" style="background-color: #fb971f;"></i> </button> </a>