Tangible Functional Programming: a modern marriage of usability and composability

Earlier this month I gave a tech talk at Google, entitled “Tangible Functional Programming: a modern marriage of usability and composability”. Thanks to Google folks, the talk is now up on YouTube. I showed a way make functional programming “tangible” and visual, rather than abstract and syntactic and, in doing so, to fulfill the original Unix vision of simple, composable apps.

The key is to keep an app’s interface and functionality combined and separable. Combined yields usability, and separable yields composability. This principle applies not only to GUI-style interfaces, but to textual IO as well, and it applies to both direct composition and syntactic composition. See the TV page for examples of the latter. The common practice of mixing IO with functionality inhibits composability whether in C or in Haskell.

Edits:

“Tangible Functional Programming” — icfp version

I just submitted the camera-ready version of “Tangible Functional Programming”, for ICFP ’07. I’m happy with this version. It’s improved drastically since my first submission to ICFP ’06, thanks to many helpful comments. I’ve also been recreating the implementation on top of DeepArrow, Phooey, and TV, in preparation for a software release. It’s getting simpler, but it’s not as simple as I want.

ICFP ’07 paper draft — comments please

Warning: if you’re on the ICFP program committee and want to preserve double-blind reviewing, please ignore this post.

I’ve been working on an ICFP paper called “Tangible Functional Programming”, revising my last year’s submission on Eros. If you’re interested in taking a look, I’d greatly appreciate any comments, especially before the April 6 submission deadline.

Abstract

We present a user-friendly approach to unifying program creation and execution, based on a notion of “tangible values” (TVs), which are visible and interactive GUI manifestations of pure values. Programming happens by gestural composition of TVs. Our goal is to give end-users the ability to create parameterized, composable content without imposing the usual abstract and linguistic working style of programmers. We hope that such a system will put the essence of programming into the hands of many more people, and in particular people with artistic/visual creative style.

In realizing this vision, we develop algebras for visual presentation and for “deep” function application, where function and argument may both be nested within a structure of tuples, functions, etc. Composition gestures are translated into chains of combinators that act simultaneously on statically typed values and their visualizations.

Here is a figure from the paper, showing one stage of an interactively composed interactive 2D region. The user selects compatibly-typed input and output widgets, typically in different TVs. The result is a new TV that merges the source TVs, except for the connected input and output, which vanish. The sliders control the disk and checker sizes and the checker’s rotation angle.

Edit on March 28:I just added two relevant pointers to the paper’s web page:

Software releases

Last week I released three Haskell libraries: DeepArrow 0.0, Phooey 0.1, and TV 0.0.

These libraries came from Eros, which aims at creating a right-brain-friendly (concrete, non-linguistic) “programming” process. I’ve had a growing intuition over the last fifteen years that media authoring tools can be usefully looked at as environments for functional programming. I’d been wondering how to map a user’s gestures into operations on a functional program. Lots of noodling led to ideas of composable interfaces and “tangible values” (term thanks to Sean Seefried) and gestural composition in Eros.

Eros is more complicated than I like, so I started splitting it into pieces:

  • Phooey is a functional GUI library that has much of Eros’s GUI implementation techniques, but much more carefully structured than in the Eros paper.
  • DeepArrow has the general notion of “deep application”
  • TV has the algebra of composable interfaces, or visualizations of pure values, and it has tangible values, which are separable combinations of interface and value. It uses Phooey to generate GUIs very simply from interfaces

Although these libraries came from Eros, I’d like to see other applications as well.

Where am I going with library development?

  • Figure out how to support simple GUIs and Eros’s gesturally composable GUIs, without code/library replication.
  • Re-implement Eros on top of simpler pieces.
  • Refactor Pajama into reusable libraries and release.
    • Building and optimizing “expressions”
    • Common sub-expression elimination
    • Generation of Java code
    • Perhaps other back-ends besides Java
    • Pajama, on top of these pieces

Edit of March 5, 2007: TV is now split into a core TV package, with no GUI functionality, and GuiTV, with Phooey-based GUI creation. The reason for the split is that Phooey depends on wxHaskell, which can be difficult to install.

Non-syntactic, end-user, functional programming

(This is an edited version of a post made on April 11 that somehow became inaccessible from my main blog page.)

I have a draft paper called “Functional Programming by Interacting with Concrete Values”. I’m very excited about this research direction as a way to let people program without turning them into programmers. A concrete form of this goal is enable artists to make and share their own software tools (parameterized image effects), while staying in an artistic creative mode.

An excerpt from the introduction:

Suppose users of interactive programs could also create such programs with a simple extension of their current style of interaction. First, such a development would enable many more people to create and share computational content. Second, it would allow this content to be created without imposing the abstract, linguistic mode of creativity. This freedom may give birth to new kinds of programs whose creation is nurtured by a concrete and visual environment.

Comments please (related work, ideas, typos, unclear bits, etc)!

Edit 2008-04-17: The paper didn’t get accepted in 2006. Thanks to very helpful review comments, and a lot of rewriting, the paper did get accepted in 2007, under the title “Tangible functional programming”.