Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 1784

Quick migration guide to uncurried mode for PPX maintainers?

$
0
0

I am also converting graphql-ppx right now, and I used some of the examples. I applied the attributes to the function declaration and the application where relevant and it seems to pass tests. I still have to test it in our codebase though to make sure it actually works (probably not yet :wink: ). The PR is here, so that might also help your changes.

I think my intuitive answer as to why we need to annotate the arity in the function declaration is that it is to differentiate between let fn = a => b => a +b and let fn = (a, b) => a+b which might otherwise not be different in the parse tree representation. There are no such thing as multi arity functions in the OCaml parse tree, and ReScript achieves this by annotating. I guess the compiler then checks if the arities actually match with the application as an extra check in uncurried mode. If this all matches up, rescript can emit clean function applications and doesn’t have to do any runtime curry polyfill.


Viewing all articles
Browse latest Browse all 1784

Trending Articles