Pull-Ups, Push-Downs, and Passing It Around - Exercises in Functional Incrementalization

Programs in languages such as Haskell are often datatypecentric and make extensive use of folds on that datatype. Incrementalization of such a program can significantly improve its performance by transforming monolithic atomic folds into incremental computations. Functional incrementalization separates the recursion from the application of the algebra in order to reduce redundant computations and reuse intermediate results. In this paper, we motivate incrementalization with a simple example and present a library for transforming programs using upwards, downwards, and circular incrementalization. Our benchmarks show that incrementalized computations using the library are nearly as fast as handwritten atomic functions.

[1]  Johan Jeuring,et al.  A lightweight approach to datatype-generic rewriting , 2008, WGP '08.

[2]  Ralf Hinze,et al.  Type-indexed data types , 2004, Sci. Comput. Program..

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

[4]  Thomas Arts,et al.  Verifying Generic Erlang Client-Server Implementations , 2000, IFL.

[5]  João Saraiva,et al.  Functional Incremental Attribute Evaluation , 2000, CC.

[6]  Conor McBride The Derivative of a Regular Type is its Type of One-Hole Contexts , 2001 .

[7]  Johan Jeuring Incremental algorithms on lists , 1991 .

[8]  Simon L. Peyton Jones,et al.  Associated types with class , 2005, POPL '05.

[9]  Simon L. Peyton Jones,et al.  Stretching the Storage Manager: Weak Pointers and Stable Names in Haskell , 1999, IFL.

[10]  Magnus Carlsson Monads for incremental computing , 2002, ICFP '02.

[11]  Ralf Hinze,et al.  Memo functions‚ polytypically! , 2000 .

[12]  Gérard P. Huet,et al.  The Zipper , 1997, Journal of Functional Programming.

[13]  Tarmo Uustalu,et al.  Comonadic functional attribute evaluation , 2005, Trends in Functional Programming.

[14]  Simon L. Peyton Jones,et al.  Template meta-programming for Haskell , 2002, Haskell '02.

[15]  Yanhong A. Liu,et al.  Efficiency by Incrementalization: An Introduction , 2000, High. Order Symb. Comput..

[16]  Johan Jeuring,et al.  Generic programming with fixed points for mutually recursive datatypes , 2009, ICFP.

[17]  Jean-Philippe Bernardy Lazy functional incremental parsing , 2009, Haskell.

[18]  Koen Claessen,et al.  QuickCheck: a lightweight tool for random testing of Haskell programs , 2011, SIGP.

[19]  Guy E. Blelloch,et al.  Adaptive functional programming , 2002, POPL '02.

[20]  Jeremy Gibbons Upwards and Downwards Accumulations on Trees , 1992, MPC.

[21]  Donald E. Knuth,et al.  Semantics of context-free languages , 1968, Mathematical systems theory.

[22]  Johan Jeuring,et al.  A translation from attribute grammars to catamorphisms , 1991 .

[23]  S. Doaitse Swierstra,et al.  Attribute grammars fly first-class: how to do aspect oriented programming in Haskell , 2009, ICFP.