Improve performance with foldMap over Data.Matrix.