Syntax Lookup
Enter some language construct you want to know more about.
This is the @uncurry decorator.
The @uncurry
decorator can be used to mark any callback argument within an external function as an uncurried function without the need for any explicit uncurried function syntax ((.) => { ... })
.
Example
In the following example we are binding to a function map(arr, callback)
and use the @uncurry
annotation to make sure that callback
is always treated as an uncurried function:
As we can see, we defined a regular function ('a) => 'b
instead of (. 'a) => 'b
, but still have all the guarantees. Please note that the compiler does a lot of optimizations, so the example above will compile to the same code even without the @uncurry
decorator. Adding the decorator (or using the (.) =>
syntax) makes the output 100% predictable though.