Make `fold` on `[]` use `mconcat`
Motivation
Currently fold on [] ends up resolving to a recursive application of mappend via the default implementation. This is incredibly slow for certain types like Text, whereas mconcat and Text.concat are asymptotically faster and could be used instead.
Proposal
Override fold in []'s Foldable instance:
instance Foldable [] where
...
+ fold = mconcat
...
For types like Set this approach does not work, as you intentionally want to not use mconcat and instead want to take advantage of the structure of Set. For that you would need to significantly complicate the Monoid class to have something like a Builder data-family to polymorphically convert in and out of. This is probably too much complexity to be worthwhile. However in the case of [] we can get some immediate gains at seemingly no cost by doing the above.