After revisiting my MaybeT excercise I got warning that I should also have Applicative instance. I tried to implement it but got stuck as I cannot find way to apply m x to m f with Applicative m. Do I need Monad m?
newtype MaybeT m x = MaybeT { runMaybeT :: m (Maybe x) }
instance Functor m => Functor (MaybeT m) where
fmap f m = MaybeT $ fmap z $ runMaybeT m where
z (Just x) = Just $ f x
z Nothing = Nothing
instance Applicative m => Applicative (MaybeT m)