4 ms·
A couple of months ago I was playing around with a similar technique, Mogensen-Scott encoding, in typescript. I was mainly interested in it as a way to express
by dunham 3y ago
A couple of months ago I was playing around with a similar technique, Mogensen-Scott encoding, in typescript. I was mainly interested in it as a way to express sum types without a bunch of if statements (instead a "value" of a type takes functions for each possible case branch and calls the appropriate one).
I ended up writing a little dependent type checker:
https://gist.github.com/dunhamsteve/1be0cbb346d75ee1be8f67d192e73234 https://gist.github.com/dunhamsteve/1be0cbb346d75ee1be8f67d1...
- lucasoshiro 3y agoWow, I didn't know about that. Nice to see more things about lambda calculus, I think it is the most beautiful thing in computer science, but I haven't studied it too deeply as I need to prioritize other things...