Replies: 2 comments
-
TBH, I don't have hard feelings towards the uncurrying mechanism. It's the way it is after a lot of trial and error, but I'm ok with improving/extending it if possible. From time to time I realize that some of my previous assumptions were wrong so it's very likely the algorithm still contains flaws. I think we are well covered by tests, so you can try to make a change and see if all the tests pass (particularly those in Applicative). Although maybe I'm not understanding your request correctly. Currently the uncurrying does happen when passing parameters, but it's disabled when returning a function from another function (this is because there were many corner cases I couldn't fix). If I remember correctly these are the rules more or less:
|
Beta Was this translation helpful? Give feedback.
-
I guess what I meant is, funcs that are uncurried are then re-curried when passed in as parameters, as below. let adder2 x y = x + y + z // here adder2 is uncurried
let add2 adder x y = adder x y // here adder type is curried
add2 adder2 x y // so here adder2 has to be re-curried Perhaps a transformation to uncurry parameter types and parameter usage in the body can work. |
Beta Was this translation helpful? Give feedback.
-
@alfonsogarciacaro I know by now you probably don't want to touch the uncurrying with a ten foot pole, so this is just asking for an opinion, it's not an issue or a feature request.
Since the uncurrying in parameters has been removed, do you think there may be some other way to bring it back conditionally, perhaps with a parameter-level attribute?
This is mostly for performance reasons, to avoid the unnecessary currying if a local lambda is already uncurried. This example shows the unnecessary currying, and the current work-around using
Func<_>
to remove it (which ideally that conditional feature would make happen automatically somehow).Beta Was this translation helpful? Give feedback.
All reactions