tusharmath/qio

Incorrect type for `ap`

beezee opened this issue · 3 comments

Here the type of input for the ap function is A1 - https://github.com/tusharmath/qio/blob/master/packages/core/lib/main/QIO.ts#L64

You don't need an Applicative for that, you just need a Functor, and it doesn't provide anything that map doesn't already give you.

The "standard" categorically influenced signature for ap would have the type of input be QIO<A1, E1, R1>

With an effect type that is capable of modeling concurrency, you'd generally reach for an Applicative interface to avoid needless sequencing of independent computations. Is there an implementation of ap that is possible with the correct signature that would provide this behavior, or would the behavior effectively be the same as using chain?

You are right! This is actually not a very useful operator either. I guess we can delete it :)

There is a zipPar operator available, that one should use instead.

Thanks that's good to know. FWIW I'd see it totally reasonable to fix the type of ap and keep it around since it's a generally well understood interface across typed fp.