generalize concat and flatten. move flatten and flatMap to Sequence