Abstract
Functional reactive programming (FRP) is an elegant approach to declaratively specify reactive systems. However, the powerful abstractions of FRP have historically made it difficult to predict and control the resource usage of programs written in this style.
In this paper, we give a new language for higher-order reactive programming. Our language generalizes and simplifies prior type systems for reactive programming, by supporting the use of streams of streams, first-class functions, and higher-order operations. We also support many temporal operations beyond streams, such as terminatable streams, events, and even resumptions with first-class schedulers. Furthermore, our language supports an efficient implementation strategy permitting us to eagerly deallocate old values and statically rule out spacetime leaks, a notorious source of inefficiency in reactive programs. Furthermore, these memory guarantees are achieved without the use of a complex substructural type discipline.
We also show that our implementation strategy of eager deallocation is safe, by showing the soundness of our type system with a novel step-indexed Kripke logical relation.
- U. A. Acar. Self-Adjusting Computation. PhD thesis, Carnegie Mellon University, 2005. Google Scholar
Digital Library
- A. Ahmed, D. Dreyer, and A. Rossberg. State-dependent representation independence. In Principles of Programming Languages (POPL), pages 340--353, 2009. Google Scholar
Digital Library
- A. Appel and D. McAllester. An indexed model of recursive types for foundational proof-carrying code. ACM Transactions on Programming Languages and Systems (TOPLAS), 23 (5): 657--683, 2001. Google Scholar
Digital Library
- H. Baker and C. Hewitt. The incremental garbage collection of processes. In Symposium on Artificial Intelligence Programming Languages, August 1977. Google Scholar
Digital Library
- G. Berry and L. Cosserat. The ESTEREL synchronous programming language and its mathematical semantics. In Seminar on Concurrency, pages 389--448. Springer, 1985. Google Scholar
Digital Library
- P. Caspi and M. Pouzet. Synchronous Kahn networks. In Proceedings of the first ACM SIGPLAN international conference on Functional programming, ICFP '96, pages 226--238, New York, NY, USA, 1996. ACM. ISBN 0-89791-770-7. 10.1145/232627.232651. Google Scholar
Digital Library
- P. Caspi, D. Pilaud, N. Halbwachs, and J. Plaice. LUSTRE: A declarative language for real-time programming. In Principles of Programming Languages (POPL), 1987. Google Scholar
Digital Library
- A. Cave, F. Ferreira, P. Panangaden, and B. Pientka. Fair reactive programming. Technical report, McGill University, 2013.Google Scholar
- G. H. Cooper. Integrating Dataflow Evaluation into a Practical Higher-Order Call-by-Value Language. PhD thesis, Brown University, 2008. Google Scholar
Digital Library
- G. H. Cooper and S. Krishnamurthi. Embedding dynamic dataflow in a call-by-value language. In European Symposium on Programming (ESOP), pages 294--308, 2006. Google Scholar
Digital Library
- H. B. Curry. The Paradox of Kleene and Rosser. Transactions of the American Mathematical Society, 50 (3): 454--516, Nov. 1941.Google Scholar
Cross Ref
- J. Donham. Froc: a library for functional reactive programming in OCaml.texttthttp://jaked.github.com/froc/, 2010.Google Scholar
- D. Dreyer, G. Neis, and L. Birkedal. The impact of higher-order state and control effects on local relational reasoning. In International Conference on Functional Programming (ICFP), pages 143--156, 2010. Google Scholar
Digital Library
- C. Elliott. Push-pull functional reactive programming. In Haskell Symposium, 2009. URL http://conal.net/papers/push-pull-frp. Google Scholar
Digital Library
- C. Elliott and P. Hudak. Functional reactive animation. In International Conference on Functional Programming (ICFP), 1997. Google Scholar
Digital Library
- D. Friedman and D. Wise. The impact of applicative programming on multiprocessing. In International Conference on Parallel Processing, pages 263--272, 1976.Google Scholar
- M. J. Gabbay and A. M. Pitts. A new approach to abstract syntax with variable binding. Formal Aspects of Computing, 13: 341--363, 2001.Google Scholar
Digital Library
- M. Hofmann. Linear types and non-size-increasing polynomial time computation. In Logic in Computer Science (LICS), 1999. Google Scholar
Digital Library
- A. Jeffrey. LTL types FRP: linear-time temporal logic propositions as types, proofs as functional reactive programs. In Programming Languages Meets Program Verification (PLPV), pages 49--60, 2012. Google Scholar
Digital Library
- A. Jeffrey. Causality for free!: parametricity implies causality for functional reactive programs. In Programming Languages Meets Program Verification (PLPV), pages 57--68, 2013. Google Scholar
Digital Library
- W. Jeltsch. Signals, not generators! Trends in Functional Programming, 10: 145--160, 2009.Google Scholar
- W. Jeltsch. Towards a common categorical semantics for linear-time temporal logic and functional reactive programming. Electronic Notes in Theoretical Computer Science, 286: 229--242, Sept. 2012. Google Scholar
Digital Library
- W. Jeltsch. Temporal logic with "until", functional reactive programming with processes, and concrete process categories. In Programming Languages Meets Program Verification (PLPV), pages 69--78, 2013. Google Scholar
Digital Library
- D. Kozen. Results on the propositional μ-calculus. Theoretical Computer Science, 27 (3): 333 -- 354, 1983.Google Scholar
Cross Ref
- N. R. Krishnaswami. Proofs for higher-order reactive programming without spacetime leaks (supplementary material). Technical report, Max Planck Institute for Software Systems (MPI-SWS), 2013.Google Scholar
- N. R. Krishnaswami and N. Benton. A semantic model for graphical user interfaces. In International Conference on Functional programming (ICFP), pages 45--57, 2011. Google Scholar
Digital Library
- N. R. Krishnaswami and N. Benton. Ultrametric semantics of reactive programs. In Logic in Computer Science (LICS), pages 257--266, 2011. Google Scholar
Digital Library
- N. R. Krishnaswami, N. Benton, and J. Hoffmann. Higher-order functional reactive programming in bounded space. In Principles of Programming Languages (POPL), pages 45--58, 2012. Google Scholar
Digital Library
- B. S. Lerner, M. J. Carroll, D. P. Kimmel, H. Q.-D. La Vallee, and S. Krishnamurthi. Modeling and reasoning about DOM events. In Conference on Web Application Development (WebApps), 2012. Google Scholar
Digital Library
- H. Liu, E. Cheng, and P. Hudak. Causal commutative arrows and their optimization. In International Conference on Functional Programming (ICFP), 2009. Google Scholar
Digital Library
- I. Maier and M. Odersky. Deprecating the Observer Pattern with Scala.React. Technical report, EPFL, 2012.Google Scholar
- M. Miller. Robust composition: Towards a unified approach to access control and concurrency control. PhD thesis, Johns Hopkins University, 2006. Google Scholar
Digital Library
- T. Murphy VII., K. Crary, and R. Harper. Type-safe distributed programming with ML5. In Conference on Trustworthy Global Computing (TGC), pages 108--123, 2008. Google Scholar
Digital Library
- H. Nakano. A modality for recursion. In Logic in Computer Science (LICS), pages 255--266, 2000. Google Scholar
Digital Library
- H. Nilsson, A. Courtney, and J. Peterson. Functional reactive programming, continued. In ACM Haskell Workshop, page 64, 2002. Google Scholar
Digital Library
- A. Pitts and I. Stark. Operational reasoning for functions with local state. Higher Order Operational Techniques in Semantics, 1998. Google Scholar
Digital Library
- G. D. Plotkin. A powerdomain construction. SIAM Journal of Computation, 5 (3): 452--487, 1976.Google Scholar
Digital Library
- A. Pnueli. The temporal logic of programs. In Foundations of Computer Science (FOCS), pages 46--57, 1977. Google Scholar
Digital Library
- M. Pouzet. Lucid Synchrone, version 3. Tutorial and reference manual. Université Paris-Sud, LRI, 2006.Google Scholar
- N. Sculthorpe and H. Nilsson. Safe functional reactive programming through dependent types. In International Conference on Functional Programming (ICFP), 2009. Google Scholar
Digital Library
- N. Sculthorpe and H. Nilsson. Keeping calm in the face of change. Higher Order Symbolic Computation, 23 (2): 227--271, June 2010. Google Scholar
Digital Library
- P. Wadler, W. Taha, and D. MacQueen. How to add laziness to a strict language, without even being odd. In Workshop on Standard ML, 1998.Google Scholar
- Z. Wan, W. Taha, and P. Hudak. Event-driven FRP. In Practical Applications of Declarative Languages (PADL), pages 155--172, 2002. Google Scholar
Digital Library
Index Terms
Higher-order functional reactive programming without spacetime leaks
Recommendations
Higher-order functional reactive programming without spacetime leaks
ICFP '13: Proceedings of the 18th ACM SIGPLAN international conference on Functional programmingFunctional reactive programming (FRP) is an elegant approach to declaratively specify reactive systems. However, the powerful abstractions of FRP have historically made it difficult to predict and control the resource usage of programs written in this ...
Higher-order functional reactive programming in bounded space
POPL '12: Proceedings of the 39th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesFunctional reactive programming (FRP) is an elegant and successful approach to programming reactive systems declaratively. The high levels of abstraction and expressivity that make FRP attractive as a programming model do, however, often lead to ...
Higher-order functional reactive programming in bounded space
POPL '12Functional reactive programming (FRP) is an elegant and successful approach to programming reactive systems declaratively. The high levels of abstraction and expressivity that make FRP attractive as a programming model do, however, often lead to ...







Comments