-
-
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
We need to talk about Stream #2982
Comments
(I should note that I'm happy to do all of the work required to make either of these proposals happen.) |
Informal poll here: https://twitter.com/travisbrown/status/1159755371768139776 |
Won't that be circular dependency? The naming of stream related stuff in cats is for the sake of cross compiling. I am okay if we remove the I am 👍 adding a lazylist object to kernel for consistency. |
Oh, right. Something like that came up briefly in the conversation yesterday but I didn't really think it through. |
That's not the only option, perhaps. You could use the |
Well, those instance really should be deprecated. |
Fixed in #2983. |
Problem
The current Cats 2.0.0 release candidate (RC1) assumes that Scala 2.13 users will be able to alias the new
LazyList
toStream
(which is deprecated in 2.13.0). For example, thecats.instances.stream
object doesn't actually provide instances forStream
on 2.13:But it does provide
LazyList
instances:There's also a
lazyList
object that provides exactly the same instances:So the
stream
object is still around just to facilitate cross-compilation, but only for users who can aliasLazyList
. For everyone else it's just confusing—when you import the contents of something calledinstances.stream
you're probably going to assume that you'll get someStream
instances.We're not even really consistent about this, in that cats-kernel takes a slightly different approach: like cats-core, it provides a
stream
object incats.kernel.instances
that also containsLazyList
instances but notStream
ones, but unlike cats-core it doesn't have alazyList
object.None of this would be that big of a problem if everyone using 2.13 could just alias
LazyList
(there would still be the inconsistencies, but we have lots of inconsistencies), but that's not realistic, since there are lots of libraries that are published for 2.13 that still useStream
.Solutions
There are a few things we could do to address these problems in Cats 2.0:
Provide stream instances
We could have
cats.instances.stream
andcats.kernel.instances.stream
provide exactly the same instances across 2.11, 2.12, and 2.13, and introduce newcats.instances.lazyList
andcats.kernel.instances.lazyList
objects for 2.13. This seems to me like the right thing to do. The downside is that it means we have deprecation warnings, which means we either have to disable fatal warnings or move these instances to entirely separate modules that cats-kernel and cats-core depend on. I'd advocate for turning off fatal warnings, but I know that's not a battle I'm going to win. Ideally we'd be consistent about our names everywhere, not using "Stream
" to mean "LazyList
", but I know that's even less likely to happen.Don't provide either instances or instance packages
If we decide not to provide instances for
Stream
on 2.13, it seems to me pretty aggressively user-unfriendly to provide some objects calledinstances.stream
, because "a missing import error is easier to diagnose than a missing instance error". We could dropcats.instances.stream
and replacecats.kernel.instances.stream
on 2.13, and users who are able to aliasLazyList
and want to cross-compile can use thecats.instances.all
import.Nothing
We could just leave things the way they are, possibly introducing a
lazyList
object in cats-kernel to get rid of that inconsistency.The text was updated successfully, but these errors were encountered: