Draft:Coalton (programming language)
Statically typed dialect of Lisp
From Wikipedia, the free encyclopedia
Coalton is a functional, statically typed, general-purpose programming language embedded in Common Lisp. Its type system is similar to Haskell's, but evaluation is strict like Standard ML or OCaml. Metaprogramming is supported through traditional Lisp macros. Coalton focuses on performance through efficient data representation and compiler optimization.[1]
Submission declined on 10 August 2025 by Caleb Stanford (talk).
Where to get help
How to improve a draft
You can also browse Wikipedia:Featured articles and Wikipedia:Good articles to find examples of Wikipedia's best writing on topics similar to your proposed article. Improving your odds of a speedy review To improve your odds of a faster review, tag your draft with relevant WikiProject tags using the button below. This will let reviewers know a new draft has been submitted in their area of interest. For instance, if you wrote about a female astronomer, you would want to add the Biography, Astronomy, and Women scientists tags. Editor resources
|
Comment: Looks like a cool project, but I'm not seeing independent evidence of notability. Please ping me if you disagree. Caleb Stanford (talk) 19:25, 10 August 2025 (UTC)
Comment: In accordance with Wikipedia's Conflict of interest policy, I disclose that I have a conflict of interest regarding the subject of this article. Stylewiki (talk) 22:29, 16 July 2025 (UTC)
| Coalton | |
|---|---|
| Paradigms | multi-paradigm: functional, imperative |
| Family | ML, Lisp |
| Designed by | Robert Smith |
| Developer | Robert Smith, Coalton community |
| First appeared | 2018 |
| Typing discipline | inferred, static, strong |
| Platform | Common Lisp |
| OS | Cross-platform |
| License | MIT |
| Filename extensions | .lisp, .coal |
| Website | coalton-lang |
| Influenced by | |
| Common Lisp, Scheme, Haskell, OCaml, Standard ML, Clojure, Rust | |
Coalton refers to both the language and its implementation, and remains under active, open-source development as of July 2025.[2]
History
Robert Smith started designing Coalton in 2018[3] to import the benefits of ML-like static typing into the interactive, incremental programming environment of Common Lisp. Coalton was further developed by a team led by Smith and was officially announced in 2021.[4] Coalton has since been used for quantum computing research, the implementation of the Quil compiler,[5] and defense applications.
Coalton is used at HRL Laboratories to build software for qubits based on exchange-only silicon quantum dots.[6]
Features
- Static typing with global type inference and optional type declarations.
- Parametric algebraic data types, pattern matching, and compile-time exhaustiveness checking.
- Multi-parameter type classes with functional dependencies.
- Strictly evaluated with lazy iterators.
- Advanced immutable data structures including hash array mapped tries and relaxed radix balanced trees.
- Machine code compilation (on Lisp hosts that support it).
- Compiler optimizations including heuristic inlining and user-controllable inlining with the
inlinedirective. - User-controllable function monomorphization with the
monomorphizedirective. - User-controllable data type representation control with the
reprdirective. - Separate development and release modes. Release mode enables greater compiler optimization opportunities at the expense of development interactivity.
- Non-allocating
Optionaldata type (cf. Haskell'sMaybeor OCaml'sOption). - Exception handling with resumptions.
- Inline Common Lisp code with the
lispoperator. - Metaprogramming via ordinary
defmacro. - Advanced numerical data types including dual numbers, hyper-dual numbers, computable real numbers, and arbitrary-precision floating-point numbers.
Examples
When Coalton is written in a Lisp file, Coalton code is wrapped in coalton-toplevel:
(coalton-toplevel
;; ...definition forms...
)
In the following examples, we elide the coalton-toplevel form.
Expressions are written in Lisp's prefix style:
(define pi-approx (/ 355.0 113.0))
(define earth-diameter-km 12756.0)
(define earth-circumference-km (* pi-approx earth-diameter-km))
Functions are defined with define:
(define (square-area width height)
(* width height))
Algebraic data types are defined with define-type and can be pattern matched:
(define-type (Shape :t)
(Rect :t :t) ; width x height
(Circle :t)) ; radius
(define (area s)
(match s
((Rect width height) (* width height))
((Circle radius) (* coalton-library/math:pi (^ radius 2)))))
The type of area is automatically inferred as (Num :t) (Trigonometric :t) ⇒ (Shape :t → :t), which means that areas can be computed on shapes whose dimensions are specified to be numerical and trigonometric.
Type classes can be defined with define-type. A mathematical Group type class may be written like:
(define-class (Group :t)
(identity-element (:t))
(invert-element (:t -> :t))
(group-operation (:t -> :t -> :t)))
We may then define the additive group of integers by defining an instance of the type class on Integer:
(define-instance (Group Integer)
(define identity-element 0)
(define (invert-element x)
(negate x))
(define (group-operation x y)
(+ x y)))
Saving an executable is done via the host Lisp compiler. A "Hello World" executable can be made by creating a file hello.lisp:
(coalton-toplevel
(define (main)
(trace "Hello, world!")))
With a Common Lisp compiler like SBCL, an executable called hello can be produced with:
sbcl --eval '(asdf:load-system "coalton")' \
--load hello.lisp \
--eval '(sb-ext:save-lisp-and-die "hello"
:executable t
:toplevel (lambda () (coalton:coalton (coalton-user::main))))' \
--quit
Running the executable produces the expected output:
% ./hello
Hello, world!
Criticisms
When Coalton is written as a part of .lisp files, it requires wrapping the Coalton code in coalton or coalton-toplevel macros. This detracts from the incremental development style of Common Lisp.[7]
A more serious criticism is that Hindley-Milner type systems are unsound when mutation is allowed,[8] and Coalton allows mutation. Several fixes to the type inference algorithm have been proposed.[9]

- provide significant coverage: discuss the subject in detail, not just brief mentions or routine announcements;
- are reliable: from reputable outlets with editorial oversight;
- are independent: not connected to the subject, such as interviews, press releases, the subject's own website, or sponsored content.
Please add references that meet all three of these criteria. If none exist, the subject is not yet suitable for Wikipedia.