My apologies, I've found a better way to express it and am retracting this proposal:

 

mwhen cond a =

  fold [a | cond]

 

a <> mwhen p b <> c <> mwhen q d

  = (fold.fold) [[a],[b|p],[c],[d|q]]

 

This also works with other folds without touching monoid newtype wrappers. I had hang-ups about bool as I don't feel like you can 'read off' the ordering, and thought mempty might be a common argument , but neither of those apply here.

 

Thank you for your replies.