Nothing Special   »   [go: up one dir, main page]

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

Thoughts on function definitions #3

Open
NickSeagull opened this issue Aug 10, 2020 · 2 comments
Open

Thoughts on function definitions #3

NickSeagull opened this issue Aug 10, 2020 · 2 comments

Comments

@NickSeagull
Copy link

I was thinking that perhaps a nice syntax for function definitions would be to follow the steps of TS regarding syntax? Something where all function definitions are just lambdas? The rest of the signature stays the same.

This might look like contriving the syntax, but would actually make adoption easier for newcomers from the language

The example would look like

//    v --- This equal sign is added, and this --- v
let f = (xs: List<Int>, p: (Int) => Bool): List<a> => 
  effect {
    let x = await xs
    guard(p(x))
    x.add(1).pure
  }
@serras
Copy link
Owner
serras commented Aug 10, 2020 via email

@NickSeagull
Copy link
Author

Yep, that works without a result type.

For Java people we could implement function syntax, which would be desugared. I think that becoming something like a TS superset would benefit the project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants