Ah well, thanks for looking
I’m a bit torn on the
.apply method, and most of my concerns are also related to the exposed type of the values in general, rather than being specifically limited to the
On the one hand, it can be really, really, nice to be able to do
list.foldLeft(Some(foo))(merge(_, _)) and have it understand you expect the output type to be
Option[Foo]. Not having this is mitigated somewhat by helpers like
.none, and it’s a familiar problem, so it’s not exactly a deal-breaker.
On the other hand, because none of the subtypes are exposed, it limits what you can do in terms of differentiating typeclass dispatch (e.g. having a different behavior on a leaf than a branch in a GADT). Granted, this doesn’t come up often, and the by-name implicit resolution takes care of many of the cases where I found this most handy, but it can be a bit of a surprise the first time you run into this limitation.