skip to main content
10.1145/3414080.3414092acmotherconferencesArticle/Chapter ViewAbstractPublication PagesppdpConference Proceedingsconference-collections
research-article

Hailstorm: A Statically-Typed, Purely Functional Language for IoT Applications

Published: 21 September 2020 Publication History

Abstract

With the growing ubiquity of Internet of Things (IoT), more complex logic is being programmed on resource-constrained IoT devices, almost exclusively using the C programming language. While C provides low-level control over memory, it lacks a number of high-level programming abstractions such as higher-order functions, polymorphism, strong static typing, memory safety, and automatic memory management.
We present Hailstorm, a statically-typed, purely functional programming language that attempts to address the above problem. It is a high-level programming language with a strict typing discipline. It supports features like higher-order functions, tail-recursion, and automatic memory management, to program IoT devices in a declarative manner. Applications running on these devices tend to be heavily dominated by I/O. Hailstorm tracks side effects like I/O in its type system using resource types. This choice allowed us to explore the design of a purely functional standalone language, in an area where it is more common to embed a functional core in an imperative shell. The language borrows the combinators of arrowized FRP, but has discrete-time semantics. The design of the full set of combinators is work in progress, driven by examples. So far, we have evaluated Hailstorm by writing standard examples from the literature (earthquake detection, a railway crossing system and various other clocked systems), and also running examples on the GRiSP embedded systems board, through generation of Erlang.

References

[1]
Peter Achten and Rinus Plasmeijer. 1995. The ins and outs of Clean I/O. Journal of Functional Programming 5, 1 (1995), 81–110.
[2]
Moussa Amrani, Fabian Gilson, Abdelmounaim Debieche, and Vincent Englebert. 2017. Towards User-centric DSLs to Manage IoT Systems. In MODELSWARD. 569–576.
[3]
Edward Amsden. 2011. A survey of functional reactive programming. Rochester Institute of Technology(2011).
[4]
Joe Armstrong. 1997. The development of Erlang. In Proceedings of the second ACM SIGPLAN international conference on Functional programming. 196–203.
[5]
Hendrik Pieter Barendregt. 1985. The lambda calculus - its syntax and semantics. Studies in logic and the foundations of mathematics, Vol. 103. North-Holland.
[6]
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. https://doi.org/10.1145/3242744.3242757
[7]
Iulia Bastys, Musard Balliu, and Andrei Sabelfeld. 2018. If this then what? Controlling flows in IoT apps. In Proceedings of the 2018 ACM SIGSAC Conference on Computer and Communications Security. 1102–1119.
[8]
Albert Benveniste, Paul Le Guernic, and Christian Jacquemot. 1991. Synchronous programming with events and relations: the SIGNAL language and its semantics. Science of computer programming 16, 2 (1991), 103–149.
[9]
Imad Berrouyne, Mehdi Adda, Jean-Marie Mottu, Jean-Claude Royer, and Massimo Tisi. 2019. CyprIoT: framework for modelling and controlling network-based IoT applications. In Proceedings of the 34th ACM/SIGAPP Symposium on Applied Computing. 832–841.
[10]
Gérard Berry and Georges Gonthier. 1992. The Esterel synchronous programming language: Design, semantics, implementation. Science of computer programming 19, 2 (1992), 87–152.
[11]
Ben Calus, Bob Reynders, Dominique Devriese, Job Noorman, and Frank Piessens. 2017. FRP IoT modules as a Scala DSL. In Proceedings of the 4th ACM SIGPLAN International Workshop on Reactive and Event-Based Languages and Systems. 15–20.
[12]
Paul Caspi, Grégoire Hamon, and Marc Pouzet. 2008. Synchronous Functional Programming: The Lucid Synchrone Experiment. Real-Time Systems: Description and Verification Techniques: Theory and Tools. Hermes (2008).
[13]
Gregory H Cooper and Shriram Krishnamurthi. 2006. Embedding dynamic dataflow in a call-by-value language. In European Symposium on Programming. Springer, 294–308.
[14]
Antony Courtney, Henrik Nilsson, and John Peterson. 2003. The yampa arcade. In Proceedings of the 2003 ACM SIGPLAN workshop on Haskell. 7–18.
[15]
Evan Czaplicki. 2012. Elm: Concurrent Frp for Functional GUIs. Senior thesis, Harvard University(2012).
[16]
Evan Czaplicki and Stephen Chong. 2013. Asynchronous functional reactive programming for GUIs. ACM SIGPLAN Notices 48, 6 (2013), 411–422.
[17]
Zakir Durumeric, Frank Li, James Kasten, Johanna Amann, Jethro Beekman, Mathias Payer, Nicolas Weaver, David Adrian, Vern Paxson, Michael Bailey, 2014. The matter of heartbleed. In Proceedings of the 2014 conference on internet measurement conference. 475–488.
[18]
Conal Elliott and Paul Hudak. 1997. Functional reactive animation. In Proceedings of the second ACM SIGPLAN international conference on Functional programming. 263–273.
[19]
Conal M Elliott. 2009. Push-pull functional reactive programming. In Proceedings of the 2nd ACM SIGPLAN symposium on Haskell. 25–36.
[20]
Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, and Shriram Krishnamurthi. 2009. A functional I/O system or, fun for freshman kids. In Proceeding of the 14th ACM SIGPLAN international conference on Functional programming, ICFP 2009, Edinburgh, Scotland, UK, August 31 - September 2, 2009, Graham Hutton and Andrew P. Tolmach (Eds.). ACM, 47–58. https://doi.org/10.1145/1596550.1596561
[21]
Bernd Finkbeiner, Felix Klein, Ruzica Piskac, and Mark Santolucito. 2017. Vehicle Platooning Simulations with Functional Reactive Programming. In Proceedings of the 1st International Workshop on Safe Control of Connected and Autonomous Vehicles. 43–47.
[22]
Andrew Donald Gordon. 1992. Functional programming and input/output. Ph.D. Dissertation. University of Cambridge, UK. http://ethos.bl.uk/OrderDetails.do?uin=uk.bl.ethos.259479
[23]
Andrew D Gordon and Kevin Hammond. 1995. Monadic I/O in Haskell 1.3. In Proceedings of the haskell Workshop. 50–69.
[24]
Ramakrishna Gummadi, Omprakash Gnawali, and Ramesh Govindan. 2005. Macro-programming wireless sensor networks using Kairos. In International Conference on Distributed Computing in Sensor Systems. Springer, 126–140.
[25]
Heine Halberstam and Hans Egon Richert. 2013. Sieve methods. Courier Corporation.
[26]
Nicholas Halbwachs, Paul Caspi, Pascal Raymond, and Daniel Pilaud. 1991. The synchronous data flow programming language LUSTRE. Proc. IEEE 79, 9 (1991), 1305–1320.
[27]
Eric Haugh and Matt Bishop. 2003. Testing C Programs for Buffer Overflow Vulnerabilities. In Proceedings of the Network and Distributed System Security Symposium, NDSS 2003, San Diego, California, USA. The Internet Society. https://www.ndss-symposium.org/ndss2003/testing-c-programs-buffer-overflow-vulnerabilities/
[28]
Daniel Hedin and Andrei Sabelfeld. 2012. A Perspective on Information-Flow Control.Software safety and security 33 (2012), 319–347.
[29]
Caleb Helbling and Samuel Z Guyer. 2016. Juniper: a functional reactive programming language for the Arduino. In Proceedings of the 4th International Workshop on Functional Art, Music, Modelling, and Design. 8–16.
[30]
Bernard Houssais. 2002. The synchronous programming language SIGNAL: A tutorial. IRISA, April (2002).
[31]
John Hughes. 2000. Generalising monads to arrows. Science of computer programming 37, 1-3 (2000), 67–111.
[32]
Thomas Johnsson. 1985. Lambda lifting: Transforming programs to recursive equations. In Conference on Functional programming languages and computer architecture. Springer, 190–203.
[33]
Neil D. Jones, Carsten K. Gomard, and Peter Sestoft. 1993. Partial evaluation and automatic program generation. Prentice Hall.
[34]
Simon Peyton Jones and Simon Marlow. 2002. Secrets of the glasgow haskell compiler inliner. Journal of Functional Programming 12, 4-5 (2002), 393–434.
[35]
Neelakantan R Krishnaswami. 2013. Higher-order functional reactive programming without spacetime leaks. ACM SIGPLAN Notices 48, 9 (2013), 221–232.
[36]
Chris Lattner and Vikram Adve. 2004. LLVM: A compilation framework for lifelong program analysis & transformation. In International Symposium on Code Generation and Optimization, 2004. CGO 2004. IEEE, 75–86.
[37]
Peng Li and Steve Zdancewic. 2010. Arrows for secure information flow. Theoretical computer science 411, 19 (2010), 1974–1994.
[38]
Jie Lin, Wei Yu, Nan Zhang, Xinyu Yang, Hanlin Zhang, and Wei Zhao. 2017. A survey on internet of things: Architecture, enabling technologies, security and privacy, and applications. IEEE Internet of Things Journal 4, 5 (2017), 1125–1142.
[39]
Sam Lindley, Philip Wadler, and Jeremy Yallop. 2010. The arrow calculus. Journal of Functional Programming 20, 1 (2010), 51–69.
[40]
Hai Liu, Eric Cheng, and Paul Hudak. 2009. Causal commutative arrows and their optimization. ACM Sigplan Notices 44, 9 (2009), 35–46.
[41]
Hai Liu and Paul Hudak. 2007. Plugging a space leak with an arrow. Electronic Notes in Theoretical Computer Science 193 (2007), 29–45.
[42]
Geoffrey Mainland, Greg Morrisett, and Matt Welsh. 2008. Flask: Staged functional programming for sensor networks. In Proceedings of the 13th ACM SIGPLAN international conference on Functional programming. 335–346.
[43]
Louis Mandel, Florence Plateau, and Marc Pouzet. 2010. Lucy-n: a n-synchronous extension of Lustre. In International Conference on Mathematics of Program Construction. Springer, 288–309.
[44]
Louis Mandel and Marc Pouzet. 2005. ReactiveML: a reactive extension to ML. In Proceedings of the 7th ACM SIGPLAN international conference on Principles and practice of declarative programming. 82–93.
[45]
Ryan Newton, Greg Morrisett, and Matt Welsh. 2007. The regiment macroprogramming system. In 2007 6th International Symposium on Information Processing in Sensor Networks. IEEE, 489–498.
[46]
Henrik Nilsson, Antony Courtney, and John Peterson. 2002. Functional reactive programming, continued. In Proceedings of the 2002 ACM SIGPLAN workshop on Haskell. 51–64.
[47]
Ivan Perez, Manuel Bärenz, and Henrik Nilsson. 2016. Functional reactive programming, refactored. ACM SIGPLAN Notices 51, 12 (2016), 33–44.
[48]
Simon Peyton Jones. 2001. Tackling the awkward squad: monadic input/output, concurrency, exceptions, and foreign-language calls in Haskell. Engineering theories of software construction 180 (2001), 47.
[49]
Atze van der Ploeg and Koen Claessen. 2015. Practical principled FRP: forget the past, change the future, FRPNow!. In Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming. 302–314.
[50]
Qifan Pu, Ganesh Ananthanarayanan, Peter Bodik, Srikanth Kandula, Aditya Akella, Paramvir Bahl, and Ion Stoica. 2015. Low latency geo-distributed data analytics. ACM SIGCOMM Computer Communication Review 45, 4 (2015), 421–434.
[51]
John C Reynolds. 1972. Definitional interpreters for higher-order programming languages. In Proceedings of the ACM annual conference-Volume 2. 717–740.
[52]
Alejandro Russo. 2015. Functional pearl: two can keep a secret, if one of them uses Haskell. ACM SIGPLAN Notices 50, 9 (2015), 280–288.
[53]
Philipp Rümmer. 2014 (accessed May 13, 2020). An Introduction to Lustre. http://www.it.uu.se/edu/course/homepage/modbasutv/ht14/Lectures/lustre_slides_141006.pdf
[54]
Andrei Sabelfeld and Andrew C Myers. 2003. Language-based information-flow security. IEEE Journal on selected areas in communications 21, 1(2003), 5–19.
[55]
Abhiroop Sarkar. 2020. Hailstorm - A Statically-Typed, Purely Functional Language for IoT Applications. http://abhiroop.github.io/pubs/hailstorm.pdf. [Online; accessed 19-July-2020].
[56]
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. 36–44.
[57]
Mary Sheeran. 1984. muFP, A Language for VLSI design. In Proceedings of the 1984 ACM Symposium on LISP and functional programming. 104–112.
[58]
Weisong Shi, Jie Cao, Quan Zhang, Youhuizi Li, and Lanyu Xu. 2016. Edge computing: Vision and challenges. IEEE internet of things journal 3, 5 (2016), 637–646.
[59]
Kazuhiro Shibanai and Takuo Watanabe. 2018. Distributed functional reactive programming on actor-based runtime. In Proceedings of the 8th ACM SIGPLAN International Workshop on Programming Based on Actors, Agents, and Decentralized Control. 13–22.
[60]
Peer Stritzinger. (accessed May 13, 2020). GRiSP embedded system boards. https://www.grisp.org/
[61]
Mads Tofte and Jean-Pierre Talpin. 1997. Region-based memory management. Information and computation 132, 2 (1997), 109–176.
[62]
Nicolas Tsiftes and Thiemo Voigt. 2018. Velox VM: A safe execution environment for resource-constrained IoT applications. Journal of Network and Computer Applications 118 (2018), 61–73.
[63]
Zhanyong Wan, Walid Taha, and Paul Hudak. 2001. Real-time FRP. In Proceedings of the sixth ACM SIGPLAN international conference on Functional programming. 146–156.
[64]
Zhanyong Wan, Walid Taha, and Paul Hudak. 2002. Event-driven FRP. In International Symposium on Practical Aspects of Declarative Languages. Springer, 155–172.
[65]
Geoffrey Werner-Allen, Jeff Johnson, Mario Ruiz, Jonathan Lees, and Matt Welsh. 2005. Monitoring volcanic eruptions with a wireless sensor network. In Proceeedings of the Second European Workshop on Wireless Sensor Networks, 2005. IEEE, 108–120.
[66]
Daniel Winograd-Cort, Hai Liu, and Paul Hudak. 2012. Virtualizing real-world objects in FRP. In International Symposium on Practical Aspects of Declarative Languages. Springer, 227–241.

Cited By

View all
  1. Hailstorm: A Statically-Typed, Purely Functional Language for IoT Applications

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Other conferences
    PPDP '20: Proceedings of the 22nd International Symposium on Principles and Practice of Declarative Programming
    September 2020
    179 pages
    ISBN:9781450388214
    DOI:10.1145/3414080
    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].

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 21 September 2020

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. IoT
    2. compilers
    3. embedded systems
    4. functional programming

    Qualifiers

    • Research-article
    • Research
    • Refereed limited

    Conference

    PPDP '20

    Acceptance Rates

    Overall Acceptance Rate 230 of 486 submissions, 47%

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)18
    • Downloads (Last 6 weeks)1
    Reflects downloads up to 27 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

    HTML Format

    View this article in HTML Format.

    HTML Format

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media