Scalaz嵌套验证:无法找到隐含值

时间:2015-04-01 15:31:15

标签: scala validation scalaz

使用Scalaz ValidationNel,我有以下嵌套的Validations,我试图压扁:

import scala.xml.{NodeSeq, Node, Elem}
import scalaz._
import Scalaz._

val duration: ValidationNel[String, Int] = // ...
val nodes: ValidationNel[String, NodeSeq] = // ...

val r: ValidationNel[String, List[MyType]] = 
         (duration |@| nodes) { (d, ns) =>
           val n: ValidationNel[String, List[MyType]] = 
                  ns.toList.traverse[({ type l[X] = ValidationNel[String, X] })#l, MyType](extractMyType(_, d))
           n
         }.flatMap(identity)
// ...

private def extractMyType(n: Node, d: Int): ValidationNel[String, MyType] = //...

使用sbt进行编译时,我得到:

[error] MyClass.scala:xx: could not find implicit value for parameter F0: scalaz.Bind[scalaz.Unapply[scalaz.Apply,scalaz.ValidationNel[String,Int]]{type M[X] = scalaz.ValidationNel[String,X]; type A = Int}#M]
[error]         val r = (duration |@| nodes) { (d, ns) =>
                                             ^

我正在使用scala 2.10.0和scalaz 7.1.1

我做错了什么?

0 个答案:

没有答案