Tutorial by Examples

Since every Applicative Functor is a Functor, fmap can always be used on it; thus the essence of Applicative is the pairing of carried contents, as well as the ability to create it: class Functor f => PairingFunctor f where funit :: f () -- create a context, carrying nothing ...
Maybe Maybe is an applicative functor containing a possibly-absent value. instance Applicative Maybe where pure = Just Just f <*> Just x = Just $ f x _ <*> _ = Nothing pure lifts the given value into Maybe by applying Just to it. The (<*>) function applies...

Page 1 of 1