DEV Community

Discussion on: Meta-Programming and Macro capabilities of various languages

Collapse
 
redbar0n profile image
Magne • Edited

Hackett vs Coalton

TL;DR:

Hacket = Haskell + Racket. Sits on top of Racket.
Coalton = Haskell + Common Lisp (CL). Sits inside CL.


Coalton and Hackett are both statically typed, Haskell‑flavored functional DSLs embedded in Lisp dialects, but they target different hosts and take different paths toward “typed Lisp.” news.ycombinator

Background and host language

  • Coalton lives on top of Common Lisp and is implemented almost entirely via Lisp macros, so it integrates into a conventional Lisp environment and can use existing Lisp libraries and tooling. news.ycombinator
  • Hackett lives on top of Racket and is a full‑fledged language layer inside Racket’s ecosystem, building on Racket’s module system and language‑packaging infrastructure. news.ycombinator

Type system and style

  • Both languages aim for Haskell‑like typing (parametric polymorphism, type classes, algebraic data types), with Coalton explicitly modeled on Haskell’s style. coalton-lang.github
  • Hackett in particular pushed for true type‑aware macros, meaning macros can inspect and compute over types, whereas Coalton focuses more on delivering a well‑optimized, separate static language that inter‑operates with dynamic Lisp. news.ycombinator

Optimization and compilation

  • Coalton ships with an optimizing compiler that does inlining, representation selection, stack allocation, and code motion, explicitly targeting “release‑mode” builds where the dynamic Common Lisp constraints are relaxed. news.ycombinator
  • Hackett’s work emphasized type‑directed macrology and elaboration, but its development has largely stalled, and it never reached the same level of aggressive optimization infrastructure as Coalton. news.ycombinator

Relationship to the host

  • Coalton treats the host as a dynamic system language and keeps the static layer fenced off but interoperable; it doesn’t try to “retrofit” Common Lisp into being statically typed overall. coalton-lang.github
  • Hackett (like Typed Racket) is more of a typed sibling of Scheme/Racket, where the boundary between the typed and untyped parts is more tightly integrated into the module and macro system. news.ycombinator

Summary table

Aspect Coalton (Common Lisp) Hackett (Racket)
Host language Common Lisp Racket
Type‑style reference Haskell‑like, including type classes coalton-lang.github Haskell‑like functional DSL news.ycombinator
Primary innovation focus Optimizing static layer + Lisp interop coalton-lang.github Type‑aware / type‑directed macros news.ycombinator
Macro/type integration Standard Lisp macros, with static type layer coalton-lang.github Deeper type‑aware macro system news.ycombinator
Current status Actively maintained, with compiler work news.ycombinator Largely discontinued / inactive news.ycombinator

In short:

  • If you want Haskell‑style typing inside Common Lisp with a modern optimizing compiler and close interop with existing Lisp code, Coalton is the smoother choice. news.ycombinator
  • If you were in the Racket world and cared about type‑directed macros and language design experiments, Hackett was the more intellectually ambitious path, though it is no longer actively developed. news.ycombinator