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._
有导入的方法吗?
最佳答案
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._
关于scala - 如何在 scalaz 中导入身份操作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28191180/