Simple Haskell playground

Bret Victor pointed out that programming becomes more approachable if the inner workings of a program are exposed to the programmer. On the one hand, this is not surprising — after all, the entire purpose of source-level debuggers is to expose the innards of program execution. On the other hand, we typically don't take this to heart when teaching programming. Programs are opaque boxes whose internal behaviour has to be inferred by the learner through repeatedly feeding those programs with inputs and observing the outputs, until they can replicate the program's behaviour in their heads.

In an attempt to make program behaviour more transparent, functional programming languages have always featured read-eval-print loops (REPLs) to get immediate feedback on the behaviour of small snippets of code. However, it seems as if we largely got stuck at this point. Neither REPLs nor modern IDEs with integrated source-code debuggers are exposing the insides of programs in a manner that is easy to comprehend by the standards set in Bret Victor's essay and his talk “Inventing on Principle”.

Two notable exceptions, inspired by that same work, are Light Table and Swift playgrounds. It seems as if playgrounds are effective at simplifying the transition from Objective-C to Swift by making Swift more accessible to existing Objective-C developers, who use playgrounds to experiment with the new language and exchange learning materials.

Playgrounds might be regarded as an evolution of REPLs, and it is a shame that the functional programming community ceased to push the envelope of programming environments after Lisp clearly had a head start. This is especially sad as some of Bret Victor's goals appear easier to reach in functional programming, where state is already highly contained and program dependencies are explicit. Haskell for Mac aims to do better.

Haskell playgrounds constantly provide up-to-date types and evaluation results. This includes diagrams and charts as well as interactive animations. Nevertheless, this is only the start of an exciting adventure.

Haskell playground with graphics