Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type annotation syntax for lambdas #67

Open
j-hui opened this issue Dec 29, 2021 · 2 comments
Open

Add type annotation syntax for lambdas #67

j-hui opened this issue Dec 29, 2021 · 2 comments
Labels
enhancement New feature or request frontend Engineering issues related to the frontend subsystem good first issue Good for newcomers

Comments

@j-hui
Copy link
Contributor

j-hui commented Dec 29, 2021

Right now, if we want to type-annotate a lambda, e.g., fun x { x }, we need to write it postfix, i.e.,

(fun x
  x): a -> a

However, this can get kind of cumbersome. @sedwards-lab suggested that to keep the syntax uniform, we should also support the following:

fun (x: a) -> a
  x
fun x : a -> a
  x

This should of course generalize to lambdas with multiple arguments.

@j-hui j-hui added enhancement New feature or request good first issue Good for newcomers frontend Engineering issues related to the frontend subsystem labels Dec 29, 2021
@sedwards-lab
Copy link
Contributor

Yes. And it should be done using the same machinery somehow. let f x y z = ... and let f = fun x y z -> ... should be treated identically. Should we do the desugaring before understanding the type annotations?

@j-hui
Copy link
Contributor Author

j-hui commented Dec 29, 2021

They are separate in the AST, but are desugared while lowering to IR.

What do you mean by "understanding" the type annotations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request frontend Engineering issues related to the frontend subsystem good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants