u/tompas7989

I made a typed authoring layer that emits plain Clojure
▲ 16 r/Clojure

I made a typed authoring layer that emits plain Clojure

I’ve been working on Beagle:

https://github.com/tompassarelli/beagle

It’s an experimental typed authoring layer for Clojure. You write Beagle source, it gets parsed and checked by Racket, and then it emits plain .clj files that run on the normal Clojure runtime.

Roughly:

Beagle source
  -> parser
  -> custom type checker
  -> emitted .clj
  -> normal Clojure runtime

It is not Typed Clojure, and it does not change the Clojure runtime. The type checker is custom and lives on the authoring side.

Some pieces that may be interesting:

  • preserves Clojure [] vs () syntax
  • emits ordinary Clojure
  • has about 666 pre-typed Clojure stdlib functions
  • includes an LSP server, typed REPL, and reactive checker daemon
  • has repair tooling that can turn some failures into ranked patch suggestions

The main thing I’m testing is whether this kind of typed layer helps coding agents repair Clojure programs.

Early result: on an ~8,500 LOC test with 35 injected bugs, Beagle got 3/3 full repair correctness. Raw Clojure got 0/3 in the same setup.

I’m not claiming that proves the whole idea yet. The tests need to get larger, cleaner, and harder. But the early result was interesting enough that I figured it was worth sharing.

github.com
u/tompas7989 — 4 days ago