简体   繁体   中英

Scalaz |-> counterpart in Cats

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

"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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM