We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extras-cats
innerFind
innerFilterOrElse
innerExists
innerForall
innerContains
innerCollectFirst
innerOrElse
innerOrElseF
F[Either[A, B]]
[extras-cats] Add innerFind, innerFilterOrElse, innerExists, innerForall, innerContains, innerCollectFirst, innerOrElse and innerOrElseF extension methods to F[Either[A, B]]
Version: 0.35.0
0.35.0
val feab: F[Either[A, B]] = ... feab.innerFind(B => Boolean): F[Option[B]]
val feab: IO[Either[String, Int]] = IO(Right(1)) // IO[Either[String, Int]] = IO(Right(1)) feab.innerFind(_ > 0) // IO[Option[Int]] = IO(Some(1)) feab.innerFind(_ > 1) // IO[Option[Int]] = IO(None)
val feab: F[Either[A, B]] = ... feab.innerFilterOrElse[C >: A](B => Boolean, C): F[Either[C, B]]
val feab: IO[Either[String, Int]] = IO(Right(1)) // IO[Either[String, Int]] = IO(Right(1)) feab.innerFilterOrElse(_ > 0, "Error") // IO[Either[String, Int]] = IO(Right(1)) feab.innerFilterOrElse(_ > 1, "Error") // IO[Either[String, Int]] = IO(Left("Error"))
val feab: F[Either[A, B]] = ... feab.innerExists(B => Boolean): F[Boolean]
val feab: IO[Either[String, Int]] = IO(Right(1)) // IO[Either[String, Int]] = IO(Right(1)) feab.innerExists(_ > 0) // IO[Boolean] = IO(true) feab.innerExists(_ > 1) // IO[Boolean] = IO(false)
val feab: F[Either[A, B]] = ... feab.innerForall(B => Boolean): F[Boolean]
val feab: IO[Either[String, Int]] = IO(Right(1)) // IO[Either[String, Int]] = IO(Right(1)) feab.innerForall(_ > 0) // IO[Boolean] = IO(true) feab.innerForall(_ > 1) // IO[Boolean] = IO(false) val feab2: IO[Either[String, Int]] = IO(Left("Error")) // IO[Either[String, Int]] = IO(Left("Error")) feab2.innerForall(_ > 1) // IO[Boolean] = IO(true)
val feab: F[Either[A, B]] = ... feab.innerContains(B): F[Boolean]
val feab: IO[Either[String, Int]] = IO(Right(1)) // IO[Either[String, Int]] = IO(Right(1)) feab.innerContains(1) // IO[Boolean] = IO(true) feab.innerContains(0) // IO[Boolean] = IO(false) val feab2: IO[Either[String, Int]] = IO(Left("Error")) // IO[Either[String, Int]] = IO(Left("Error")) feab2.innerContains(1) // IO[Boolean] = IO(false)
val feab: F[Either[A, B]] = ... feab.innerCollectFirst[D](PartialFunction[B, D]): F[Option[D]]
val feab: IO[Either[String, Int]] = IO(Right(1)) // IO[Either[String, Int]] = IO(Right(1)) feab.innerCollectFirst { case 1 => 0 case 2 => 999 } // IO[Option[Int]] = IO(Some(0)) val feab2: IO[Either[String, Int]] = IO(Right(2)) // IO[Either[String, Int]] = IO(Right(2)) feab2.innerCollectFirst { case 1 => 0 case 2 => 999 } // IO[Option[Int]] = IO(Some(999)) val feab3: IO[Either[String, Int]] = IO(Right(3)) // IO[Either[String, Int]] = IO(Right(3)) feab3.innerCollectFirst { case 1 => 0 case 2 => 999 } // IO[Option[Int]] = IO(None) val feab4: IO[Either[String, Int]] = IO(Left("Error")) // IO[Either[String, Int]] = IO(Left("Error")) feab4.innerCollectFirst { case 1 => 0 case 2 => 999 } // IO[Option[Int]] = IO(None)
val feab: F[Either[A, B]] = ... feab.innerOrElse[C >: A, D >: B](=> Either[C, D]): F[Either[C, D]]
val feab: IO[Either[String, Int]] = IO(Right(1)) // IO[Either[String, Int]] = IO(Right(1)) feab.innerOrElse(0.asRight[String]) // IO[Option[Int]] = IO(Some(1)) val feab2: IO[Either[String, Int]] = IO(Left("Error")) // IO[Either[String, Int]] = IO(Left("Error")) feab2.innerOrElse(0.asRight[String]) // IO[Option[Int]] = IO(Some(0))
val feab: F[Either[A, B]] = ... feab.innerOrElseF[C >: A, D >: B](=> F[Either[C, D]]): F[Either[C, D]]
val feab: IO[Either[String, Int]] = IO(Right(1)) // IO[Either[String, Int]] = IO(Right(1)) feab.innerOrElseF(IO.pure(0.asRight[String])) // IO[Option[Int]] = IO(Some(1)) val feab2: IO[Either[String, Int]] = IO(Left("Error")) // IO[Either[String, Int]] = IO(Left("Error")) feab2.innerOrElseF(IO.pure(0.asRight[String])) // IO[Option[Int]] = IO(Some(0))
The text was updated successfully, but these errors were encountered:
1471814
Merge pull request #363 from Kevin-Lee/task/362/add-extension-methods…
b203c0b
…-to-FEitherAB Close #362 - [`extras-cats`] Add `innerFind`, `innerFilterOrElse`, `innerExists`, `innerForall`, `innerContains`, `innerCollectFirst`, `innerOrElse` and `innerOrElseF` extension methods to `F[Either[A, B]]`
Issue #362 - Fix type parameter of innerCollectFirst for F[Either[A, B]]
5aa6fa4
Merge pull request #364 from Kevin-Lee/fix-type-param
36d2560
Issue #362 - Fix type parameter of `innerCollectFirst` for `F[Either[A, B]]`
kevin-lee
Successfully merging a pull request may close this issue.
Task
Summary
[
extras-cats
] AddinnerFind
,innerFilterOrElse
,innerExists
,innerForall
,innerContains
,innerCollectFirst
,innerOrElse
andinnerOrElseF
extension methods toF[Either[A, B]]
Project Details
Version:
0.35.0
Description
innerFind
innerFilterOrElse
innerExists
innerForall
innerContains
innerCollectFirst
innerOrElse
innerOrElseF
The text was updated successfully, but these errors were encountered: