Skip to content

Conversation

safareli
Copy link
Contributor

fix #112

@safareli safareli force-pushed the somemany branch 2 times, most recently from 9245d15 to 51eaed4 Compare April 26, 2017 14:45
@garyb
Copy link
Member

garyb commented Apr 26, 2017

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
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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.

@paf31
Copy link
Contributor

paf31 commented Apr 26, 2017

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)
Copy link
Contributor

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?

Copy link
Contributor Author

@safareli safareli Apr 26, 2017

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?

Copy link
Contributor

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 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine :p

@garyb garyb merged commit 632e954 into purescript:master Apr 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add some many to Lazy List

3 participants