Typeclassopedia (Haskell Wiki) has this exercise in Applicative's section:
Implement a function
sequenceAL :: Applicative f => [f a] -> f [a]
I could only do it, if used the do notation (requiring Monad f to be added to the context:
sequenceAL :: (Monad f, Applicative f) => [f a] -> f [a]
sequenceAL [] = pure []
sequenceAL (x:xs) = do
y <- x
ys <- sequenceAL xs
pure ([y] ++ ys)
How do I achieve this without using the do-notation and monads.