1 liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
2 liftA2 h fa fb = (h `fmap` fa) <*> fb
4 -- In fact, this pattern is so common that Control.Applicative defines (<$>) as a synonym for fmap,
6 (<$>) :: Functor f => (a -> b) -> f a -> f b
9 liftA2 h fa fb = h <$> fa <*> fb
15 -- (a -> b -> c) -> f a -> f (b -> c)
18 -- (<*>) :: f (a -> b) -> f a -> f b
20 -- f (b -> c) -> f b -> f c
23 -- f `fmap` x === pure f <*> x
25 -- lhs = (a -> b) `fmap` f a gives a value of type f b
27 -- f has the type (a -> b), so pure f has the type f (a -> b)
28 -- pure f <*> x => f (a -> b> <*> f a => f b