A lawless type class that provides conversions into a IO.
A lawless type class that provides conversions into a IO.
Sample:
// Conversion from cats.Eval
import cats.Eval
val source0 = Eval.always(1 + 1)
val task0 = IOLike[Eval].apply(source0)
// Conversion from Future
import scala.concurrent.Future
val source1 = Future.successful(1 + 1)
val task1 = IOLike[Future].apply(source1)
// Conversion from IO
import cats.effect.{IO => CIO}
val source2 = CIO(1 + 1)
val task2 = IOLike[CIO].apply(source2)
This is an alternative to the usage of cats.effect.Effect,
where the internals are specialized to IO
anyway, like for
example the implementation of monix.reactive.Observable
.
- Companion
- object
Value members
Abstract methods
Converts F[A]
into a Task[A]
, preserving referential
transparency if F[_]
is a pure data type and preserving
interruptibility if the source is cancelable.
Converts F[A]
into a Task[A]
, preserving referential
transparency if F[_]
is a pure data type and preserving
interruptibility if the source is cancelable.
Inherited methods
Composes two instances of FunctionK
into a new FunctionK
that transforms
one single functor to a cats.data.Tuple2K of two functors.
Composes two instances of FunctionK
into a new FunctionK
that transforms
one single functor to a cats.data.Tuple2K of two functors.
scala> import cats.arrow.FunctionK
scala> val list2option = λ[FunctionK[List, Option]](_.headOption)
scala> val list2vector = λ[FunctionK[List, Vector]](_.toVector)
scala> val optionAndVector = list2option and list2vector
scala> optionAndVector(List(1,2,3))
res0: cats.data.Tuple2K[Option,Vector,Int] = Tuple2K(Some(1),Vector(1, 2, 3))
- Inherited from
- FunctionK
Composes two instances of FunctionK into a new FunctionK with this transformation applied first.
Composes two instances of FunctionK into a new FunctionK with this transformation applied first.
- Inherited from
- FunctionK
Composes two instances of FunctionK into a new FunctionK with this transformation applied last.
Composes two instances of FunctionK into a new FunctionK with this transformation applied last.
- Inherited from
- FunctionK
Narrows the input type of this FunctionK
from F
to F0
Narrows the input type of this FunctionK
from F
to F0
- Inherited from
- FunctionK
Composes two instances of FunctionK into a new FunctionK that transforms a cats.data.EitherK to a single functor.
Composes two instances of FunctionK into a new FunctionK that transforms a cats.data.EitherK to a single functor.
This transformation will be used to transform left F
values while
h
will be used to transform right H
values.
- Inherited from
- FunctionK