Skip to content

Instantly share code, notes, and snippets.

@hadronized
Created March 7, 2019 13:39
Show Gist options
  • Save hadronized/24ef88910402867b0176156df4204679 to your computer and use it in GitHub Desktop.
Save hadronized/24ef88910402867b0176156df4204679 to your computer and use it in GitHub Desktop.
-- 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 -> b <$ y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment