Improve flattening.

Handle `{*}` and `[*]` as the appropriate functions, rather than as
special cases of `*Deref`.