Plugging a Space Leak with an Arrow

The implementation of conceptually continuous signals in functional reactive programming (FRP) is studied in detail. We show that recursive signals in standard implementations using streams and continuations lead to potentially serious time and space leaks under conventional call-by-need evaluation. However, by moving to the level of signal functions, and structuring the design around arrows, this class of time and space leaks can be avoided. We further show that the use of optimal reduction can also avoid the problem, at the expense of a much more complex evaluator.

[1]  William D. Clinger Proper tail recursion and space efficiency , 1998, PLDI.

[2]  Paul Hudak The Haskell School of Expression: Learning Functional Programming through Multimedia , 1999 .

[3]  Paul Hudak,et al.  Dance : A Declarative Language for the Control of Humanoid Robots Research Report YALEU / DCS / RR-1253 , 2003 .

[4]  Paul Hudak,et al.  HPorter: Using Arrows to Compose Parallel Processes , 2007, PADL.

[5]  Henrik Nilsson,et al.  Functional reactive programming, continued , 2002, Haskell '02.

[6]  Paul Hudak,et al.  Real-time FRP , 2001, ICFP '01.

[7]  Colin Runciman,et al.  A model for comparing the space usage of lazy evaluators , 2000, PPDP '00.

[8]  Matthias Felleisen,et al.  A call-by-need lambda calculus , 1995, POPL '95.

[9]  Martin Odersky,et al.  The call-by-need lambda calculus , 1998, Journal of Functional Programming.

[10]  Paul Hudak,et al.  Functional reactive animation , 1997, ICFP '97.

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

[12]  Paul Hudak,et al.  Arrows, Robots, and Functional Reactive Programming , 2002, Advanced Functional Programming.

[13]  Adam Bakewell An operational theory of relative space efficiency , 2001 .

[14]  Philip Wadler,et al.  Fixing some space leaks with a garbage collector , 1987, Softw. Pract. Exp..

[15]  Paul Hudak,et al.  A language for declarative robotic programming , 1999, Proceedings 1999 IEEE International Conference on Robotics and Automation (Cat. No.99CH36288C).

[16]  Paul Hudak,et al.  Lambda in Motion: Controlling Robots with Haskell , 1999, PADL.

[17]  Conal Elliott,et al.  Functional Implementations of Continuos Modeled Animation , 1998, PLILP/ALP.

[18]  Ross Paterson,et al.  A new notation for arrows , 2001, ICFP '01.

[19]  John Launchbury,et al.  A natural semantics for lazy evaluation , 1993, POPL '93.

[20]  Simon David Marlow,et al.  Deforestation for higher-order functional programs , 1995 .

[21]  Henrik Nilsson,et al.  The Yampa arcade , 2003, Haskell '03.

[22]  Antony Courtney,et al.  Genuinely Functional User Interfaces , 2001 .

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

[24]  Chris Hankin,et al.  Abstract Interpretation of Declarative Languages , 1987 .

[25]  John Hughes,et al.  Generalising monads to arrows , 2000, Sci. Comput. Program..

[26]  David Sands,et al.  Possibilities and limitations of call-by-need space improvement , 2001, ICFP '01.

[27]  Ron Dinishak The optimal implementation of functional programming languages , 2000, SOEN.

[28]  Simon L. Peyton Jones,et al.  Imperative functional programming , 1993, POPL '93.

[29]  John Lamping,et al.  An algorithm for optimal lambda calculus reduction , 1989, POPL '90.

[30]  Phil Wadfer,et al.  Strictness analysis on non-fiat domains (by abstract interpretation over finite domains) , 1985 .

[31]  Andrew W. Appel,et al.  Compiling with Continuations , 1991 .

[32]  Vincent van Oostrom,et al.  Efficient lambda-Evaluation with Interaction Nets , 2004, RTA.