skip to main content
10.1145/3331545.3342601acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article
Public Access

Synthesizing functional reactive programs

Published:08 August 2019Publication History

ABSTRACT

Functional Reactive Programming (FRP) is a paradigm that has simplified the construction of reactive programs. There are many libraries that implement incarnations of FRP, using abstractions such as Applicative, Monads, and Arrows. However, finding a good control flow, that correctly manages state and switches behaviors at the right times, still poses a major challenge to developers. An attractive alternative is specifying the behavior instead of programming it, as made possible by the recently developed logic: Temporal Stream Logic (TSL). However, it has not been explored so far how Control Flow Models (CFMs), resulting from TSL synthesis, are turned into executable code that is compatible with libraries building on FRP. We bridge this gap, by showing that CFMs are a suitable formalism to be turned into Applicative, Monadic, and Arrowized FRP. We demonstrate the effectiveness of our translations on a real-world kitchen timer application, which we translate to a desktop application using the Arrowized FRP library Yampa, a web application using the Monadic Threepenny-GUI library, and to hardware using the Applicative hardware description language ClaSH.

References

  1. Heinrich Apfelmus. 2012. Reactive-banana. Haskell library available at http://www. haskell. org/haskellwiki/Reactive-banana (2012).Google ScholarGoogle Scholar
  2. Heinrich Apfelmus. 2013. Threepenny-gui. https://wiki.haskell.org/ Threepenny-gui .Google ScholarGoogle Scholar
  3. C.P.R. Baaij. 2015. Digital circuit in C λaSH: functional specifications and type-directed synthesis. Ph.D. Dissertation.Google ScholarGoogle Scholar
  4. Manuel Bärenz and Ivan Perez. 2018. Rhine: FRP with type-level clocks. In Proceedings of the 11th ACM SIGPLAN International Symposium on Haskell, Haskell@ICFP 2018, St. Louis, MO, USA, September 27-17, 2018, Nicolas Wu (Ed.). ACM, 145–157. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Tewodros Beyene, Swarat Chaudhuri, Corneliu Popeea, and Andrey Rybalchenko. 2014. A Constraint-based Approach to Solving Games on Infinite Graphs. In POPL. ACM, 221–233. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Roderick Bloem, Barbara Jobstmann, Nir Piterman, Amir Pnueli, and Yaniv Sa’ar. 2012. Synthesis of reactive (1) designs. J. Comput. System Sci. 78, 3 (2012), 911–938. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Andrew Cave, Francisco Ferreira, Prakash Panangaden, and Brigitte Pientka. 2014. Fair Reactive Programming (POPL ’14). ACM, New York, NY, USA, 361–372. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Antony Courtney, Henrik Nilsson, and John Peterson. 2003. The Yampa Arcade. In Proceedings of the 2003 ACM SIGPLAN workshop on Haskell. ACM, 7–18. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. David Cyrluk and Paliath Narendran. 1994. Ground temporal logic: A logic for hardware verification. In CAV. Springer, 247–259. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Evan Czaplicki and Stephen Chong. 2013. Asynchronous Functional Reactive Programming for GUIs (PLDI ’13). ACM, New York, NY, USA, 411–422. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Rayna Dimitrova and Bernd Finkbeiner. 2012. Counterexample-Guided Synthesis of Observation Predicates. Springer Berlin Heidelberg, Berlin, Heidelberg, 107–122. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Conal Elliott and Paul Hudak. 1997. Functional reactive animation. In ACM SIGPLAN Notices, Vol. 32. ACM, 263–273. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Bernd Finkbeiner, Felix Klein, Ruzica Piskac, and Mark Santolucito. 2019. Temporal Stream Logic: Synthesis beyond the Bools. In Computer Aided Verification - 31th International Conference, CAV 2019, New York, NY, USA, July 15-18, 2019, Proceedings, Part I.Google ScholarGoogle Scholar
  14. Samuel Gélineau. 2016. FRPzoo - Comparing many FRP implementations by reimplementing the same toy app in each. https://github.com/gelisam/ frp-zoo .Google ScholarGoogle Scholar
  15. Caleb Helbling and Samuel Z. Guyer. 2016. Juniper: A Functional Reactive Programming Language for the Arduino (FARM 2016). ACM, New York, NY, USA, 9. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. John Hughes. 2000. Generalising monads to arrows. Science of computer programming 37, 1 (2000), 67–111. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Alan Jeffrey. 2012. LTL types FRP: linear-time temporal logic propositions as types, proofs as functional reactive programs, Koen Claessen and Nikhil Swamy (Eds.). ACM, 49–60. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Wolfgang Jeltsch. 2012. Towards a common categorical semantics for lineartime temporal logic and functional reactive programming. ENTCS 286 (2012), 229–242. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Gangyuan Jing, Tarik Tosun, Mark Yim, and Hadas Kress-Gazit. 2016. An End-To-End System for Accomplishing Tasks with Modular Robots. In RSS.Google ScholarGoogle Scholar
  20. Ayrat Khalimov, Roderick Paul Bloem, and Swen Jacobs. 2014. Parameterized Synthesis Case Study: AMBA AHB. In SYNT 2014, Susmit Jha Krishnendu Chatterjee, Rüdiger Ehlers (Ed.).Google ScholarGoogle Scholar
  21. Neelakantan R Krishnaswami. 2013. Higher-order functional reactive programming without spacetime leaks. In ACM SIGPLAN Notices, Vol. 48. ACM, 221–232. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Viktor Kuncak, Mikaël Mayer, Ruzica Piskac, and Philippe Suter. 2010. Complete functional synthesis. ACM Sigplan Notices 45, 6 (2010), 316–329. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Sam Lindley, Philip Wadler, and Jeremy Yallop. 2011. Idioms are oblivious, arrows are meticulous, monads are promiscuous. ENTCS 229, 5 (2011), 97–117. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Hai Liu, Eric Cheng, and Paul Hudak. 2011. Causal commutative arrows. J. Funct. Program. 21, 4-5 (2011), 467–496. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Hai Liu and Paul Hudak. 2007. Plugging a space leak with an arrow. ENTCS 193 (2007), 29–45. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Parthasarathy Madhusudan. 2011. Synthesizing reactive programs. In LIPIcsLeibniz International Proceedings in Informatics, Vol. 12.Google ScholarGoogle Scholar
  27. Geoffrey Mainland. 2007. Why It’s Nice to be Quoted: Quasiquoting for Haskell. In Proceedings of the ACM SIGPLAN workshop on Haskell workshop. ACM, 73–82. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Philipp J. Meyer, Salomon Sickert, and Michael Luttenberger. 2018. Strix: Explicit Reactive Synthesis Strikes Back!. In Computer Aided Verification - 30th International Conference, CAV 2018, Held as Part of the Federated Logic Conference, FloC 2018, Oxford, UK, July 14-17, 2018, Proceedings, Part I (Lecture Notes in Computer Science), Hana Chockler and Georg Weissenbacher (Eds.), Vol. 10981. Springer, 578–586.Google ScholarGoogle Scholar
  29. Tom E Murphy. 2016. A livecoding semantics for functional reactive programming. In Functional Art, Music, Modelling, and Design. ACM, 48–53. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Peter Michael Osera and Steve Zdancewic. 2015. Type-and-example-directed program synthesis. In ACM SIGPLAN Notices, Vol. 50. ACM, 619–630. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Gergely Patai. 2010. Efficient and compositional higher-order streams. In International Workshop on Functional and Constraint Logic Programming. Springer. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Ross Paterson. 2001. A New Notation for Arrows. In International Conference on Functional Programming. ACM Press, 229–240. http://www.soi.city. ac.uk/~ross/papers/notation.html Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Ivan Perez. 2017. GALE: a functional graphic adventure library and engine. In Proceedings of the 5th ACM SIGPLAN International Workshop on Functional Art, Music, Modeling, and Design, FARM@ICFP 2018, Oxford, UK, September 9, 2017. 28–35. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Ivan Perez, Manuel Bärenz, and Henrik Nilsson. 2016. Functional reactive programming, refactored. In International Conference on Functional Programming. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Ivan Perez and Henrik Nilsson. 2017. Testing and debugging functional reactive programming. PACMPL 1, ICFP (2017), 2:1–2:27. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Nir Piterman, Amir Pnueli, and Yaniv Sa’ar. 2006. Synthesis of Reactive(1) Designs. In VMCAI. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Atze van der Ploeg and Koen Claessen. 2015. Practical principled FRP: forget the past, change the future, FRPNow!. In ACM SIGPLAN Notices, Vol. 50. ACM, 302–314. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Nadia Polikarpova, Ivan Kuraj, and Armando Solar-Lezama. 2016. Program synthesis from polymorphic refinement types. In Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2016, Santa Barbara, CA, USA, June 13-17, 2016, Chandra Krintz and Emery Berger (Eds.). ACM, 522–538. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Vasumathi Raman, Alexandre Donzé, Dorsa Sadigh, Richard M. Murray, and Sanjit A. Seshia. 2015. Reactive Synthesis from Signal Temporal Logic Specifications. In HSCC. 239–248. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Mark Santolucito, Donya Quick, and Paul Hudak. 2015. Media Modules: Intermedia Systems in a Pure Functional Paradigm. In ICMC 2015, Denton, TX, USA. http://hdl.handle.net/2027/spo.bbp2372.2015.077Google ScholarGoogle Scholar
  41. Kensuke Sawada and Takuo Watanabe. 2016. Emfrp: a functional reactive programming language for small-scale embedded systems. In Companion Proceedings of the 15th International Conference on Modularity, Málaga, Spain, March 14 - 18, 2016, Lidia Fuentes, Don S. Batory, and Krzysztof Czarnecki (Eds.). ACM, 36–44. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Neil Sculthorpe and Henrik Nilsson. 2010. Keeping calm in the face of change. Higher-Order and Symbolic Computation 23, 2 (2010), 227–271. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Zhiyong Shan, Tanzirul Azim, and Iulian Neamtiu. 2016. Finding Resume and Restart Errors in Android Applications (OOPSLA 2016). ACM, New York, NY, USA, 864–880. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Armando Solar-Lezama. 2013. Program sketching. STTT 15, 5-6 (2013), 475–495. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Ryan Trinkle. 2017. Reflex-FRP. https://github.com/reflex-frp/reflex .Google ScholarGoogle Scholar
  46. Martin T. Vechev, Eran Yahav, and Greta Yorsh. 2013. Abstraction-guided synthesis of synchronization. STTT 15, 5-6 (2013), 413–431. Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. Andreas Voellmy, Junchang Wang, Y Richard Yang, Bryan Ford, and Paul Hudak. 2013. Maple: Simplifying SDN programming using algorithmic policies. CCR 43, 4 (2013), 87–98. Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. Daniel Winograd-Cort. 2015. Effects, Asynchrony, and Choice in Arrowized Functional Reactive Programming. Ph.D. Dissertation. Yale University.Google ScholarGoogle Scholar
  49. Daniel Winograd-Cort and Paul Hudak. 2014. Settable and Non-interfering Signal Functions for FRP: How a First-order Switch is More Than Enough. In Proceedings of the 19th ACM SIGPLAN International Conference on Functional Programming (ICFP ’14). ACM, New York, NY, USA, 213–225. Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. Jeremy Yallop and Hai Liu. 2016. Causal commutative arrows revisited. In Proceedings of the 9th International Symposium on Haskell. ACM, 21–32. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Synthesizing functional reactive programs

    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
      Haskell 2019: Proceedings of the 12th ACM SIGPLAN International Symposium on Haskell
      August 2019
      175 pages
      ISBN:9781450368131
      DOI:10.1145/3331545

      Copyright © 2019 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: 8 August 2019

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      Overall Acceptance Rate57of143submissions,40%

      Upcoming Conference

      ICFP '24

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader