I’m somewhat confused as to what we’re all trying to achieve here…

Yes, this is yet another plausible way of implementing `mapM`.

Are we all desperately trying to avoid using `asInstanceOf`, no matter how benign the use? It’s a provably type-safe cast—a technique that is used to good effect in the Scala standard library—and has the upside of shaving off a few extraneous temporary objects. Even if my _programmer’s proof_ doesn’t cut it, `mapM` is now slathered in tests.

I don’t see `fold` as improving matters: I’m all for combinators—I’m implementing a bunch—but I think `fold` here comes at the cost of readability. Furthermore, we’ve piled up a few more anonymous functions, along with the superfluous apply/unapply gymnastics.

Up to you. I just want my `validateM`; I’m so keen on it, I’ve already hacked it into a project.