Pieter Koopman

Creating a DSL for Task Oriented Programming of the IoT

Pieter Koopman is functional programming for more than thirty years. Recently he is involved in Task Oriented Programing, TOP. Tasks are pieces of work that handle input events, like user input or sensor data. The state of a task can be observed by other tasks after handling each event. Task combinators are used to compose more powerful tasks form smaller tasks. TOP enables flexible IO in a pure functional programming language. The main TOP implementation is a Domain Specific Language, DSL, called iTask embedded in the pure functional programming language Clean. To port TOP to the tiny device driving the Internet of Things, IoT, a separate DSL is needed that can be compiled to programs with a very small footprint. This DSL is called mTask and also embedded in Clean. It smoothly co-operates with the iTask system.

For interactive systems it is often desirable that users can create tasks for the system dynamically. Often these tasks are internally specified by constrained types like Generalized DataTypes, GADTs, or function applications using typeclasses. For plain datatypes, or the corresponding functions, this is relative easy: the input can be captured by a structured editor or a simple parser from a textual input. However, in many situations such simple types are not enough. We either need GADTs or more constraints than can be checked by a parser.
To guarantee correct inputs we either need the invoke the compiler of the host language and add the compiled input dynamically to the program, or we need implement a rather complicated type-checker for the input. Both solutions are complicated and require a significant of work. Fortunately, Clean provides an advanced type-system for its dynamics. The existing type-system for these dynamic values can check all required type constraints. In this paper we show how we can make dynamic editors for complex user inputs in iTask programs using these dynamic types.


←Back