These are chat archives for ramda/ramda
assocPathbut instead setting this value, it adds to an array ?
mkUpdateHandler = (name, func) => (e) => R.converge( R.identity, [ R.pipe(func, this.updateRoles(name)), this.handleOnAddExporter, ] )(this.getIdAndRoles(e))
(name, func) => R.pipe( this.getIdAndRoles, R.converge( R.identity, [ R.pipe(func, this.updateRoles(name)), this.handleOnAddExporter, ] ) )
Cannot read property 'length' of undefined
either(the function from Ramda) vs.
Either(the type from Ramda-Fantasy), right?
eitherfunction on an
Eithertype certainly is worth taking into account too. :grin:
R.assocPath(['existing', ‘path'], "new value”)vs
R.set(R.lensPath(['existint’, ‘path']), "new value”)
R.seteven calls back to
R.assocPathcan only take paths;
R.setcan take any type of (writeable) lens. In a direct use like that example, they're interchangeable; the difference comes up if you want to separate the behavior from the path --
R.setgeneralizes that to separating the behavior from the structure, rather than requiring the type of structure to be a path.
R.overis really helpful
R.overand composed lenses
assocPathwill get you there. Sometimes, though, you'll want to set a value, retrieve a value, and / or run a function over the value. a lens will give you that functionality