Transforming Functional Logic Programs into Monadic Functional Programs

We present a high-level transformation scheme to translate lazy functional logic programs into pure Haskell programs. This transformation is based on a recent proposal to efficiently implement lazy non-deterministic computations in Haskell in a monadic style. We build on this work and define a systematic method to transform lazy functional logic programs into monadic programs with explicit sharing. This results in a transformation scheme which produces high-level and flexible target code. For instance, the target code is parametric w.r.t. the concrete evaluation monad. Thus, different monad instances could, for example, define different search strategies (e.g., depth-first, breadth-first, parallel). We formally describe the basic compilation scheme and some useful extensions.

[1]  Michael Hanus,et al.  Overlapping Rules and Logic Variables in Functional Logic Programs , 2006, ICLP.

[2]  Michael Hanus,et al.  Functional logic programming , 2010, CACM.

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

[4]  Sergio Antoy Evaluation strategies for functional logic programming , 2005, J. Symb. Comput..

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

[6]  Bernd Brassel,et al.  The Kiel Curry System KiCS , 2009, INAP/WLP.

[7]  M. Hanus,et al.  Curry: An Integrated Functional Logic Language , 2003 .

[8]  López-Fraguas,et al.  Bundles pack tighter than lists ⋆ , 2022 .

[9]  Juan Rodríguez-Hortalá,et al.  A simple rewrite notion for call-time choice semantics , 2007, PPDP '07.

[10]  Sergio Antoy,et al.  Computing with subspaces , 2007, PPDP '07.

[11]  Francisco Javier López-Fraguas,et al.  TOY: A Multiparadigm Declarative System , 1999, RTA.

[12]  L FranciscoJ.,et al.  A Simple Rewrite Notion for Call-time Choice Semantics , 2010 .

[13]  Krzysztof R. Apt,et al.  Logic Programming , 1990, Handbook of Theoretical Computer Science, Volume B: Formal Models and Sematics.

[14]  J. G. A. 'andez A Fully Abstract Semantics for Constructor Systems , 2009 .

[15]  Herbert Kuchen,et al.  An Efficient Abstract Machine for Curry , 1999, GI Jahrestagung.

[16]  Philip Wadler,et al.  Packrat parsing:: simple, powerful, lazy, linear time, functional pearl , 2002, ICFP '02.

[17]  J. C. Gonz Alez-Moreno,et al.  An Approach to Declarative Programming Based on a Rewriting Logic , 2022 .

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

[19]  Heinrich Hußmann,et al.  Nondeterministic Algebraic Specifications and Nonconfluent Term Rewriting , 1992, J. Log. Program..

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

[21]  Sergio Antoy Constructor-based conditional narrowing , 2001, PPDP '01.

[22]  Christian Prehofer,et al.  Higher-order narrowing with definitional trees , 1999, Journal of Functional Programming.

[23]  Michael Hanus,et al.  Set functions for functional logic programming , 2009, PPDP '09.

[24]  Michael Hanus,et al.  Multi-paradigm Declarative Languages , 2007, ICLP.

[25]  Peyton Jones,et al.  Haskell 98 language and libraries : the revised report , 2003 .

[26]  Sebastian Fischer,et al.  Purely functional lazy non-deterministic programming , 2009, Journal of Functional Programming.

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

[28]  Michael Hanus,et al.  Applications of Declarative Programming and Knowledge Management, 17th International Conference, INAP 2007, and 21st Workshop on Logic Programming, WLP 2007, Würzburg, Germany, October 4-6, 2007, Revised Selected Papers , 2009, INAP/WLP.

[29]  Michael Hanus,et al.  Curry: an integrated functional logic language (version 0 , 2003 .

[30]  Francisco Javier López-Fraguas,et al.  An Approach to Declarative Programming Based on a Rewriting Logic , 1999, J. Log. Program..