-
Notifications
You must be signed in to change notification settings - Fork 455
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
Uncurried mode #5796
Uncurried mode #5796
Conversation
@@ -140,5 +140,5 @@ let c1 = @foo x => @bar y => x + y | |||
let c2 = (. x) => {y => x + y} | |||
let c3 = (. x) => {@foo y => x + y} | |||
|
|||
type t1 = (. int, string) => bool | |||
type t1 = (. int) => string => bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is a fix.
@@ -9,8 +9,8 @@ type nonrec t = | |||
type nonrec t = | |||
(((float -> | |||
((int)[@attr2 ]) -> | |||
(((bool -> ((string)[@attr4 ]) -> unit) Js.Fn.arity2)[@attr3 ])) | |||
Js.Fn.arity2)[@attr ]) | |||
(((bool -> ((string)[@attr4 ]) -> unit) Js.Fn.arity1)[@attr3 ])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is a fix.
|
||
let cFun = (. x) => 3 | ||
let uFun = x => 3 | ||
let mixFun = (.a) => (b, c) => (.d, e, f) => (.g) => h => 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an example that cannot be written in uncurried mode by simply flipping the first dots. But it can after normalising.
The corner case has the form: ```res (x, .y) => z => 3 ``` The dot in the middle of a sequence of args does not have a corresponding form in uncurried by default, because non-dots in uncurried by defaults are the normal ways to express the argument after the first. This means there's asymmetry between the two syntaxes. This could be handled by declaring this syntax invalid. Currently we instead parse to the desugaring of the syntax, which in normal mode is: ```res x => (.y) => { z => 3 } ``` And in uncurried mode is expressed as: ```res (.x) => y => { (. z) => 3 } ```
E.g. `(. int) => string => bool`
9bf6a52
to
8bac9a8
Compare
No description provided.