-
Notifications
You must be signed in to change notification settings - Fork 23
Description
I was wondering if it mightn't be instructive to somewhere discuss what happens when you try to compose with Selective functors.
It seemed to me that you can only ever recover the selectivity of the inner functor, ie.
Applicative f, Selective g => Selective (Compose f g) where
select (Compose fg) (Compose fg') = Compose $ liftA2 select fg fg'
The outer functor f is executed unconditionally, but selective behaviour of the inner functor g is preserved.
I believe (?) that eg. Selective f, Selective g doesn't permit conditional execution of f in Selective (Compose f g), likewise Selective f, Applicative g.
Does this perhaps help illustrate the way in which the potential effects are statically constrained - in particular the selective execution can't depend on the results of other arbitrary functors which with they are composed?
Also, is there any scope for exploring a stronger notion of "compositional selectivity"? Where we would be allowed to say if f, g do not execute the unchosen branch, then their composition won't do either?