Generalize partitionM to Applicative.