D924 proposed to change,
mapM_ = foldr ((>>) . f) (return ())
mapM_ = foldr ((*>) . f) (return ()) = traverse_
This, however, blew up the runtime of
:load testsuite/tests/ghci/should_run/ghcirun004.hs in ghci from 4
seconds to 4 minutes.
With some thinking and luck I managed to localize the issue to a
particular mapM_ in ByteCodeAsm.assembleBCO, which is called at the
Assemble monad. Overriding the definition of (*>) for Assemble
brought the behavior back to the expected regime.
I'll need pen and paper to work out why this works.