我正在自己做一个简单的练习Advanced scala with cats
。
我想Cartesian
与Validated
.
/*
this works
*/
type ValidatedString = Validated[ Vector[String], String]
Cartesian[ValidatedString].product(
"a".valid[Vector[String]],
"b".valid[Vector[String]]
)
/* this doesnt work*/
type Result[A] = Validated[List[String], A]
Cartesian[ValidatedString].product(
f(somevariable)//returns Result[String],
g(somevariable)//returns Result[Int],
).map(User.tupled) // creates an user from the returned string, int
我完全一无所知。有什么提示吗?我越来越 :
could not find implicit value for parameter instance: cats.Cartesian[Result]
Cartesian[Result].product(
^