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

Top level pattern matching #6

Closed
paf31 opened this issue Oct 5, 2013 · 2 comments
Closed

Top level pattern matching #6

paf31 opened this issue Oct 5, 2013 · 2 comments

Comments

@paf31
Copy link
Contributor

paf31 commented Oct 5, 2013

E.g.

test pattern1 = y
test pattern2 = z
...

would be desugared to

test = \x -> case x of { pattern1 -> y, pattern2 -> z ... }
@paf31
Copy link
Contributor Author

paf31 commented Dec 25, 2013

See toplevelcase branch.

The current desugaring is

test pattern1 pattern2 = y
test pattern3 pattern4 = z
...

to

test = \_0 -> \_1 -> case { _0: _0, _1: _1 } of
   { _0 = pattern1, _1 = pattern2 } -> y
   { _0 = pattern3, _1 = pattern4 } -> z

@paf31
Copy link
Contributor Author

paf31 commented Dec 26, 2013

Added multiple argument case statements to reduce the noise in the generated JS introduced by the desugaring described above.

Available in 0.2.1.1.

@paf31 paf31 closed this as completed Dec 26, 2013
dunhamsteve pushed a commit to dunhamsteve/purescript that referenced this issue Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant