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

Create cats.data.NonEmptyStream? #1089

Open
ceedubs opened this issue Jun 3, 2016 · 3 comments
Open

Create cats.data.NonEmptyStream? #1089

ceedubs opened this issue Jun 3, 2016 · 3 comments

Comments

@ceedubs
Copy link
Contributor

ceedubs commented Jun 3, 2016

Once #1087 and #1088 have been completed, I think that we should probably drop OneAnd from cats. At that point, I think that NonEmptyStream would be the only data structure referencing it. We can probably drop NonEmptyStream at that point, but I created this issue to let people weigh on if NonEmptyStream is something that they would really want in cats. I suspect that it's not really used.

ceedubs added a commit to ceedubs/cats that referenced this issue Jul 25, 2016
This continues work started by @WarFox in typelevel#1120 (see [this comment](typelevel#1120 (comment))).

At this point, I have left `OneAnd` in place. However, I think that
after merging this we may want to delete it. In practice it's pretty
awkward to use and sometimes prevents performant operations. See also typelevel#1089.
@wjlow
Copy link
Contributor

wjlow commented Jan 19, 2018

I'm at the point where I would like to have NonEmptyStream currently.

I have a Stream[A] at the moment that I know is never empty and A is a Semigroup without a Monoid. Would be good to be able to reduce it safely without having to do stream.reduce(_ combine _), which is unsafe.

Edit: In retrospect, since I know I'm going to iterate through the entire Stream using reduce, I could just convert it to a NonEmptyVector instead.

@johnynek
Copy link
Contributor

@wjlow or you can use OneAnd right? https://github.com/typelevel/cats/blob/master/core/src/main/scala/cats/data/OneAnd.scala

@wjlow
Copy link
Contributor

wjlow commented Jan 22, 2018

Yes, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants