Abstract
Functional Reactive Programming, or FRP, is a general framework for programming hybrid systems in a high-level, declarative manner. The key ideas in FRP are its notions of behaviors and events. Behaviors are time-varying, reactive values, while events are time-ordered sequences of discrete-time event occurrences. FRP is the essence of Fran, a domain-specific language embedded in Haskell for programming reactive animations, but FRP is now also being used in vision, robotics and other control systems applications.
In this paper we explore the formal semantics of FRP and how it relates to an implementation based on streams that represent (and therefore only approximate) continuous behaviors. We show that, in the limit as the sampling interval goes to zero, the implementation is faithful to the formal, continuous semantics, but only when certain constraints on behaviors are observed. We explore the nature of these constraints, which vary amongst the FRP primitives. Our results show both the power and limitations of this approach to language design and implementation. As an example of a limitation, we show that streams are incapable of representing instantaneous predicate events over behaviors.
- 1 Tom M. Apostol. Mathematical Analysis A Modern Approach to Advanced Calculus. Addison-Wesley, 1957.]]Google Scholar
- 2 Gerard Berry. The Foundations of Esterel. MIT Press, 1998.]]Google Scholar
- 3 Gerard Berry. The constructive semantics of pure esteral (draft version 3). Draft Version 3, Ecole des Mines de Paris and INRIA, July 1999.]]Google Scholar
- 4 P. Caspi, N. Halbwachs, D. Pilaud, and J.A. Plaice. Lustre: A declarative language for programming synchronous systems. In 14th A CM Syrup. on Principles of Programming Languages, January 1987.]] Google ScholarDigital Library
- 5 Conal Elliott. Modeling interactive 3D and multimedia animation with an embedded language. In Proceedings of the first conference on Domain-Specific Languages, pages 285-296. USENIX, October 1997.]] Google ScholarDigital Library
- 6 Conal Elliott. Functional implementations of continuous modeled animation. In Proceedings of PLILP/ALP '93. Springer-Verlag, 1998.]] Google ScholarDigital Library
- 7 Conal Elliott and Paul Hudak. Functional reactive animation. In International Conference on Functional Programming, pages 163-173, June 1997.]] Google ScholarDigital Library
- 8 Thierry Gautier, Paul Le Guernic, and Loic Besnard. Signal: A declarative language for synchronous programming of real-time systems. In Gilles Kahn, editor, Functional Programming Languages and Computer Architecture, volume 274 of Lect Notes in Computer Science edited by C. Coos and J. Hartmanis, pages 257-277. $pringer-Verlag, 1987.]] Google ScholarDigital Library
- 9 Paul Hudak. Modular domain specific languages and tools. In Proceedings of Fifth International Conference on Software Reuse, pages 134-142. IEEE Computer Society, June 1998.]] Google ScholarDigital Library
- 10 Paul Hudak. The Haskell School of Expression - Learning Functional Programming through Multimedia. Cambridge University Press, New York, 2000.]] Google ScholarDigital Library
- 11 Paul Hudak, Simon Peyton Jones, and Philip Wadler (editors). Report on the Programming Language Haskell, A Non-strict Purely Functional Language (Version 1.2). A CM SICPLAN Notices, 27(5), May 1992.]] Google ScholarDigital Library
- 12 Simon Peyton Jones, Andrew Gordon, and $igbjorn Finne. Concurrent Haskell. In A CM Symposium on the Principles of Programming Languages, St. Petersburg Beach, Florida, January 1996.]] Google ScholarDigital Library
- 13 John Peterson, Gregory Hager, and Paul Hudak. A language for declarative robotic programming. In International Conference on Robotics and Automation, 1999.]]Google ScholarCross Ref
- 14 John Peterson, Paul Hudak, and Conal Elliott. Lambda in motion: Controlling robots with Haskell. In First International Workshop on Practical Aspects of Declarative Languages. $IGPLAN, Jan 1999.]] Google ScholarDigital Library
- 15 John H. Reppy. CML: A higher-order concurrent language. Proceedings of the A CM SICPLAN 91 Conference on Programming Language Design and Implementation, pages 293-305, 1991.]] Google ScholarDigital Library
- 16 W.W. Wadge and E.A. Ashcroft. Lucid the Dataflow Programming Language. Academic Press U.K., 1985.]] Google ScholarDigital Library
Index Terms
- Functional reactive programming from first principles
Recommendations
Functional reactive programming, refactored
Haskell 2016: Proceedings of the 9th International Symposium on HaskellFunctional 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 ...
Functional reactive programming from first principles
PLDI '00: Proceedings of the ACM SIGPLAN 2000 conference on Programming language design and implementationFunctional Reactive Programming, or FRP, is a general framework for programming hybrid systems in a high-level, declarative manner. The key ideas in FRP are its notions of behaviors and events. Behaviors are time-varying, reactive values, while events ...
Functional reactive programming, continued
Haskell '02: Proceedings of the 2002 ACM SIGPLAN workshop on HaskellFunctional Reactive Programming (FRP) extends a host programming language with a notion of time flow. Arrowized FRP (AFRP) is a version of FRP embedded in Haskell based on the arrow combinators. AFRP is a powerful synchronous dataflow programming ...
Comments