In the monoid lesson, we posed this question: If each of the following four functions is the
(<>) operation for a semigroup, what is the identity value that makes it a monoid?
This one was slightly a trick question, because we have to strengthen the constraint on
Monoid in order to ensure that this identity value exists.
Nothing is not an identity for this function! Remember the identity laws. For all
mempty <> x = x
x <> mempty = x
Take, for example,
x = Just 1. Then
f3 Nothing (Just 1) is
Just 1, therefore we know that
Nothing is not an identity.