From 90d9e5a8dffa59021ab18d7b7136eb137db03329 Mon Sep 17 00:00:00 2001 From: Kevan Stannard Date: Mon, 4 Jan 2021 15:35:01 +1100 Subject: [PATCH] Document calling an uncurried function with a single unit argument. --- pages/docs/manual/latest/function.mdx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pages/docs/manual/latest/function.mdx b/pages/docs/manual/latest/function.mdx index f4b234e36..c9bac1eb7 100644 --- a/pages/docs/manual/latest/function.mdx +++ b/pages/docs/manual/latest/function.mdx @@ -409,6 +409,27 @@ add(1, 2); +If you need to call a curried function with a single unit `()` argument, you can use the `ignore()` function: + + + +```res example +let echo = (. a) => a + +echo(. ignore()) +``` + +```js +function echo(a) { + return a; +} + +echo(undefined); +``` + + + + If you write down the uncurried function's type, you'll add a dot there as well. **Note**: both the declaration site and the call site need to have the uncurry annotation. That's part of the guarantee/requirement.