cats
cats copied to clipboard
Add Syntax For Enumerable
Also load the existing definitions PartialNext/PartialPrevious into implicit scope.
scala> import cats.syntax.all._
import cats.syntax.all._
scala> 1.cycleNext
val res0: Int = 2
scala> 1.cycleNext.cyclePrevious
val res1: Int = 1
I've just realized (thanks, @isomarcte, for bringing it up) that cats.kernel.UnboundedEnumerable pretty much corresponds to cats.collections.Discrete from cats-collections. But the former is way more generic and well defined, I think. The only method the former is missing is that Discrete.adj, but it does not seem to be a big deal.
So I wonder – should we deprecate Discrete from cats-collections in favor of the existing cats typeclasses? 🤔
Yup ;)
- https://github.com/typelevel/cats-collections/issues/315
Yeah, I ran into this when prototyping Interval. :smile: