15 karma · joined Jul 2, 2019 (7y ago) · 17 submissions
comment 4y ago · link · parent
let nil = \n c. n;
let cons = \hd tl n c. c hd tl;
let map = ...;
body
And compile it as: (\nil cons map. body) (\n c. n) (\hd tl n c. c hd tl) (...)
That we would get a more minimal form. But I cannot verify in what form the lambda expression in the PDF is. It just seems unbelievably large to me.comment 4y ago · link · parent
Totality shouldn't have any special impact on memory usage as far as I know. It just restricts the kind of recursive functions and data types you can write.
comment 4y ago · link · parent
comment 4y ago · link · parent
Note that in the calculus of constructions you can do these Church encodings of datatypes but you cannot derive an induction principle for these (only non-dependent folds). For example you cannot write a `snd` for the `Sigma` above.
As you allude to, you need a more expressive type system to derive induction principles (for example "Self types") for lambda encodings.
comment 6y ago · link · parent
[1] https://effekt-lang.org/ [2] https://koka-lang.github.io/koka/doc/kokaspec.html
comment 6y ago · link · parent
comment 6y ago · link · parent
So if you want to be type-safe but you still want to be able to erase proofs, your proofs have to be total.