Please define this using `map` and `scanMonoid`, rather than inlining `scanMonoid` here.