Skip to content

Composition w/ Selective #12

Description

@m00ngoose

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions