skip to main content
10.1145/2500365.2500588acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Higher-order functional reactive programming without spacetime leaks

Published: 25 September 2013 Publication History

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

Cited By

View all

Index Terms

  1. Higher-order functional reactive programming without spacetime leaks

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    ICFP '13: Proceedings of the 18th ACM SIGPLAN international conference on Functional programming
    September 2013
    484 pages
    ISBN:9781450323260
    DOI:10.1145/2500365
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 25 September 2013

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. capabilities
    2. comonads
    3. dataflow
    4. functional reactive programming
    5. guarded recursion
    6. kripke logical relations
    7. temporal logic

    Qualifiers

    • Research-article

    Conference

    ICFP'13
    Sponsor:
    ICFP'13: ACM SIGPLAN International Conference on Functional Programming
    September 25 - 27, 2013
    Massachusetts, Boston, USA

    Acceptance Rates

    ICFP '13 Paper Acceptance Rate 40 of 133 submissions, 30%;
    Overall Acceptance Rate 333 of 1,064 submissions, 31%

    Upcoming Conference

    ICFP '25
    ACM SIGPLAN International Conference on Functional Programming
    October 12 - 18, 2025
    Singapore , Singapore

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)28
    • Downloads (Last 6 weeks)3
    Reflects downloads up to 25 Dec 2024

    Other Metrics

    Citations

    Cited By

    View all

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media