FlatMap generics nightmare