ABSTRACT
Functional Reactive Programming (FRP) is an approach to the development of reactive systems which provides a pure functional interface, but which may be implemented as an abstraction of an imperative event-driven layer. FRP systems typically provide a model of behaviours (total time-indexed values, implemented as pull systems) and event sources (partial time-indexed values, implemented as push systems). In this paper, we investigate a type system for event-driven FRP programs which provide liveness guarantees, that is every input event is guaranteed to generate an output event. We show that FRP can be implemented on top of a model of sets and relations, and that the isomorphism between event sources and behaviours corresponds to the isomorphism between relations and set-valued functions. We then implement sets and relations using a model of continuations using the usual double-negation CPS transform. The implementation of behaviours as pull systems based on futures, and of event sources as push systems based on the observer pattern, thus arises from first principles. We also discuss a Java implementation of the FRP model.
- U. A. Acar. Self-Adjusting Computation. PhD thesis, Carnegie Mellon Univ., 2005. Google ScholarDigital Library
- H. Apfelmus. http://www.haskell.org/haskellwiki/Reactive-banana.Google Scholar
- G. Berry and G. Gonthier. The Esterel synchronous programming language: Design, semantics, implementation. Sci. Computer Programming, 19 (2): 87--152, 1992. Google ScholarDigital Library
- G. Bracha, J. Gosling, B. Joy, and G. Steele. The Java Language Specification. Sun Microsystems, third edition, 2005.Google ScholarDigital Library
- S. Burbeck. Applications programming in Smalltalk-80: How to use model-view-controller (MVC), 1987.Google Scholar
- L. Cardelli and P. Wegner. On understanding types, data abstraction, and polymorphism. ACM Comput. Surv., 28 (150), 1985. Google ScholarDigital Library
- G. H. Cooper and S. Krishnamurthi. Embedding dynamic dataflow in a call-by-value language. In Proc. European Symp. on Programming, pages 294--308, 2006. Google ScholarDigital Library
- A. Courtney. Frappé: Functional reactive programming in Java. In Proc. Symp. Pratical Aspects of Declarative Languages, pages 29--44, 2001. Google ScholarDigital Library
- J. Donham. Functional reactive programming in OCaml. https://github.com/jaked/froc.Google Scholar
- C. Elliott. Push-pull functional reactive programming. In Proc. Haskell Symp., 2009. Google ScholarDigital Library
- C. Elliott and P. Hudak. Functional reactive animation. In Proc. Int. Conf. Functional Programming, pages 263--273, 1997. Google ScholarDigital Library
- C. Hewitt, P. Bishop, and R. Steiger. A universal modular actor formalism for artificial intelligence. Proc. Int. Joint Conf. Artificial Intelligence, pages 235--245, 1973. Google ScholarDigital Library
- A. S. A. Jeffrey. https://github.com/agda/agda-frp-js/.Google Scholar
- A. S. A. Jeffrey. Causality for free!: Parametricity implies causality for functional reactive programs. In Proc. ACM Workshop Programming Languges meets Program Verification, pages 57--68, 2013. Google ScholarDigital Library
- A. S. A. Jeffrey. Provably correct web applications: FRP in Agda in HTML5. In Proc. Int. Symp. Practical Aspects of Declarative Languages, 2013.Google ScholarDigital Library
- W. Jeltsch. Signals, not generators! In Proc. Symp. Trends in Functional Programming, pages 283--297, 2009.Google Scholar
- W. Jeltsch. Strongly Typed and Efficient Functional Reactive Programming. PhD thesis, BTU Cottbus, 2012.Google Scholar
- N. Krishnaswami and N. Benton. Ultrametric semantics of reactive programs. In Proc. IEEE Logic in Computer Science, pages 257--266, 2011. Google ScholarDigital Library
- D. Leijen and E. Meijer. Domain specific embedded compilers. In Proc. Conf. Domain-Specific Languages, pages 109--122, 1999. Google ScholarDigital Library
- L. A. Meyerovich, A. Guha, J. Baskin, G. H. Cooper, M. Greenberg, A. Bromfield, and S. Krishnamurthi. Flapjax: A programming language for ajax applications. In Proc, ACM Conf. Object-Oriented Programming Systems, Languages and Applications, pages 1--20, 2009. Google ScholarDigital Library
- H. Nilsson, A. Courtney, and J. Peterson. Functional reactive programming, continued. In Proc. ACM Workshop on Haskell, pages 51--64, 2002. Google ScholarDigital Library
- G. Plotkin. Call-by-name, call-by-value, and the łambda-calculus. Theoretical Computer Science, 1: 125--159, 1975.Google ScholarCross Ref
- Yale Haskell Group. Yampa library for programming hybrid systems. http://www.haskell.org/haskellwiki/Yampa.Google Scholar
Index Terms
- Functional reactive programming with liveness guarantees
Recommendations
Functional reactive programming with liveness guarantees
ICFP '13Functional Reactive Programming (FRP) is an approach to the development of reactive systems which provides a pure functional interface, but which may be implemented as an abstraction of an imperative event-driven layer. FRP systems typically provide a ...
Functional reactive programming, refactored
Haskell '16Functional Reactive Programming (FRP) has come to mean many things. Yet, scratch the surface of the multitude of realisations, and there is great commonality between them. This paper investigates this commonality, turning it into a mathematically ...
Push-pull functional reactive programming
Haskell '09: Proceedings of the 2nd ACM SIGPLAN symposium on HaskellFunctional reactive programming (FRP) has simple and powerful semantics, but has resisted efficient implementation. In particular, most past implementations have used demand-driven sampling, which accommodates FRP's continuous time semantics and fits ...
Comments