Lamdu
Reviewed July 18, 2019Lamdu 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.
Product Feel
- π Shows all live intermediate values
- π Fine-granularity ctrl-z is key
- π One of the most usable structural editors
- π Often getting into strange editing modes
Basic Usage
The following video creates a series of simple mathematical expressions in Lamdu.
It demonstrates:
- 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
*2
to 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.
It demonstrates:
- creating string values and their concatenation
- my struggle getting the correct return type
- exploring the definition of
httpOk200
- 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.
It demonstrates:
- exploring from the top-level expression down many different definitions and sub-definitions
- renaming an untitled
(empty)
expression - renaming a shadowed name (identified with numbered subscripts)
Live data
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.
100% Keyboard
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.
Refactoring
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.
Named Parameters
Lamdu's function features named parameters, like keyword arguments in Python. They add clarity compared to their equivalents in Haskell, but also add clutter.
Type suggestions
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 5
:
But if you added the 5
first, it would now see an error with your "Hello"
Wishes
- 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)