Skip to content

Use Foldable in MonadUtils and friends

Richard Lupton requested to merge rlupton20/ghc:foldable-monad-utils into master

This MR does three things

  • generalizes the folds in MonadUtils to work over general Foldables, not just [].
  • Replaces fold*Bag functions with their Foldable implementations (with specialisations for foldl and foldl' for Bag)
  • Replaces foldls over Bags with foldl's.

This tidies some interfaces to make use of more general machinery that has been available for a while, and makes some headway on #16969 (closed) .


Thank you for your contribution to GHC!

Please take a few moments to verify that your commits fulfill the following:

  • are either individually buildable or squashed
  • have commit messages which describe what they do (referring to Notes and tickets using #NNNN syntax when appropriate)
  • have added source comments describing your change. For larger changes you likely should add a Note and cross-reference it from the relevant places.
  • add a testcase to the testsuite.
  • replace this message with a description motivating your change

If you have any questions don't hesitate to open your merge request and inquire in a comment. If your patch isn't quite done yet please do add prefix your MR title with WIP:.

Edited by Richard Lupton

Merge request reports