MaybeList Applicative
Implement an
Applicative
instance for theMaybeList
type. Don’t forget that you’ll need itsFunctor
instance in scope – preferably in the same module as itsApplicative
instance (you can use any of the three we’ve talked about) – and don’t forget aboutpure
.
We’ll repeat the type definition and Functor
instance here for the sake of completeness.
We had written the Functor
three ways; here we give the two that we think are the most useful models for the Applicative
instance. The first relied on just the list fmap
: