Skip to content

Instantly share code, notes, and snippets.

@munro
Last active August 29, 2015 14:04
Show Gist options
  • Save munro/2fe9b017f5b12ad7fc12 to your computer and use it in GitHub Desktop.
Save munro/2fe9b017f5b12ad7fc12 to your computer and use it in GitHub Desktop.
import Control.Monad
import Control.Applicative
instance (Applicative f, Num a) => Num (f a) where
-- (+) <$> (return 123) <*> (return 321) now becomes:
-- ((return 123) + (return 321)) -- yipee!
(+) = liftA2 (+)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment