Scalaz pipe operator connected with a list method

后端 未结 2 1572
傲寒
傲寒 2021-01-22 05:14

I am a newbie to Scala, but I have some experience in using OCaml. I am thinking to adopt the pipe operator defined in Scalaz in the follo

2条回答
  •  失恋的感觉
    2021-01-22 06:03

    Since Scala 2.13, a pipe method is provided by the Scala standard library:

    scala 2.13.3> import scala.util.chaining._
    
    scala 2.13.3> "asdf".pipe(length2).pipe(_.length)
    val res2: Int = 1
    

    To use the same method in Scala 2.11 or 2.12, add scala-collection-compat as a dependency.

提交回复
热议问题