Lean's unfair advantage

SF LEAN · ALOK SINGH · JULY 21, 2026

record → function → error → array → InfoView

A recent Haskell exit

7 yearsHaskell in Scarf production
it workedreliable code, useful types, good performance
new API workis now written in Python
whybuild time, libraries, and a slower development loop

The Haskell server still runs. Its share of the system is shrinking.

Avi Press, “After 7 years in production, Scarf has reluctantly moved away from Haskell,” July 10, 2026

If you start with types, go all the way

For a conventional application: use Python.

For type-driven mathematical software: dependent types, reusable proved facts, and programmable editor views.

The provocation: go farther than Haskell. Use Lean.

Types as programming tools

ROUTINE LEAN

Write and run the program

records and functions

Array, Except, loops, IO

#check, #eval, InfoView

+

DOMAIN TYPES

Let types carry the algebra

MV R3 .full

multiplication computes result parity

the renderer receives a plain projection

Loop: edit → elaborate → evaluate → inspect.
Tools: metaprograms and AI can act on the same typed program state.

Lean is officially described as both a programming language and proof assistant · lean-lang.org

Plain view data; one typed algebra

structure Vec3 where x : Float y : Float z : Float structure R3Grades where scalar : Float vector : Vec3 bivectorNormal : Vec3 pseudoscalar : Float abbrev Field3 (M : Type) := Vec3 M structure Sample3 where position : Vec3 value : R3Grades
Computed field: fieldAt : Float → Vec3 → MV R3 .full
View boundary: MV R3 p → R3Grades

Hover the ordinary view types here. In Cursor, hover fieldAt for the one dependent type used by the computation.

Start with the program

structure PlanarGrid where xCount : Nat yCount : Nat def sampleCount (grid : PlanarGrid) : Except String Nat := do if grid.xCount < 2 then throw "xCount must be at least 2" return grid.xCount * grid.yCount #eval sampleCount { xCount := 3, yCount := 3 }
Except.ok 9
#eval sampleCount { xCount := 1, yCount := 3 }
Except.error "xCount must be at least 2"

This slide is a Lean file. Verso type-checked the code while building the deck.

Live: ordinary programming

PlanarGrid → function → Except String (Array Sample)

read the result change 3 × 3 to 4 × 3 run invalid input and read the error

Switch to Cursor · OrdinaryProgrammingDemo.lean

What Lean and the view do

import
Lean computes and validates the field values.
The view draws them and handles the camera and controls.

The one dependent type in this demo

MV R3 .fullthis field has the R3 metric and may contain every grade
MV R3 .eventhe rotor can contain only even grades
.even * .full = .fullmultiplication computes the result parity
R3Grades.ofMVone explicit boundary produces plain view data

browser demo · presenter tutorial · one-screen cue card