Skip to content

Instantly share code, notes, and snippets.

View 4ad's full-sized avatar

Aram Hăvărneanu 4ad

View GitHub Profile
@AndrasKovacs
AndrasKovacs / HOASOnly.hs
Last active April 11, 2025 20:56
HOAS-only lambda calculus
{-# language BlockArguments, LambdaCase, Strict, UnicodeSyntax #-}
{-|
Minimal dependent lambda caluclus with:
- HOAS-only representation
- Lossless printing
- Bidirectional checking
- Efficient evaluation & conversion checking
Inspired by https://gist.github.com/Hirrolot/27e6b02a051df333811a23b97c375196
@hirrolot
hirrolot / CoC.ml
Last active August 15, 2025 14:40
How to implement dependent types in 80 lines of code
type term =
| Lam of (term -> term)
| Pi of term * (term -> term)
| Appl of term * term
| Ann of term * term
| FreeVar of int
| Star
| Box
let unfurl lvl f = f (FreeVar lvl)