Skip to content

Instantly share code, notes, and snippets.

View jumbojets's full-sized avatar

James jumbojets

View GitHub Profile
@hirrolot
hirrolot / tagless-final.rs
Last active December 2, 2024 20:28
Tagless-final encoding of a simple arithmetic language in Rust
trait Interp {
type Repr<T>;
fn lit(i: i32) -> Self::Repr<i32>;
fn add(a: Self::Repr<i32>, b: Self::Repr<i32>) -> Self::Repr<i32>;
}
struct Eval;
impl Interp for Eval {
@hirrolot
hirrolot / CoC.ml
Last active March 27, 2025 12:53
Barebones lambda cube in OCaml
(* The syntax of our calculus. Notice that types are represented in the same way
as terms, which is the essence of CoC. *)
type term =
| Var of string
| Appl of term * term
| Binder of binder * string * term * term
| Star
| Box
and binder = Lam | Pi