-- definition class Functor f => Applicative f where pure :: a -> f a (<*>) :: f (a -> b) -> f a -> f b
pure id <*> v $\ \leftrightsquigarrow\ $ v |
pure f <*> pure x $\ \leftrightsquigarrow\ $ pure (f x) |
u <*> pure y $\ \leftrightsquigarrow\ $ pure ($ y) <*> u |
u <*> (v <*> w) $\ \leftrightsquigarrow\ $ pure (.) <*> u <*> v <*> w |
Applicative is a functor together with a polymorphic function 'pure' lifting terms, as well as a function '(<*>)' which applies terms in the lifted function type to lifted terms. Note that 'f (a → b)' is generally not a function space. E.g. the term 'Nothing' of 'Maybe (a→b)' isn't a function.