Pieter Koopman

Types make your life safer and easier

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.

AUTHORS: Pieter Koopman, Steffen Michels and Rinus Plasmeijer  

Interactive systems can require complex input from their users. A grammar specifies the allowed expressions in such a Domain Specific Language, DSL. An algebraic DataType, ADT, is a direct representation of such a grammar. For most end-users a structured editor with pull-down menus is much easier to use than a free text editor. The iTask system can derive such structured editors based on an ADT using datatype generic programming. However, the input DSL has often also semantic constraints, like proper use of types and variables. A solution is to use a shallow embedded DSL or a DSL based on a Generalized ADT to specify the input. However, such a specification cannot be handled by datatype generic programming. Hence, one cannot derive structured editors for such a DSL.  

As a solution, we introduce structured web-editors that are based on dynamic types. These dynamic types are more expressive; they can express the required DSL constraints. In the new dynamic editor library we need to specify just the dynamic relevant for the DSL. The library takes care of displaying the applicable instances to the user and calls itself recursively to create the arguments of the dynamic functions. In this paper we show how this can be used to enforce the requires constraints on ADTs, to create structured web-editors for shallow embedded DSLS, and to create those editors for GADT based DSLs.  

OBJECTIVES: Better prevent type errors than having to handle them  

AUDIENCE: Programmers handling complex user input via a webpage