Skip to content

Revise/remove custom mapM implementation for lists

Recently, Simon Marlow asked why the list instance for Traversable had a custom mapM implementation that used the Monad operations. Having looked a bit, I don't think there's any good reason. The only fusion that the custom mapM can participate in is due to it being written as foldr, but traverse is, as well. So as long as mapM = traverse is able to inline appropriately, there should be no difference.

Further, this can be changed, in principle, for 7.10.2. It doesn't change any types, only the implementation.

mapM = traverse is the class default definition, so this could possibly be completed by just removing the custom definition.

Link to the libraries thread: https://mail.haskell.org/pipermail/libraries/2015-May/025708.html

Edited by Ben Gamari
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information