cs should be a Str on, constructed of Zero, One and Two,
containing all x's direct children of the same type as x. gen
should take a Str on with exactly the same structure as cs,
and generate a new element with the children replaced.

Rewrite by applying a rule everywhere you can. Ensures that the rule cannot
be applied anywhere in the result:

propRewrite r x = all (isNothing . r) (universe (rewrite r x))

Usually transform is more appropriate, but rewrite can give better
compositionality. Given two single transformations f and g, you can
construct f mplus g which performs both rewrites until a fixed point.

Perform a transformation on all the immediate children, then combine them back.
This operation allows additional information to be passed downwards, and can be
used to provide a top-down transformation.