Closed wlitwin closed 1 year ago
Hey @wlitwin I don't have the answer to your question, but I would recommend re-opening it here because there @bobzhang will be able to answer much faster.
@wlitwin your question is answered here:https://github.com/rescript-lang/syntax/issues/117
I tried looking at the docs on rescript-lang.org but I didn't see anything mentioning this behavior, which I find odd. I'm trying to write some
external
definitions for a JS library that uses a lot of thunks and it seems I need to add an extra level of type indirection in order to get the correct generated code (or use a%raw
escape hatch).Here's example code:
Generated JS:
Output:
I don't understand why all the definitions generate different code. It seems
someFunc
andsomeFunc3
should generate similar code as they share the same definition, but the generated JS forsomeFunc
leaves out the extra application, even though it's present in the source, butsomeFunc3
doesn't have that issue, despite appearing to be the same.Also I'm not sure why adding the
result
type alias works, and generates the extra calls to the curry module. It seems there's at least a bug in the JS generation withsomeFunc
missing the application.If I missed something special with regards to currying and
external
I apologize.