All Downloads are FREE. Search and download functionalities are using the official Maven repository.

typo.dsl.pagination.internal.scala Maven / Gradle / Ivy

There is a newer version: 0.28.0
Show newest version
package typo.dsl.pagination

object internal {
  // avoid cats dependency
  implicit class ListOps[T](private val list: List[T]) extends AnyVal {
    def traverse[U](f: T => Either[String, U]): Either[String, List[U]] = {
      val it = list.iterator
      val result = List.newBuilder[U]
      while (it.hasNext) {
        f(it.next()) match {
          case Left(e)  => return Left(e)
          case Right(u) => result += u
        }
      }
      Right(result.result())
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy