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 optional layout syntax for match expression #156

Open
momohatt opened this issue Feb 28, 2020 · 2 comments
Open

Add optional layout syntax for match expression #156

momohatt opened this issue Feb 28, 2020 · 2 comments
Labels
feature Feature ideas syntax

Comments

@momohatt
Copy link
Member

match [1, 2, 3] as list integer with { #1 :: _ -> True; #2 :: _ -> False }

This can be a little tricky as the starting symbol collides with the sequential pattern.

@egisatoshi
Copy link
Member

egisatoshi commented Feb 28, 2020

If we support this optional layout syntax, I think we can remove the option to omit | when a pattern-match expression has only one match clause.
It will make the implementation of the parser simple.

@momohatt
Copy link
Member Author

momohatt commented Feb 29, 2020

I agree that it'll make the parser simpler, but I'm not sure if it's worthwhile to add this optional layout syntax while sacrificing that feature... Maybe we need to reconsider adding this syntax, and it depends on how often we need to write multiple match clauses in single line.

@momohatt momohatt added feature Feature ideas and removed improvement labels Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature ideas syntax
Projects
None yet
Development

No branches or pull requests

2 participants