Splitting sequences of arbitrary unions

A small snippet that groups sequences of arbitrary unions by branch type.