syntax.IdOps
似乎没有“伴侣”对象来导入其含义(请参阅selfless pattern),因此很难在REPL中使用它,例如:
scala> val selfish = new scalaz.syntax.ToIdOps{} //I don't want to do this, it feels wrong
selfish: scalaz.syntax.ToIdOps = $anon$1@1adfe356
scala> import selfish._
import selfish._
有没有办法导入它?
答案 0 :(得分:7)
https://github.com/scalaz/scalaz/blob/v7.1.2/core/src/main/scala/scalaz/syntax/Syntax.scala#L117
您可以使用scalaz.syntax.id
代替new scalaz.syntax.ToIdOps{}
import scalaz.syntax.id._