#2529·ramda

Cryptic errors thrown for illegal use of `R.chain`

Author: dmitrizCreated May 15, 2018Updated Jul 31, 2023
Labelsproposal1.0 discussion

I've got this error when writing this answer:

javascript
// Define our own uncurried append
const appendCustom = (a, b) => R.append(a, b)
R.chain(appendCustom, R.head)([1, 2]);

It is almost the same as the doc example, except the append function is intentionally uncurried. The REPL throws the cryptic error message:

bash
t(...) is not a function

which is possibly a bug?

The usage is of course illegal but on a somewhat subtle level, ignored for instance by the incorrect R.chain implementation written in the top voted example to this question.