A shortcut fusion rule for circular program calculation

Circular programs are a powerful technique to express multiple traversal algorithms as a single traversal function in a lazy setting. In this paper, we present a shortcut deforestation technique to calculate circular programs. The technique we propose takes as input the composition of two functions, such that the first builds an intermediate structure and some additional context information which are then processed by the second one, to produce the final result. Our transformation into circular programs achieves intermediate structure deforestation and multiple traversal elimination. Furthermore, the calculated programs preserve the termination properties of the original ones.

[1]  Philip Wadler,et al.  Deforestation: Transforming Programs to Eliminate Trees , 1988, Theoretical Computer Science.

[2]  John Launchbury,et al.  Warm fusion: deriving build-catas from recursive definitions , 1995, FPCA '95.

[3]  Andrew John Gill,et al.  Cheap deforestation for non-strict functional languages , 1996 .

[4]  Simon L. Peyton Jones,et al.  Aspect-Oriented Compilers , 1999, GCSE.

[5]  Patricia Johann,et al.  Free theorems in the presence of seq , 2004, POPL.

[6]  Jeremy Gibbons,et al.  Calculating Functional Programs , 2000, Algebraic and Coalgebraic Methods in the Mathematics of Program Construction.

[7]  Alberto Pardo A calculational approach to recursive programs with effects / von Albert Pardo , 2001 .

[8]  Richard S. Bird,et al.  Algebra of programming , 1997, Prentice Hall International series in computer science.

[9]  Richard S. Bird,et al.  Introduction to functional programming , 1988, Prentice Hall International series in computer science.

[10]  R. Cockett,et al.  Strong categorical datatypes I , 1991 .

[11]  Samson Abramsky,et al.  Domain theory , 1995, LICS 1995.

[12]  Nils Anders Danielsson,et al.  Fast and loose reasoning is morally correct , 2006, POPL '06.

[13]  Richard S. Bird Using circular programs to eliminate multiple traversals of data , 2004, Acta Informatica.

[14]  Masato Takeichi,et al.  A calculational fusion system HYLO , 1997, Algorithmic Languages and Calculi.

[15]  S. Doaitse Swierstra,et al.  First-class Attribute Grammars , 2000, Informatica.

[16]  Atze Dijkstra Stepping through Haskell , 2000 .

[17]  Philip Wadler,et al.  Theorems for free! , 1989, FPCA.

[18]  Atze Dijkstra,et al.  Typing Haskell with an Attribute Grammar (Part I) , 2004 .

[19]  Erik Poll,et al.  Algebra of Programming by Richard Bird and Oege de Moor, Prentice Hall, 1996 (dated 1997). , 1999 .

[20]  Chris Okasaki,et al.  Breadth-first numbering: lessons from a small exercise in algorithm design , 2000, ICFP '00.

[21]  João Saraiva,et al.  Designing and Implementing Combinator Languages , 1998, Advanced Functional Programming.

[22]  Janis Voigtländer Using circular programs to deforest in accumulating parameters , 2002, ASIA-PEPM '02.

[23]  Roland Carl Backhouse,et al.  Algebraic and Coalgebraic Methods in the Mathematics of Program Construction , 2000, Lecture Notes in Computer Science.

[24]  S. D. Swierstra,et al.  Using attribute grammars to derive efficient functional programs , 1986 .

[25]  Richard S. Bird,et al.  Introduction to functional programming using haskeu , 1998 .

[26]  S. Doaitse Swierstra,et al.  Attribute grammars in the functional style , 1998, Systems Implementation 2000.

[27]  Olivier Danvy,et al.  There and back again , 2001, ICFP '02.

[28]  Akihiko Takano,et al.  Shortcut Deforestation in Calculational Form(Theory of Rewriting Systems and Its Applications) , 1995 .

[29]  Alberto Pardo Generic Accumulations , 2002, Generic Programming.

[30]  João Saraiva,et al.  Tools and libraries to model and manipulate circular programs , 2007, PEPM '07.

[31]  Lex Augusteijn,et al.  Sorting Morphisms , 1998, Advanced Functional Programming.

[32]  Julia L. Lawall Implementing Circularity Using Partial Evaluation , 2001, PADO.

[33]  Joao Paulo Saraiva,et al.  Purely Functional Implementation of Attribute Grammars , 1999 .

[34]  Anthony M. Sloane,et al.  Generating software from specifications , 2007 .

[35]  Thomas Johnsson,et al.  Attribute grammars as a functional programming paradigm , 1987, FPCA.

[36]  Isao Sasano,et al.  Lightweight fusion by fixed point promotion , 2007, POPL '07.

[37]  Simon L. Peyton Jones,et al.  A short cut to deforestation , 1993, FPCA '93.