Search code examples
scalascalazscala-cats

Scalaz |-> counterpart in Cats


I noticed that the Scalaz |-> operator is not implemented in Cats. Is there a function offering similar semantics?


Solution

  • "Herding Cats" tutorial recommends to use spire.math.Interval as Cats/Typelevel's replacement for scalaz.Enum.

    So try to replace

    import scalaz.syntax.enum._
    import scalaz.std.anyVal._
    
    1 |-> 10 // List(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
    

    with

    import spire.math.Interval
    import spire.std.int._
    
    Interval(1, 10).iterator(1).toList // List(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)