Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
-- Why not this implementation?
selectM :: (Monad f) => f (Either a b) -> f (a -> b) -> f b
selectM x y = do
e <- x
case e of
Left a -> fmap ($a) y
Right b -> fmap (const b) y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.