Closed zzxoto closed 4 years ago
@zzxoto I believe you got missing bit of information related to currying and partial application. You can search by this keywords to make things clear.
In short, when you see something like a -> b -> c
in JS that usually means auto-curried function, which means that function can be used like (a, b) -> c
as well.
So, in fact, two signatures you mentioned last is identical (if we speak about JS auto-currying).
So, if you're comfortable, you can think of flyd functions like (a, b) -> c
, but mind the fact that they can be used in a -> b -> c
manner as well. The second form is just traditional in FP-JS, because in other more strong functional languages that's the standard way of speaking of such functions.
flyd.combine(body, dependencies) has following signature:
(...Stream * -> Stream b -> b) -> [Stream *] -> Stream b
I get how
flyd.combine
works, but I am could not make sense of this signature. Could this signature down and explained step by step.I am getting into more difficulties as I read docs.
For e.g. here is the signature of filter from flyd/module/filter:
(a -> Boolean) -> Stream a -> Stream a
Shouldn't this be
((a -> Boolean), Stream a) -> Stream a
instead?