These are chat archives for ramda/ramda

13th
Feb 2015
David Chambers
@davidchambers
Feb 13 2015 07:39
@joneshf: plaid/sanctuary#10
Eero Saynatkari
@rue
Feb 13 2015 19:46
Hi! Could someone give me an actually working/useful example of commute? With Maybe/Either if that makes it easier. The explanation in the docs eludes me, and playing around with it sheds little light…
Hardy Jones
@joneshf
Feb 13 2015 20:00
I think with Maybe being broken it probably doesn't work
or was that fixed?
well the idea is that it's a function that takes an array of Applicatives, and performs the Applicative effects of each value in the array
what should happen is somehting like this:
R.commute(Maybe.of, [Maybe.Just(3), Maybe.Just(4), Maybe.Just(5)]) //=> Just([3,4,5])
R.commute(Maybe.of, [Maybe.Just(3), Maybe.Nothing(), Maybe.Just(5)]) //=> Nothing
Hardy Jones
@joneshf
Feb 13 2015 20:06
so in the case of Maybe, it pulls each value out of the Just and puts them in an array, and wraps it in a Just, assuming they're all Just
if any of them are Nothing, it gives back a Nothing
Eero Saynatkari
@rue
Feb 13 2015 20:14
Mm, that would make sense. Now, let’s see if I can actually reproduce this… :D
Hardy Jones
@joneshf
Feb 13 2015 20:32
wait
does that work fro you?
it's not for me
Eero Saynatkari
@rue
Feb 13 2015 20:57
@joneshf Nope, hence the desire to somehow reproduce it