View on GitHub


Lamdu - towards a new programming experience

Project Lamdu

This project aims to create a next-generation live programming environment that radically improves the programming experience.

"Live programming" means that the code is being executed as you type it.

The main idea behind the Lamdu project is that the canonical representation of programs should not be text, but rich data structures: Abstract syntax trees.

Our programming tools, UIs and ecosystems should take advantage and expose this structure. This has some far-reaching implications, which will be described below.

Programming Language

Lamdu's programming language is a functional programming language inspired by Haskell. Language's design decisions are affected by the different trade-offs of live programming and AST editing, and for this reason Lamdu isn't made for an existing textual language.

We believe that Haskell is a good inspiration for Lamdu's language due to 2 main traits:

How Lamdu's language differs from Haskell:

Lamdu Benefits

No Syntax Errors

Editing programs as rich structures means there are no syntax errors

Incremental Type Errors

Type errors are incremental, meaning that type information available from previous, valid states of the program is available to provide better, more localized type errors.

Incremental type checking is much cheaper than full recompilation as featured by mainstream IDEs, allowing a snappy experience.

Type error feedback is immediate, while the edit is still fresh in the programmer's mind.

Type errors are confined and localized to the sub-expression involved, made simple and comprehensible.

Type information is not lost when type errors exist, allowing the IDE to guide the programmer in resolving type errors intelligently.

Better Completions

When types are rich enough, much of the program structure can be inferred from the types.

This affords significantly more powerful and intelligent completions than found in mainstream IDEs.

Live Execution

Frees the programmer from having to trace code execution in their head.

Debugging pure code means expanding sub-expressions that have the wrong result, and following through the sub-expressions that contain the mistakes. This should be a much easier experience than stepping through code.

Safe Refactoring

The IDE has much stronger guarantees about the meaning and structure of the code. This allows refactoring to be completely safe.

Safe refactoring allows programmers to keep the code tidy, without fear of regressions.

Better Collaboration

One of the most difficult things about collaborative development is handling merge conflicts.

The vast majority of merge conflicts are results of non-functional changes: Renames, reformatting, textual movement of code lines between files, etc.

In Lamdu, "names", the "position" of the code and other non-functional aspects of code are separate from the code itself, and avoid conflicts.

Rename conflicts

To get a conflict due to "rename" operations, two developers must rename the same variable to two different names. Even then, the code is still executable, but its on-screen rendering will display a localized conflict.

Formatting conflicts

Formatting is automatic, so there is no way to generate a conflict.

Change tracking

Instead of heuristically guessing what changed in the code, as traditional version control systems do, Lamdu uses an integrated revision control system and records the changes by the programmer as revisions.

This acts as a record of the developer's intent, allowing the RCS to distinguish, for example, between function deletion and writing of a similar function, and the modification of that same function. The recording of intent helps prevent and resolve conflicts.

Regression Debugging

Integrated revision control and live test cases will allow "Regression Debugging".

When a change causes a regression, the root of the problem can be found quickly, by finding the deepest function application whose result value diverged from the correct version of the code.

Automatic Formatting and Sugaring

Lamdu attempts to take away as much inconsequential freedom from the developer, to free his mind and his key strokes to deal with the parts that matter in the code. Thus, Lamdu formats the code on its own, responsively (line breaks adapt according to the window or screen size).

Additionally, to avoid further stylistic dilemmas, Lamdu uses automatic sugaring of code, as the dual of typical "de-sugaring" done by textual languages.

The code is edited and displayed in its sugared form. The edits to this form are translated to lower-level, simpler edits of the stored language, which is de-sugared. Lamdu uses "co-macros" that capture patterns in the lower-level code and automatically sugar it to canonical form. This frees the programmer from worrying about whether to use sugar for each particular case.


Textual languages can have extensible syntax for rendering and parsing values of custom-defined data-types. A rich structural IDE can take this further, and allow defining extensible UI components to render and edit values of custom-defined data-types.

In effect, this allows for more powerful DSL extensions to the language. These DSLs are not just custom data-types and combinators, but also rich UIs with optimized key bindings to work with that DSL.

For example "do notation" can be implemented as a co-macro (see above) to capture the >>= to lambda syntactic form. Then, a customized UI that edits the "do notation" sugared form can be provided, extending the language.

Similarly, a binary tree implementation may be edited with a rich UI that visualizes the trees. The inputs, outputs and subexpressions with tree-typed values will use such rich visualizations, instead of flat textual renderings.

Transparent Build Process

Today's tools treat the compiler as an opaque, black box, which may or may not apply a set of optimizations to the source code, with great or catastrophic results. Some experts are aware of tooling options to display the intermediate steps in the compiler in an arcane, difficult-to-understand notation.

We intend to make the build process, including compilation, be an explicit pure transformation of the code into intermediate and final forms. The steps of this transformation can be visualized by the live programming environment similarly to the visualization of execution of all pure code.

This will allow far easier inspection of the optimization process, taking away much of the "magic" involved in getting optimizations to fire properly.

Similar Efforts

See the list of projects of r/nosyntax.


Subtext by Jonathan Edwards is a similar effort from 2004.

In his Subtext 1 demo and talk, Edwards presents a live programming environment of a simple dynamic language.

In his Subtext 2 demo, Edwards presents an inspiring way to edit canonical representations of conditional and type-dispatch code.

The Subtext project was the main inspiration for the Lamdu project.

Other Related Links