-
Notifications
You must be signed in to change notification settings - Fork 123
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
Lhs indexing #609
Lhs indexing #609
Conversation
generate : {n, ix, a} (fin ix, n >= 1, ix >= width (n - 1)) => ([ix] -> a) -> [n]a generate f = [ f i | i <- [0 .. n-1] ]
The declaration `xs @ i = e` is syntactic sugar for `xs = generate (\i -> e)`.
Note that this patch does not yet implement lhs indexing for record constructors or field updates. So things like |
It may be nice to to do, if you have the time, just for consistency. You'd have to modify the production for |
Could you also update |
For example, we can now write foo = { f : [8] -> [4][4][8] } foo = { f i @ j @ k = i + j + k }
829c9b9 adds support for lhs indexing on record constructors and updates. I still need to update the documentation. |
This branch implements the feature requested in #577. It lets us write declarations of the form
xs @ i = e
, which get desugared asxs = generate (\i -> e)
.Before merging, we still need to deal with a problem I introduced in the parser: The changes have introduced a new shift/reduce conflict that I don't yet know how to avoid. We should fix this.