I've migrated some code using cats 0.2 to cats 0.6, and my code is not wroking anymore :
import cats.data.Validated
import cats.std.all._
val valid1: Validated[List[String], Int] = valid(1)
val valid2: Validated[List[String], Int] = valid(2)
(valid1 |@| valid2).map{_+_}
Compiler says :
Error:(48, 6) value |@| is not a member of
cats.data.Validated[List[String],Int]
(valid1 |@| valid2).map{_+_}
^
I did not find anything in the documentation regarding this, should I had an import or declare an implicit or something?
I've managed to use product
instead of |@|
but it's not as convenient as it produces nested tuples. Let's say I have 4 validated to combine :
(valid1 product valid2 product valid3 product valid4)
.map{case (((v1, v2), v3), v4) => v1 + v2 + v3 + v4}
Thanks
As @meps said in comments, missing import was cats.syntax.all._
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With