cats icon indicating copy to clipboard operation
cats copied to clipboard

Add Syntax For Enumerable

Open isomarcte opened this issue 3 years ago • 3 comments

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

isomarcte avatar Nov 15 '22 22:11 isomarcte

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? 🤔

satorg avatar Nov 16 '22 01:11 satorg

Yup ;)

  • https://github.com/typelevel/cats-collections/issues/315

armanbilge avatar Nov 16 '22 01:11 armanbilge

Yeah, I ran into this when prototyping Interval. :smile:

isomarcte avatar Nov 16 '22 02:11 isomarcte