MaybeList Applicative

Implement an Applicative instance for the MaybeList type. Don’t forget that you’ll need its Functor instance in scope – preferably in the same module as its Applicative instance (you can use any of the three we’ve talked about) – and don’t forget about pure.

We’ll repeat the type definition and Functor instance here for the sake of completeness.

newtype MaybeList a = MaybeList (Maybe [a])
    deriving Show

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:

Sign up for access to the full page, plus the complete archive and all the latest content.