Flask is a programming language for sensor networks geared towards streaming data applications. It is realized as a domain-specific language embedded in Haskell. Its design is inspired by prior work on Functional Reactive Programming (FRP), but motivated by the constraints of sensor network platforms. Flask runs on real hardware, including both MicaZ and TelosB motes.

The key observation behind Flask is that in programs written in the FRP style, it is the point-wise manipulation of values that must be executed dynamically; the data flow configuration of these programs is typically static. Flask exploits this observation by explicitly staging the static and dynamic behavior of dataflow programs. Haskell serves as Flask’s meta language, and its full power is available for expressing how data flow graphs can be constructed using FRP-style combinators. Flask also requires that point-wise manipulation of signal values is always done in a restricted object-language. Because the dynamic behavior of the program is expressed only through a restricted object language, Flask programs can run on even highly resource-constrained devices.

Flask consists of a staging mechanism that cleanly separates node-level code from the meta-language used to generate node-level code fragments; syntactic support for embedding standard sensor network code; a restricted subset of Haskell that runs on sensor networks and constrains program space and time consumption; a higher-level “data stream” combinator library for quickly constructing sensor network programs; and an extensible runtime that provides commonly-used services. The current incarnation of Flask is described in our ICFP ‘08 paper. An earlier, Caml-based implementation is described in a tech report.

Please also see Matt Welsh’s macroprogramming page for more details on the macroprogramming project at Harvard.

Flask Publications

  1. Mainland, G., Morrisett, G. and Welsh, M. 2008. Flask: Staged Functional Programming for Sensor Networks. Proceeding of the 13th ACM SIGPLAN International Conference on Functional Programming (ICFP ’08) (Victoria, BC, Canada, Sep. 2008), 335–346.
  2. Mainland, G., Morrisett, G., Welsh, M. and Newton, R. 2007. Sensor Network Programming with Flask. Proceedings of the 5th International Conference on Embedded Networked Sensor Systems (SenSys ’07) (Sydney, Australia, Nov. 2007), 385–386.
  3. Mainland, G., Welsh, M. and Morrisett, G. 2006. Flask: A Language for Data-Driven Sensor Network Programs. Technical Report #TR-13-06. Harvard University.

Flask Distribution

The Flask 0.1 release is available here.