无法弄清楚是否可以使用Scalaz 7编写类似的内容.我试图用代码块中的注释表达自己.
def validate1(p: String) = ValidationNel[String, Value] = ...
def validate2(p: String) = ValidationNel[String, Value] = ...
validateCombination(p1: String, p2: String) = {
// I would like to write something like
(validate1(p1) |@| validate2(p2)) { (v1, v1) =>
// And validate the combinations here and return successNel of failNel
}
}
def validate(p1: String, p2: String, p3: String) = {
(validateCombination(p1, p2) |@| validate1(p3)) { (v1, v2, v3) =>
// Notice the three parameters I want to have here …
Run Code Online (Sandbox Code Playgroud)