Variant of foldMap accepting a PartialFunction