Skip to content

Commit 90d9e5a

Browse files
author
Kevan Stannard
committed
Document calling an uncurried function with a single unit argument.
1 parent 2e778c7 commit 90d9e5a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pages/docs/manual/latest/function.mdx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,27 @@ add(1, 2);
409409

410410
</CodeTab>
411411

412+
If you need to call a curried function with a single unit `()` argument, you can use the `ignore()` function:
413+
414+
<CodeTab labels={["ReScript", "JS Output"]}>
415+
416+
```res example
417+
let echo = (. a) => a
418+
419+
echo(. ignore())
420+
```
421+
422+
```js
423+
function echo(a) {
424+
return a;
425+
}
426+
427+
echo(undefined);
428+
```
429+
430+
</CodeTab>
431+
432+
412433
If you write down the uncurried function's type, you'll add a dot there as well.
413434

414435
**Note**: both the declaration site and the call site need to have the uncurry annotation. That's part of the guarantee/requirement.

0 commit comments

Comments
 (0)