This is the ninth of a series of articles on “Type Parameters and Type Members”. Scala’s CanBuildFrom API is relatively well-founded and flexible; in combination with GADTs, it can provide that flexibility in a fully type-safe way, if users choose not to circumvent it with typecasting. However, it is designed in a purely mutable way; you cannot write a useful CanBuildFrom that does not rely on mutation, and you cannot use the API externally in a functional way. Let’s design an alterna...