私は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(
^