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

Functional reactive programming with liveness guarantees

Published:25 September 2013Publication History

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.

References

  1. U. A. Acar. Self-Adjusting Computation. PhD thesis, Carnegie Mellon Univ., 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. H. Apfelmus. http://www.haskell.org/haskellwiki/Reactive-banana.Google ScholarGoogle Scholar
  3. G. Berry and G. Gonthier. The Esterel synchronous programming language: Design, semantics, implementation. Sci. Computer Programming, 19 (2): 87--152, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. G. Bracha, J. Gosling, B. Joy, and G. Steele. The Java Language Specification. Sun Microsystems, third edition, 2005.Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. S. Burbeck. Applications programming in Smalltalk-80: How to use model-view-controller (MVC), 1987.Google ScholarGoogle Scholar
  6. L. Cardelli and P. Wegner. On understanding types, data abstraction, and polymorphism. ACM Comput. Surv., 28 (150), 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. A. Courtney. Frappé: Functional reactive programming in Java. In Proc. Symp. Pratical Aspects of Declarative Languages, pages 29--44, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. J. Donham. Functional reactive programming in OCaml. https://github.com/jaked/froc.Google ScholarGoogle Scholar
  10. C. Elliott. Push-pull functional reactive programming. In Proc. Haskell Symp., 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. C. Elliott and P. Hudak. Functional reactive animation. In Proc. Int. Conf. Functional Programming, pages 263--273, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. A. S. A. Jeffrey. https://github.com/agda/agda-frp-js/.Google ScholarGoogle Scholar
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  15. A. S. A. Jeffrey. Provably correct web applications: FRP in Agda in HTML5. In Proc. Int. Symp. Practical Aspects of Declarative Languages, 2013.Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. W. Jeltsch. Signals, not generators! In Proc. Symp. Trends in Functional Programming, pages 283--297, 2009.Google ScholarGoogle Scholar
  17. W. Jeltsch. Strongly Typed and Efficient Functional Reactive Programming. PhD thesis, BTU Cottbus, 2012.Google ScholarGoogle Scholar
  18. N. Krishnaswami and N. Benton. Ultrametric semantics of reactive programs. In Proc. IEEE Logic in Computer Science, pages 257--266, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. D. Leijen and E. Meijer. Domain specific embedded compilers. In Proc. Conf. Domain-Specific Languages, pages 109--122, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  21. H. Nilsson, A. Courtney, and J. Peterson. Functional reactive programming, continued. In Proc. ACM Workshop on Haskell, pages 51--64, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. G. Plotkin. Call-by-name, call-by-value, and the łambda-calculus. Theoretical Computer Science, 1: 125--159, 1975.Google ScholarGoogle ScholarCross RefCross Ref
  23. Yale Haskell Group. Yampa library for programming hybrid systems. http://www.haskell.org/haskellwiki/Yampa.Google ScholarGoogle Scholar

Index Terms

  1. Functional reactive programming with liveness guarantees

    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
    • 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

      Copyright © 2013 ACM

      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 ACM 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]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 25 September 2013

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      ICFP '13 Paper Acceptance Rate40of133submissions,30%Overall Acceptance Rate333of1,064submissions,31%

      Upcoming Conference

      ICFP '24

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader