mcfilib/ribimaybe

Prove Maybe is an Applicative Functor

mcfilib opened this issue · 0 comments

pure id <*> v = v                            -- Identity
pure (.) <*> u <*> v <*> w = u <*> (v <*> w) -- Composition
pure f <*> pure x = pure (f x)               -- Homomorphism
u <*> pure y = pure ($ y) <*> u              -- Interchange

And the Functor instance should satisfy the following law:

fmap f x = pure f <*> x                      -- Fmap