assocPath
will create intermediate properties I am pretty sure
R.compose(R.defaultTo([0,0]), R.nth(-1))
x = lensPath(['a', *, 'd']);
which would return all d
children of any elements that are children of a
.
a
can be operated on by R.map
callback
helper function I have written below. Could someone please let me know if it exists?const callback = (fn) => (...args) => () => fn(...args)
const obj = {
method: (x, y) => x + y
}
const exists = always(has('method', obj))
const execute = callback(prop('method', obj))('Invoke ', 'Fn')
when(exists, execute)(null)
I would push for ADTs over currying for sure. Point free without static types can make things harder to read until used to it. It's really nice if your team is into it, but otherwise I think it's best used sparingly. There are certain places where currying makes a ton of sense (DI is often one of those cases).
I can't tell you how often I see a good use for Maybe or Either. They come up everywhere, and are especially helpful in dynamically typed code.
(arg1, arg2) => async () => { ... }
ap
is a great use case for curry
except that it relies on the understanding of uh... container types
const f = when(x => x === 2, x => x + 1);
const f = when(eq(2), x => x + 1);
const f = when(eq(2), inc);
for instance