LamduReviewed July 18, 2019
Lamdu is a Haskell-inspired projectional editor. It features live-evaluated subexpression annotations, localized type errors, and a focus on a fluid editing experience. It is an open-source project, actively developed since 2011.
- 👍 Shows all live intermediate values
- 👍 Fine-granularity ctrl-z is key
- 👍 One of the most usable structural editors
- 👎 Often getting into strange editing modes
The following video creates a series of simple mathematical expressions in Lamdu.
- creating a definition
- using the REPL
- exploring the intermediate results via the subexpression annotations
- filtering a list
- converting a lazy list to an array to preview it
- my struggle to get
*2to apply to an argument and not the result of the function
- changing the display of a function to infix and OOP-style
- filtering via a first class function
- abstracting out an expression into a global variable
The following video builds a simple HTTP server in Lamdu.
- creating string values and their concatenation
- my struggle getting the correct return type
- exploring the definition of
- browsing all the request data for past HTTP requests
- automatic type conversion of a string into Text Bytes
The following explores and modifies a large Lamdu project, a conference website server.
- exploring from the top-level expression down many different definitions and sub-definitions
- renaming an untitled
- renaming a shadowed name (identified with numbered subscripts)
It's extremely rare to see live-evaluated subexpression annotations, particularly in languages with a textual representation. Some non-visual languages put the results of whole lines off to the side, but Lamdu is one of the first to publish a working implementation of underlined evaluation of all intermediate subexpressions. This goes a long way towards making functional programming understandable for beginners.
Unlike many projectional editors, Lamdu is navigable without every touching the mouse. Everything (and I mean everything) can be done via keyboard. It features a context-aware shortcut help menu to help you learn their hotkeys. However despite their attention-to-detail, I still found it quite difficult to use as you can see me fumbling in the above videos. Crafting a fluid projectional editor is still an unsolved problem but they have made significant strides.
As demonstrated in the above videos, internally variables have ID’s, so changing their names is a superficial change. This means no merge conflicts on renaming, formatting, stylistic differences, or moving code. There are no files, folders or line numbers to worry about.
Lamdu's function features named parameters, like keyword arguments in Python. They add clarity compared to their equivalents in Haskell, but also add clutter.
Their type errors take advantage of information unavailable to traditional textual languages, such as the order in which you type an expression. This allows it to infers your intent. For example, if you type “Hello” first it guesses that the type error is with the
But if you added the
5 first, it would now see an error with your
- Caching previous HTTP request runs to show live data when editing
- Autocomplete suggestions to be WYSIWYG (instead of the star and green color to indicate where expressions and the cursor will go)