Replies: 1 comment 4 replies
|
I think it's best to forget about the type definition at first and focus on how the lambdas look. There are two ways to define a a lambda that takes three arguments and returns the second. The other option is which is a lambda that takes three arguments and returns the third one applied to we would have would make since we're returning a That's right! A case is just syntax sugar for those function applications. Let's go back to the previous example and add a little twist to it. Now we're using the motive say we'll return a Now we can relate each part of |
Uh oh!
There was an error while loading. Please reload this page.
I glossed over it at first, but I've realized that I don't understand the core syntax, and in particular how self-dependent function calls work. In A quick recap of self types in kind, I don't understand the desugared example:
It seems like here we are defining a new symbol, Nat. Its type is "Type". Is that a reference to something or is it just an unevaluated symbol?
There is a syntax note:
"self(x: A) -> B" is a self-forall (self-dependent function type)But I still don't know how to interpret the code. Is
selfa keyword, a parameter name, or something else? Is the part in parentheses a lambda parameter? If so, what does P represent and what is the body?Does a function type have a body and what does it mean? I don't know how to interpret the following two lines, other than they must somehow correspond to two constructors in the base syntax.
What does
P(self)do here? It looks like a function application, but I don't know why it's there.This is supposed to be compiled to "raw lambdas" but I don't think I can parse it well enough even to be certain where the lambdas are. I'm not sure if the definition of 'Nat' is made of lambdas or not.
All reactions