Causal commutative arrows

Arrows are a popular form of abstract computation. Being more general than monads, they are more broadly applicable, and, in particular, are a good abstraction for signal processing and dataflow computations. Most notably, arrows form the basis for a domain-specific language called Yampa, which has been used in a variety of concrete applications, including animation, robotics, sound synthesis, control systems, and graphical user interfaces. Our primary interest is in better understanding the class of abstract computations captured by Yampa. Unfortunately, arrows are not concrete enough to do this with precision. To remedy this situation, we introduce the concept of commutative arrows that capture a noninterference property of concurrent computations. We also add an init operator that captures the causal nature of arrow effects, and identify its associated law. To study this class of computations in more detail, we define an extension to arrows called causal commutative arrows (CCA), and study its properties. Our key contribution is the identification of a normal form for CCA called causal commutative normal form (CCNF). By defining a normalization procedure, we have developed an optimization strategy that yields dramatic improvements in performance over conventional implementations of arrows. We have implemented this technique in Haskell, and conducted benchmarks that validate the effectiveness of our approach. When compiled with the Glasgow Haskell Compiler (GHC), the overall methodology can result in significant speedups.

[1]  David Kirby,et al.  Multiplicities in graded rings II: integral equivalence and the Buchsbaum–Rim multiplicity , 1996, Mathematical Proceedings of the Cambridge Philosophical Society.

[2]  Nicolas Halbwachs,et al.  LUSTRE: a declarative language for real-time programming , 1987, POPL '87.

[3]  Paul Hudak,et al.  Building domain-specific embedded languages , 1996, CSUR.

[4]  Paul Hudak,et al.  Plugging a Space Leak with an Arrow , 2007, Festschrift honoring Gary Lindstrom.

[5]  Marc Pouzet,et al.  A Co-iterative Characterization of Synchronous Stream Functions , 1998, CMCS.

[6]  Nicolas Halbwachs,et al.  LUSTRE: A declarative language for programming synchronous systems* , 1987 .

[7]  Masahito Hasegawa,et al.  Recursion from Cyclic Sharing: Traced Monoidal Categories and Models of Cyclic Lambda Calculi , 1997, TLCA.

[8]  Robert Stephens,et al.  A survey of stream processing , 1997, Acta Informatica.

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

[10]  David Harel,et al.  On folk theorems , 1980, CACM.

[11]  Henrik Nilsson,et al.  Dynamic optimization for functional reactive programming using generalized algebraic data types , 2005, ICFP '05.

[12]  Tarmo Uustalu,et al.  Advanced Functional Programming, 5th International School, AFP 2004, Tartu, Estonia, August 14-21, 2004, Revised Lectures , 2005, Advanced Functional Programming.

[13]  Shriram Krishnamurthi,et al.  Lowering: a static optimization technique for transparent functional reactivity , 2007, PEPM '07.

[14]  Mary Sheeran,et al.  Lava: hardware design in Haskell , 1998, ICFP '98.

[15]  Paul Hudak,et al.  Audio Processing and Sound Synthesis in Haskell , 2009 .

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

[17]  Robert Atkey,et al.  What is a Categorical Model of Arrows? , 2011, MSFP@ICALP.

[18]  Zhong Shao,et al.  Proceedings of the 36th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages , 2009, POPL 2009.

[19]  John Hughes Programming with Arrows , 2004, Advanced Functional Programming.

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

[21]  Simon L. Peyton Jones Haskell 98: Introduction , 2003, J. Funct. Program..

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

[23]  Paul Hudak,et al.  Modeling user interfaces in a functional language , 2004 .

[24]  Johan Jeuring,et al.  Polytypic Compact Printing and Parsing , 1999, ESOP.

[25]  Jan Maluszynski,et al.  Proceedings of the 3rd International Symposium on Programming Language Implementation and Logic Programming , 1991 .

[26]  George H. Mealy,et al.  A method for synthesizing sequential circuits , 1955 .

[27]  Henrik Nilsson,et al.  Optimisation of Dynamic, Hybrid Signal Function Networks , 2008, Trends in Functional Programming.

[28]  Tarmo Uustalu,et al.  The Essence of Dataflow Programming , 2005, APLAS.

[29]  Paul Le Guernic,et al.  Implementation of the data-flow synchronous language SIGNAL , 1995, PLDI '95.

[30]  Dominic R. Verity,et al.  Traced monoidal categories , 1996, Mathematical Proceedings of the Cambridge Philosophical Society.

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

[32]  Philip Wadler,et al.  A practical subtyping system for Erlang , 1997, ICFP '97.

[33]  Hayo Thielecke,et al.  Closed Freyd- and kappa-categories , 1999, ICALP.

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

[35]  Roman Leshchinskiy,et al.  Stream fusion: from lists to streams to nothing at all , 2007, ICFP '07.

[36]  Stavros Tripakis,et al.  Modularity vs. Reusability: Code Generation from Synchronous Block Diagrams , 2008, 2008 Design, Automation and Test in Europe.

[37]  Paul Hudak,et al.  An Ode to Arrows , 2010, PADL.

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

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

[40]  William W. Wadge,et al.  Lucid, the dataflow programming language , 1985 .

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

[42]  Eugenio Moggi,et al.  Notions of Computation and Monads , 1991, Inf. Comput..

[43]  William Thies,et al.  StreamIt: A Language for Streaming Applications , 2002, CC.

[44]  Marc Pouzet,et al.  Modular static scheduling of synchronous data-flow networks: an efficient symbolic representation , 2009, EMSOFT '09.

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

[46]  Paul Hudak,et al.  Modular domain specific languages and tools , 1998, Proceedings. Fifth International Conference on Software Reuse (Cat. No.98TB100203).

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

[48]  Mun Hon Cheong,et al.  Functional Programming and 3D Games , 2005 .

[49]  Philip Wadler,et al.  The arrow calculus , 2010, J. Funct. Program..

[50]  Henrik Nilsson,et al.  Switched-On Yampa , 2008, PADL.

[51]  Arto Salomaa,et al.  ICALP'88: Proceedings of the 15th International Colloquium on Automata, Languages and Programming , 1988 .

[52]  G. Goertzel An Algorithm for the Evaluation of Finite Trigonometric Series , 1958 .

[53]  Marc Pouzet,et al.  Towards a higher-order synchronous data-flow language , 2004, EMSOFT '04.

[54]  Stavros Tripakis,et al.  Modular code generation from synchronous block diagrams: modularity vs. code size , 2009, POPL '09.

[55]  Edwin V. Bonilla,et al.  Predicting best design trade-offs: A case study in processor customization , 2012, 2012 Design, Automation & Test in Europe Conference & Exhibition (DATE).

[56]  Philip Wadler,et al.  The Arrow Calculus (Functional Pearl) , 2008 .

[57]  Nicolas Halbwachs,et al.  Generating Efficient Code From Data-Flow Programs , 1991, PLILP.

[58]  Ross Street,et al.  Traced monoidal categories , 1996 .

[59]  Jan J. M. M. Rutten,et al.  Algebraic Specification and Coalgebraic Synthesis of Mealy Automata , 2006, FACS.

[60]  Conor McBride,et al.  Applicative programming with effects , 2008, J. Funct. Program..