You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the rule to add a type definition when I use Obj.magic for casting types. In this case, it becomes more explicit, and the compiler at least can check that input and output types are used correctly. How can I do the same in the uncurried mode? Looks like the uncurried: true doesn't propagate to the built-in stdlibs.
The text was updated successfully, but these errors were encountered:
DZakh
changed the title
How to type a curried function in uncurried mode?
Uncurried mode doesn't propagate to built-in stdlibs.
Apr 14, 2023
At the moment trying not to make 2 copies of everything. So perhaps it's just that Obj.magic is not in pervasives.
In this case: let magic = x => magic(x) should do.
Later on, we can assess how many things we want 2 copies of.
Note, if one uses things from Core being it an external library, it will be compiled in uncurried mode.
So we might do nothing about stuff in built-in libs which is also present in Core.
OK so if you look into node_modules/rescript/lib/ocaml, the only one for which we do 2 copies at the moment is pervasives.
Notice that most of the time it just works. So go ahead and use Obj.magic. Just don't write a type annotation for it. Or eta-expand it as in my previous response.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I have the rule to add a type definition when I use
Obj.magic
for casting types. In this case, it becomes more explicit, and the compiler at least can check that input and output types are used correctly. How can I do the same in the uncurried mode? Looks like theuncurried: true
doesn't propagate to the built-in stdlibs.The text was updated successfully, but these errors were encountered: