I noticed that the Scalaz |->
operator is not implemented in Cats. Is there a function offering similar semantics?
Asked
Active
Viewed 71 times
0

Dmytro Mitin
- 48,194
- 3
- 28
- 66

LuGo
- 4,877
- 1
- 18
- 19
-
Do you mean [this here](https://static.javadoc.io/org.scalaz/scalaz-core_2.11/7.2.2/index.html#scalaz.syntax.EnumOps@|-%3E(to:F):List[F])? – Andrey Tyukin Jun 15 '19 at 14:16
-
@AndreyTyukin yes – LuGo Jun 16 '19 at 16:33
-
Well, there is no good reason why `|->` should be in Cats, so it's not in there. – Andrey Tyukin Jun 16 '19 at 16:35
-
What's the good reason for it to be in Scalaz? – LuGo Jun 16 '19 at 17:33
1 Answers
2
"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)

Dmytro Mitin
- 48,194
- 3
- 28
- 66