Skip to content

Instantly share code, notes, and snippets.

@doismellburning
Created August 13, 2014 16:01
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 doismellburning/c6f2c844a62e3ef90406 to your computer and use it in GitHub Desktop.
Save doismellburning/c6f2c844a62e3ef90406 to your computer and use it in GitHub Desktop.
-- Does this function already exist? Because it's not liftA2 / liftM2
foo :: (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a
foo f x Nothing = x
foo f Nothing x = x
foo f (Just x) (Just y) = Just (f x y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment