Solving monad and applicative exercises