Skip to content

Instantly share code, notes, and snippets.

@hadronized
Created March 7, 2019 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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