Which operations should be included in the new collections?


I would like something like Option.when[A](condition: Boolean)(value: => T): Option[A] = if (condition) Some(value) else None. I often find myself doing if (condition) None else Some {something complicated}, which would be nicer as Option.when(condition) {something complicated}.


That’s not sufficient though. The map method itself needs to be different for the different cases.


Isn’t it what CC[_] suppose to do?


I would like something like Option.when

there is an open PR on that at https://github.com/scala/scala/pull/5995

(but note that Option isn’t a collection, so it’s not really on-topic for this thread…)


@SethTisue Thanks for the pointer.