skip to main content
research-article

Higher-order functional reactive programming without spacetime leaks

Published:25 September 2013Publication History
Skip Abstract Section

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.

References

  1. U. A. Acar. Self-Adjusting Computation. PhD thesis, Carnegie Mellon University, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. A. Ahmed, D. Dreyer, and A. Rossberg. State-dependent representation independence. In Principles of Programming Languages (POPL), pages 340--353, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. H. Baker and C. Hewitt. The incremental garbage collection of processes. In Symposium on Artificial Intelligence Programming Languages, August 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. G. Berry and L. Cosserat. The ESTEREL synchronous programming language and its mathematical semantics. In Seminar on Concurrency, pages 389--448. Springer, 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. A. Cave, F. Ferreira, P. Panangaden, and B. Pientka. Fair reactive programming. Technical report, McGill University, 2013.Google ScholarGoogle Scholar
  9. G. H. Cooper. Integrating Dataflow Evaluation into a Practical Higher-Order Call-by-Value Language. PhD thesis, Brown University, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. H. B. Curry. The Paradox of Kleene and Rosser. Transactions of the American Mathematical Society, 50 (3): 454--516, Nov. 1941.Google ScholarGoogle ScholarCross RefCross Ref
  12. J. Donham. Froc: a library for functional reactive programming in OCaml.texttthttp://jaked.github.com/froc/, 2010.Google ScholarGoogle Scholar
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. C. Elliott. Push-pull functional reactive programming. In Haskell Symposium, 2009. URL http://conal.net/papers/push-pull-frp. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. C. Elliott and P. Hudak. Functional reactive animation. In International Conference on Functional Programming (ICFP), 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. D. Friedman and D. Wise. The impact of applicative programming on multiprocessing. In International Conference on Parallel Processing, pages 263--272, 1976.Google ScholarGoogle Scholar
  17. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. M. Hofmann. Linear types and non-size-increasing polynomial time computation. In Logic in Computer Science (LICS), 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. A. Jeffrey. Causality for free!: parametricity implies causality for functional reactive programs. In Programming Languages Meets Program Verification (PLPV), pages 57--68, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. W. Jeltsch. Signals, not generators! Trends in Functional Programming, 10: 145--160, 2009.Google ScholarGoogle Scholar
  22. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  23. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  24. D. Kozen. Results on the propositional μ-calculus. Theoretical Computer Science, 27 (3): 333 -- 354, 1983.Google ScholarGoogle ScholarCross RefCross Ref
  25. 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 ScholarGoogle Scholar
  26. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  27. N. R. Krishnaswami and N. Benton. Ultrametric semantics of reactive programs. In Logic in Computer Science (LICS), pages 257--266, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  29. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  30. H. Liu, E. Cheng, and P. Hudak. Causal commutative arrows and their optimization. In International Conference on Functional Programming (ICFP), 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. I. Maier and M. Odersky. Deprecating the Observer Pattern with Scala.React. Technical report, EPFL, 2012.Google ScholarGoogle Scholar
  32. M. Miller. Robust composition: Towards a unified approach to access control and concurrency control. PhD thesis, Johns Hopkins University, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  34. H. Nakano. A modality for recursion. In Logic in Computer Science (LICS), pages 255--266, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. H. Nilsson, A. Courtney, and J. Peterson. Functional reactive programming, continued. In ACM Haskell Workshop, page 64, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. A. Pitts and I. Stark. Operational reasoning for functions with local state. Higher Order Operational Techniques in Semantics, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. G. D. Plotkin. A powerdomain construction. SIAM Journal of Computation, 5 (3): 452--487, 1976.Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. A. Pnueli. The temporal logic of programs. In Foundations of Computer Science (FOCS), pages 46--57, 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. M. Pouzet. Lucid Synchrone, version 3. Tutorial and reference manual. Université Paris-Sud, LRI, 2006.Google ScholarGoogle Scholar
  40. N. Sculthorpe and H. Nilsson. Safe functional reactive programming through dependent types. In International Conference on Functional Programming (ICFP), 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. N. Sculthorpe and H. Nilsson. Keeping calm in the face of change. Higher Order Symbolic Computation, 23 (2): 227--271, June 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. 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 ScholarGoogle Scholar
  43. Z. Wan, W. Taha, and P. Hudak. Event-driven FRP. In Practical Applications of Declarative Languages (PADL), pages 155--172, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Higher-order functional reactive programming without spacetime leaks

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!