These are chat archives for ramda/ramda

18th
Jul 2018
Mike Lambert
@lax4mike
Jul 18 2018 15:23
@Bradcomp do you have any insight on how chain treats functions in the m b position? https://github.com/ramda/ramda/blob/v0.25.0/source/chain.js#L31-L33
Brad Compton (he/him)
@Bradcomp
Jul 18 2018 15:28

Well, I have a little, but the specifics have completely escaped my mind.

Function is being treated as the Monad here:

chain :: Function m => (a -> m b) -> m a -> m b

So for the Functor instance, map for functions is compose.
@ram-bot
map(concat('hello'), concat('world'))('')
well dang
SO if you consider chain to be like a map then an unnest You'll need to then flatten the function returned
That's where the second call comes in
I wish I could give you the type derivation, but like I said, I forgot how it works :(
Mike Lambert
@lax4mike
Jul 18 2018 15:33
yeah, seems confusing
Brad Compton (he/him)
@Bradcomp
Jul 18 2018 15:33
I've never used the chain instance for functions