Selective Applicative Functors
blog.veritates.love·18h·
💻Programming languages
Preview
Report Post

I havenʼt seen a good accounting of the essence of selective applicative functors.

Theyʼve been longing for a better description, to help explain what should be allowed and what should be disallowed, beyond “hey, here is a function select that seems to do useful things and enable us to write interesting code”.

Selective applicative functors were originally proposed in 2019 in the paper Selective Applicative Functors, by Andrey Mokhov, Georgy Lukyanov, Simon Marlow, and Jeremie Dimino, with this typeclass definition:

class Applicative f => Selective f where
select :: f (Either a b) -> f (a -> b) -> f b

The paper mentions a branch combinator derived from (<*?) = select:

branch :: Selective f => f (Either a b) -> f (a ->...

Similar Posts

Loading similar posts...