So, I wanted to manually prove the Composition law for Maybe applicative which is:
u <*> (v <*> w) = pure (.) <*> u <*> v <*> w
A useful tool to learn when proving stuff about Haskell code is Agda: Here is a short proof stating what you want to prove:
data Maybe (A : Set) : Set where
Just : (a : A) -> Maybe A
Nothing : Maybe A
_<*>_ : {A B : Set} -> Maybe (A -> B) -> Maybe A -> Maybe B
Just f <*> Just a = Just (f a)
Just f <*> Nothing = Nothing
Nothing <*> a = Nothing
pure : {A : Set} -> (a : A) -> Maybe A
pure a = Just a
data _≡_ {A : Set} (x : A) : A → Set where
refl : x ≡ x
_∘_ : {A B C : Set} ->
(B -> C) -> (A -> B) -> A -> C
_∘_ f g = λ z → f (g z)
maybeAppComp : {A B C : Set} -> (u : Maybe (B -> A)) -> (v : Maybe (C -> B)) -> (w : Maybe C)
-> (u <*> (v <*> w)) ≡ (((pure _∘_ <*> u) <*> v) <*> w)
maybeAppComp (Just f) (Just g) (Just w) = refl
maybeAppComp (Just f) (Just g) Nothing = refl
maybeAppComp (Just f) Nothing (Just w) = refl
maybeAppComp (Just f) Nothing Nothing = refl
maybeAppComp Nothing (Just g) (Just w) = refl
maybeAppComp Nothing (Just a) Nothing = refl
maybeAppComp Nothing Nothing (Just w) = refl
maybeAppComp Nothing Nothing Nothing = refl
This illustrates a couple of points others have pointed out: