在Nick Partridge 关于派生 scalaz 的演示中,基于旧版本的 scalaz,他介绍了使用函数的验证:
def even(x: Int): Validation[NonEmptyList[String], Int] =
if (x % 2 == 0) x.success else { s"not even: $x".wrapNel.failure }
然后他结合使用
even(1) <|*|> even(2)
它应用测试并返回带有失败消息的验证。使用 scalaz 7 我得到
scala> even(1) <|*|> even(2)
<console>:18: error: value <|*|> is not a member of scalaz.Validation[scalaz.NonEmptyList[String],Int]
even(1) <|*|> even(2)
^
这个组合器的scalaz 7等价物是什么?