-
Notifications
You must be signed in to change notification settings - Fork 0
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
How should we render patterns/bindings? #54
Comments
I'm marking this as medium priority, as it's bundled in with all of the other various parameter-ish issues that are already medium priority. |
Here's another way in which we should do a better job rendering patterns. Consider the following definition of We render the |
I would like to try rendering constructors in |
Nope, not gonna happen in our current frontend. |
We realised in https://github.com/hackworthltd/vonnegut/pull/285 that we should distinguish between (for want of better terms) patterns and expressions, where patterns define and bind new variables and expressions reference existing variables. In text view, patterns tend to appear on the left hand side of arrows. For example,
x
is a pattern in each of these:Whereas
x
is an expression (specifically, a variable) in each of these:Patterns in Vonnegut have two forms:
x
Just x
We currently only allow constructor patterns in case branches and only at the top level, so e.g.
Cons (Just x) xs
is not a valid pattern.Patterns have a different a smaller set of rules governing their behaviour compared to expressions. As a user editing a program, the only things you can do to a pattern are:
Patterns also don't really "have types" in the same way as expressions, but we can still associate them with the type of expression they match.
(There's probably more info I can add here - I'll do that shortly)
The text was updated successfully, but these errors were encountered: