Open stacycurl opened 10 years ago
I did consider something like (2) fold
, but in the end decided that it added complexity without any corresponding benefits.
Leaving that aside we'd be left with something equivalent to a fold with a two argument Poly
partially applied to z
... so if I can get partial application working it'd be pretty much redundant.
I guess this also probably ought to wait until after the SMC refactor.
Don't know if this is meaningful or if anything is close enough to warrant being called scanLeft. Here's some possible semantics. scanLeft(z: Z)(p: P <: Poly)
1) Require all the cases in P to have Z as one of their arguments. 2) Let the types flow just as for hlist, i.e. Z is paired with the first element, the result of that paired with the second. Since there's only one value in the coproduct then each case (except the first) must accept an Option[Accumulator].
Unlike scan for hlist scan for coproduct cannot include the initial value, otherwise it's essentially const(z) with some type.