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

cats.Defer instance for Stream. #1936

Merged
merged 3 commits into from
Jul 2, 2020
Merged

Conversation

oskin1
Copy link
Contributor

@oskin1 oskin1 commented Jul 2, 2020

No description provided.

/** `Defer` instance for `Stream` */
implicit def deferInstance[F[_]]: Defer[Stream[F, *]] =
new Defer[Stream[F, *]] {
override def defer[A](fa: => Stream[F, A]): Stream[F, A] = Stream(()) >> fa
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it be a bit faster to do Stream.empty ++ fa?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, thanks!

@mpilquist mpilquist merged commit d845a42 into typelevel:main Jul 2, 2020
@mpilquist
Copy link
Member

Thanks!

@mpilquist
Copy link
Member

BTW, we could do same for Pull

@mpilquist mpilquist added this to the 2.4.3 milestone Aug 18, 2020
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.

3 participants