IorT

object IorT extends IorTInstances
Companion
class
trait Product
trait Mirror
class IorTInstances
class IorTInstances1
class IorTInstances2
class IorTInstances3
class Object
trait Matchable
class Any

Type members

Inherited types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Inherited from
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Inherited from
Mirror

Value members

Concrete methods

final def both[F[_], A, B](fa: F[A], fb: F[B])(F: Apply[F]): IorT[F, A, B]

Creates a both version of IorT[F, A, B] from a F[A] and a F[B]

Creates a both version of IorT[F, A, B] from a F[A] and a F[B]

scala> import cats.data.IorT
scala> import cats.implicits._
scala> IorT.both(Option("err"), Option(3))
res0: cats.data.IorT[Option,String,Int] = IorT(Some(Both(err,3)))
final def bothT[F[_]]: BothTPartiallyApplied[F]

Creates a both version of IorT[F, A, B] from a A and a B

Creates a both version of IorT[F, A, B] from a A and a B

scala> import cats.data.IorT
scala> import cats.implicits._
scala> IorT.bothT[Option]("err", 3)
res0: cats.data.IorT[Option,String,Int] = IorT(Some(Both(err,3)))
final def cond[F[_]]: CondPartiallyApplied[F]

If the condition is satisfied, return the given B in Ior.Right, otherwise, return the given A in Ior.Left, lifted into the specified Applicative.

If the condition is satisfied, return the given B in Ior.Right, otherwise, return the given A in Ior.Left, lifted into the specified Applicative.

scala> import cats.data.IorT
scala> import cats.implicits._
scala> val userInput = "hello world"
scala> IorT.cond[Option](
    |   userInput.forall(_.isDigit) && userInput.size == 10,
    |   userInput,
    |   "The input does not look like a phone number")
res0: cats.data.IorT[Option,String,String] = IorT(Some(Left(The input does not look like a phone number)))
final def condF[F[_], A, B](test: Boolean, right: => F[B], left: => F[A])(F: Functor[F]): IorT[F, A, B]

If the condition is satisfied, return the value of IorT.right on F[B], otherwise, return the value of IorT.left on F[A].

If the condition is satisfied, return the value of IorT.right on F[B], otherwise, return the value of IorT.left on F[A].

scala> import cats.data.IorT
scala> import cats.implicits._
scala> val userInput = "hello world"
scala> IorT.condF[Option, String, String](
    |   userInput.forall(_.isDigit) && userInput.size == 10,
    |   Some(userInput),
    |   None)
res0: cats.data.IorT[Option,String,String] = IorT(None)
final def fromEither[F[_]]: FromEitherPartiallyApplied[F]

Transforms an Either into an IorT, lifted into the specified Applicative.

Transforms an Either into an IorT, lifted into the specified Applicative.

scala> import cats.data.IorT
scala> import cats.implicits._
scala> val e: Either[String, Int] = Either.right(3)
scala> IorT.fromEither[Option](e)
res0: cats.data.IorT[Option,String,Int] = IorT(Some(Right(3)))
final def fromEitherF[F[_], E, A](feither: F[Either[E, A]])(F: Functor[F]): IorT[F, E, A]

Transforms an F[Either] into an IorT.

Transforms an F[Either] into an IorT.

scala> import cats.data.IorT
scala> import cats.implicits._
scala> val e: Either[String, Int] = Either.right(3)
scala> IorT.fromEitherF(Option(e))
res0: cats.data.IorT[Option,String,Int] = IorT(Some(Right(3)))
final def fromIor[F[_]]: FromIorPartiallyApplied[F]

Transforms an Ior into an IorT, lifted into the specified Applicative.

Transforms an Ior into an IorT, lifted into the specified Applicative.

scala> import cats.data.{IorT, Ior}
scala> import cats.implicits._
scala> val i: Ior[String, Int] = Ior.both("warning", 3)
scala> IorT.fromIor[Option](i)
res0: cats.data.IorT[Option,String,Int] = IorT(Some(Both(warning,3)))
final def fromOption[F[_]]: FromOptionPartiallyApplied[F]

Transforms an Option into an IorT, lifted into the specified Applicative and using the second argument if the Option is a None.

Transforms an Option into an IorT, lifted into the specified Applicative and using the second argument if the Option is a None.

scala> import cats.data.IorT
scala> import cats.implicits._
scala> val o: Option[Int] = None
scala> IorT.fromOption[List](o, "Answer not known.")
res0: cats.data.IorT[List,String,Int] = IorT(List(Left(Answer not known.)))
scala> IorT.fromOption[List](Some(42), "Answer not known.")
res1: cats.data.IorT[List,String,Int] = IorT(List(Right(42)))
final def fromOptionF[F[_], E, A](foption: F[Option[A]], ifNone: => E)(F: Functor[F]): IorT[F, E, A]

Transforms an F[Option] into an IorT, using the second argument if the Option is a None.

Transforms an F[Option] into an IorT, using the second argument if the Option is a None.

scala> import cats.data.IorT
scala> import cats.implicits._
scala> val o: Option[Int] = None
scala> IorT.fromOptionF(List(o), "Answer not known.")
res0: cats.data.IorT[List,String,Int]  = IorT(List(Left(Answer not known.)))
scala> IorT.fromOptionF(List(Option(42)), "Answer not known.")
res1: cats.data.IorT[List,String,Int] = IorT(List(Right(42)))
final def fromOptionM[F[_], E, A](foption: F[Option[A]], ifNone: => F[E])(F: Monad[F]): IorT[F, E, A]

Similar to fromOptionF but the left is carried from monadic F[_] context when the option is None

Similar to fromOptionF but the left is carried from monadic F[_] context when the option is None

final def left[B]: LeftPartiallyApplied[B]

Creates a left version of IorT[F, A, B] from a F[A]

Creates a left version of IorT[F, A, B] from a F[A]

scala> import cats.data.IorT
scala> import cats.implicits._
scala> IorT.left[Int](Option("err"))
res0: cats.data.IorT[Option,String,Int] = IorT(Some(Left(err)))
final def leftT[F[_], B]: LeftTPartiallyApplied[F, B]

Creates a left version of IorT[F, A, B] from a A

Creates a left version of IorT[F, A, B] from a A

scala> import cats.data.IorT
scala> import cats.implicits._
scala> IorT.leftT[Option, Int]("err")
res0: cats.data.IorT[Option,String,Int] = IorT(Some(Left(err)))

final def liftF[F[_], A, B](fb: F[B])(F: Applicative[F]): IorT[F, A, B]

Alias for right

Alias for right

scala> import cats.data.IorT
scala> import cats.implicits._
scala> val o: Option[Int] = Some(3)
scala> val n: Option[Int] = None
scala> IorT.liftF(o)
res0: cats.data.IorT[Option,Nothing,Int] = IorT(Some(Right(3)))
scala> IorT.liftF(n)
res1: cats.data.IorT[Option,Nothing,Int] = IorT(None)
final def liftK[F[_], A](F: Functor[F]): FunctionK[F, [_] =>> IorT[F, A, _$48]]

Same as liftF, but expressed as a FunctionK for use with IorT.mapK

Same as liftF, but expressed as a FunctionK for use with IorT.mapK

scala> import cats._, data._, implicits._
scala> val a: OptionT[Eval, Int] = 1.pure[OptionT[Eval, *]]
scala> val b: OptionT[IorT[Eval, String, *], Int] = a.mapK(IorT.liftK)
scala> b.value.value.value
res0: cats.data.Ior[String,Option[Int]] = Right(Some(1))
final def pure[F[_], A]: PurePartiallyApplied[F, A]

Creates a right version of IorT[F, A, B] from a B

Creates a right version of IorT[F, A, B] from a B

scala> import cats.data.IorT
scala> import cats.implicits._
scala> IorT.pure[Option, String](3)
res0: cats.data.IorT[Option,String,Int] = IorT(Some(Right(3)))
final def right[A]: RightPartiallyApplied[A]

Creates a right version of IorT[F, A, B] from a F[B]

Creates a right version of IorT[F, A, B] from a F[B]

scala> import cats.data.IorT
scala> import cats.implicits._
scala> IorT.right[String](Option(3))
res0: cats.data.IorT[Option,String,Int] = IorT(Some(Right(3)))
final def rightT[F[_], A]: PurePartiallyApplied[F, A]

Alias for pure

Alias for pure

scala> import cats.data.IorT
scala> import cats.implicits._
scala> IorT.rightT[Option, String](3)
res0: cats.data.IorT[Option,String,Int] = IorT(Some(Right(3)))

Inherited methods

def accumulatingParallel[M[_], E](P: Parallel[M], E: Semigroup[E]): Aux[[_] =>> IorT[M, E, _$74], [_] =>> IorT[F, E, _$75]]

An alternative Parallel implementation which merges the semantics of the outer Parallel (the F[_] effect) with the effects of the inner one (the Ior). The inner Parallel has the semantics of Ior's Parallel, while the outer has the semantics of parallel ''evaluation'' (in most cases). The default Parallel for IorT, when the nested F also has a Parallel, is to strictly take the semantics of the nested F and to short-circuit any lefts (often, errors) in a left-to-right fashion, mirroring the semantics of Applicative on IorT. This instance is different in that it will not ''short-circuit'' but instead accumulate all lefts according to the supplied Semigroup.

An alternative Parallel implementation which merges the semantics of the outer Parallel (the F[_] effect) with the effects of the inner one (the Ior). The inner Parallel has the semantics of Ior's Parallel, while the outer has the semantics of parallel ''evaluation'' (in most cases). The default Parallel for IorT, when the nested F also has a Parallel, is to strictly take the semantics of the nested F and to short-circuit any lefts (often, errors) in a left-to-right fashion, mirroring the semantics of Applicative on IorT. This instance is different in that it will not ''short-circuit'' but instead accumulate all lefts according to the supplied Semigroup.

implicit val p: Parallel[IorT[IO, Chain[Error], *]] = IorT.accumulatingParallel

val a = IorT(IO(Chain(error1).leftIor[Unit]))
val b = IorT(IO(Chain(error2).leftIor[Unit]))

(a, b).parTupled  // => IorT(IO(Chain(error1, error2).leftIor[Unit]))
Inherited from
IorTInstances

Implicits

Inherited implicits

implicit def catsDataBifunctorForIorT[F[_]](F: Functor[F]): Bifunctor[[_, _] =>> IorT[F, _$66, _$67]]
Inherited from
IorTInstances
implicit def catsDataDeferForIor[F[_], E](F: Defer[F]): Defer[[_] =>> IorT[F, E, _$110]]
Inherited from
IorTInstances
implicit def catsDataEqForIorT[F[_], A, B](F: Eq[F[Ior[A, B]]]): Eq[IorT[F, A, B]]
Inherited from
IorTInstances2
implicit def catsDataFoldableForIorT[F[_], A](F: Foldable[F]): Foldable[[_] =>> IorT[F, A, _$114]]
Inherited from
IorTInstances1
implicit def catsDataFunctorForIorT[F[_], A](F: Functor[F]): Functor[[_] =>> IorT[F, A, _$138]]
Inherited from
IorTInstances3
implicit def catsDataMonadErrorFForIorT[F[_], A, E](FE: MonadError[F, E], A: Semigroup[A]): MonadError[[_] =>> IorT[F, A, _$135], E]
Inherited from
IorTInstances2
implicit def catsDataMonadErrorForIorT[F[_], A](F: Monad[F], A: Semigroup[A]): MonadError[[_] =>> IorT[F, A, _$116], A]
Inherited from
IorTInstances1
implicit def catsDataMonoidForIorT[F[_], A, B](F: Monoid[F[Ior[A, B]]]): Monoid[IorT[F, A, B]]
Inherited from
IorTInstances
implicit def catsDataOrderForIorT[F[_], A, B](F: Order[F[Ior[A, B]]]): Order[IorT[F, A, B]]
Inherited from
IorTInstances1
implicit def catsDataParallelForIorTWithParallelEffect[M[_], E](P: Parallel[M], E: Semigroup[E]): Aux[[_] =>> IorT[M, E, _$93], [_] =>> IorT[F, E, _$94]] { type Dummy; }
Inherited from
IorTInstances
implicit def catsDataParallelForIorTWithSequentialEffect[F0[_], E](F: Monad[F0], E: Semigroup[E]): Aux[[_] =>> IorT[F0, E, _$118], [_] =>> IorT[F0, E, _$119]]
Inherited from
IorTInstances1
implicit def catsDataSemigroupForIorT[F[_], A, B](F: Semigroup[F[Ior[A, B]]]): Semigroup[IorT[F, A, B]]
Inherited from
IorTInstances1
implicit def catsDataShowForIorT[F[_], A, B](sh: Show[F[Ior[A, B]]]): Show[IorT[F, A, B]]
Inherited from
IorTInstances
implicit def catsDataTraverseForIorT[F[_], A](F: Traverse[F]): Traverse[[_] =>> IorT[F, A, _$71]]
Inherited from
IorTInstances