package cats
- Alphabetic
- Public
- Protected
Type Members
- final case class IOr[-I, +LO, +RO, +E](left: Stage[I, LO, E], right: Stage[I, RO, E]) extends BinaryOperator[Stage[I, LO, E], Stage[I, RO, E], I, Ior[LO, RO], E] with Product with Serializable
A binary operator that applies two stages independently to the same input and combines their outputs into a
cats.data.Ior(inclusive-or).A binary operator that applies two stages independently to the same input and combines their outputs into a
cats.data.Ior(inclusive-or).All four combinations of left/right presence are handled:
Left result
Right result
Output
Yield.SomeYield.SomeIor.Both(l, r)Yield.SomeYield.NoneIor.Left(l)Yield.NoneYield.SomeIor.Right(r)Yield.NoneYield.NoneYield.NoneUnlike
h8io.stages.operators.And(which short-circuits on the left) andh8io.stages.operators.Or(which short-circuits on the right),IOralways applies both stages, making it the inclusive variant.Statuses from both stages are merged with
combine. The evolution pairs corresponding branches symmetrically (likeh8io.stages.operators.IAnd).- I
the shared input type (contravariant)
- LO
the left output type (covariant)
- RO
the right output type (covariant)
- E
the error type (covariant)
- left
the stage producing the left side of the
Ior- right
the stage producing the right side of the
Ior
Value Members
- object IOr extends Serializable
Companion object for IOr, containing the private evolution and projections.
- object StatusInstances
Cats typeclass instances for
h8io.stages.Status.Cats typeclass instances for
h8io.stages.Status.Statusforms acats.Monoidwithh8io.stages.Status.Successas the identity element andh8io.stages.Status.combineas the binary operation.Import
StatusInstances.*to bring the instances into scope:import h8io.stages.cats.StatusInstances.* - object Validated
Stage projections for
cats.data.Validated.Stage projections for
cats.data.Validated.cats.data.Validated[L, R]is a right-biased validation type whereInvalid(l)holds an error value andValid(r)holds a success value. The two projections here allow a pipeline to route values based on which side is present, producingh8io.stages.Yield.Somefor the expected side andh8io.stages.Yield.Noneotherwise. In both cases the status ish8io.stages.Status.Success.Example:
import h8io.stages.cats.Validated val validStage = Validated.Valid[String] // Stage[cats.data.Validated[?, String], String, Nothing] val invalidStage = Validated.Invalid[String] // Stage[cats.data.Validated[String, ?], String, Nothing]