Scala Cats: How do I convert a List[ValidatedNel[E, A]] to Ior[NonEmptyList[E], List[A]]?

pathikrit

I tried:

def convert[E, A](in: List[ValidatedNel[E, A]]): Ior[NonEmptyList[E], List[A]] =
    in.separate

I get:

could not find implicit value for parameter G: cats.Bifoldable[cats.data.ValidatedNel]
[error]     in.separate

I then tried something like this:

  def convert[E, A](in: List[ValidatedNel[E, A]]): Ior[NonEmptyList[E], List[A]] =
    in.traverse(_.toIor)

Now I got:

 could not find implicit value for evidence parameter of type cats.Applicative[G]
[error]     in.traverse(_.toIor)
pathikrit

As @Toxaris mentioned, -Ypartial-unification needed to be toggled on

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

In the print statement, I have two "cats" mentioned in my sentence. How do I get this function to replace the second "cats"?

How do I convert a Java byte array into a Scala byte array?

How to use Scala Cats Validated the correct way?

Scala / Cats: How to unzip an NonEmptyList

How do I safely convert an MD5 hash into buckets in Java/Scala?

How do I convert a Scala Double into a binary 64-bit String

In spark MLlib, How do i convert string to integer in spark scala?

Scala Cats FreeMonad - Why do I need asInstanceOf[Id[A]] in my Interpreter?

How do I turn a cats IO into a Effect using http4s

How to use Scala Cats' Kleisli with Either

Scala cats OptionT: Convert Future[Option[A]] to Future[Either[B]]

Scala, cats - how to do not use Applicative[F] explicity?

How do I convert Java collections into Scala in Cassandra Datastax driver

Scala, cats - convert FUUID with Circe

How do I convert the result?

How do I convert array<FloatType> to BinaryType in spark dataframes using Scala

In Gatling/Scala how do I convert a jsonPath into an array?

How should a scala cats IOApp acquire an ExecutionContext?

How do I abstract over effects and use ContextShift with Scala Cats?

High level of what I will need to do to port ReactiveMongo scala to use cats effects?

How to implement Applicative for State[S, A] in scala / cats

how do i convert json with mixed type values to json with scala and json spray

How do i convert this jquery

How do I convert a java.util.Set[Field] to an Array[Field] in scala?

How do I convert this into peewee

How do I convert this into lambda

How do I convert unix epoch nanoseconds to date only (without time) on Scala LocalDateTime

How to extract value from Scala cats IO

How can I make interval action with flag in scala cats