
On Fri, 7 Nov 2014, Andreas Abel wrote:
Agreed. I never use liftMx or liftAx and when I see them in old code, I replace them by <$> and <*>.
Anyway, I like the proposal best that changes to constraint on liftM to Applicative, and leaves everything else alone.
Ah no, this would add new stuff that can only be explained by history.
I hope the same happens for sequence, mapM and the like!
sequence :: (Applicative m) => [m a] -> m [a] sequence = foldr (\ x xs -> (:) <$> x <*> xs) (pure [])
Actually, this is an example, where liftA2 shows its advantage: sequence = foldr (liftA2 (:)) (pure []) This looks much clearer to me than decoding the mixture of infix and uninfixed infix operators. It simply says, that 'sequence' is like 'id = foldr (:) []' but with everything lifted to an applicative functor.