Closed gcanti closed 8 years ago
Hey! Two reasons:
1) To match signature of map
and ap
.
( a → b , f a) → f b
(f(a → b), f a) → f b
( a → m b , m a) → m b
2) For currying.
const flow = (value, ...fns) => fns.reduce((x, fn) => fn(x), value)
flow(T.of(1),
T.chain(x => T.of(x + 1)),
T.chain(x => T.of(x + 2))
) // -> T.of(4)
T
would need to implement Ramda-like curried chain
for this though. And SL used to require that, but now it just allows currying and don't require it.
Thanks, makes sense.
SL used to require that, but now it just allows currying and don't require it.
Not sure about that. So if I implement a curried chain
I'm still SL-compliant? There's no mention in the docs
chain :: Chain m => (a → m b) → m a → m b
Seems weird for interop though, how could you call another library if you don't know if it's curried or not?
So if I implement a curried chain I'm still SL-compliant?
Not just curried, but Ramda-like curried, when both T.chain(f)(a)
and T.chain(f, a)
work.
I see, thanks for explaining.
So currently flow-static-land
is not compliant (I wonder if there is a way to fix that). I guess I'll pick the more sensible choice, the curried one
Thanks again @rpominov
I think flow-static-land
is compliant. Spec only require that T.chain(f, a)
works, and it doesn't say anything to disallow T.chain(f)(a)
to work. But it's up to implementer whether to implement currying or not, spec only requires uncurried signature.
Got it. I don't want to pollute this repo with flow-static-land specific issues, I'll think about this a little bit more and, if it's ok for you, I'll open an issue there mentioning you
Yeah, sure.
Hello,
in PureScript and Haskell the signature is
while in static land is
Is there a particular reason for that? At first sight having
m a
near thechain
call seems more handy