Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scanLeft & scanRight to Coproduct #186

Open
stacycurl opened this issue Jul 19, 2014 · 2 comments
Open

Add scanLeft & scanRight to Coproduct #186

stacycurl opened this issue Jul 19, 2014 · 2 comments
Labels

Comments

@stacycurl
Copy link
Collaborator

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.

@milessabin
Copy link
Owner

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.

@milessabin
Copy link
Owner

I guess this also probably ought to wait until after the SMC refactor.

@milessabin milessabin added this to the shapeless-2.2.0 milestone Oct 3, 2014
@joroKr21 joroKr21 removed this from the shapeless-2.4.0 milestone Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants