-
Notifications
You must be signed in to change notification settings - Fork 50
add some and many for Lazy List #113
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
Conversation
9245d15
to
51eaed4
Compare
Looks good to me 👍 |
-- | Attempt a computation multiple times, returning as many successful results | ||
-- | as possible (possibly zero). | ||
-- | | ||
-- | The `Lazy` constraint is used to generate the result lazily, to ensure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no Lazy
constraint here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied it from List.purs. But even tho Lazy
constraint isn't used in many
, it's used in some
, which is used by many
, so it's technically true. If want better wording here please let me know and i'll update it in both places
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I misread it, please ignore my comment.
Thanks! |
-- | The `Lazy` constraint is used to generate the result lazily, to ensure | ||
-- | termination. | ||
some :: forall f a. Alternative f => Z.Lazy (f (List a)) => f a -> f (List a) | ||
some v = cons <$> v <*> Z.defer (\_ -> many v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to generate the tail lazily here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what Z.defer
is doing here.
Or do you mean something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think this is fine. Sorry again :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine :p
fix #112