-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
some/many on Alternative #3454
Comments
That said, I can basically only see these as useful for parsers, so I am not sure we should bother adding it. On the other (other) hand, having this method here means you can code a lot of parser code against just Alternative and Defer and then you could share parsers more easily. |
Possibly related to #3446 |
I wrote a very long diatribe on these functions here: scalaz/scalaz#1097 (comment) |
Daniel, I don't think I agree. you claim there are only two implementations (really they are both familes of the same: val count: Int = ??? // any value will do here
def many(fa: F[A]): F[List[A]] = fa map { a => List.fill(count)(a) } That is not what many actually does since you are ignoring the role of My implementations above rule out the concerns you had about non-termination because they always terminate due to using Defer. There is no I can't see an My initial motivation was to write code that could generate both the The I think the bottom line is that is just isn't very common at all to have both Defer and Alternative, so I think that is the key reason. I don't think I see any relevant reasons (once Defer has entered the picture) in your linked comment above. That said, I do think |
Haskell's Alternative has some/many defined as:
We couldn't add those because without laziness the simple thing doesn't terminate. However, now that we have
Defer[F]
we can actually write these methods:The text was updated successfully, but these errors were encountered: