Represents a function A => F[B]
.
Represents a function A => F[B]
.
- Companion
- object
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Value members
Concrete methods
Composes run with a function B => F[C]
not lifted into Kleisli.
Composes run with a function B => F[C]
not lifted into Kleisli.
Tip to tail Kleisli arrow composition.
Creates a function A => F[C]
from run (A => F[B]
) and the given Kleisli of B => F[C]
.
Tip to tail Kleisli arrow composition.
Creates a function A => F[C]
from run (A => F[B]
) and the given Kleisli of B => F[C]
.
scala> import cats.data.Kleisli, cats.implicits._
scala> val takeHead = Kleisli[Option, List[Int], Int](_.headOption)
scala> val plusOne = Kleisli[Option, Int, Int](i => Some(i + 1))
scala> (takeHead andThen plusOne).run(List(1))
res0: Option[Int] = Some(2)
Contramap the input using f
, where f
may modify the input type of the Kleisli arrow.
Contramap the input using f
, where f
may modify the input type of the Kleisli arrow.
scala> import cats.data.Kleisli, cats.implicits._
scala> type ParseResult[A] = Either[Throwable, A]
scala> val parseInt = Kleisli[ParseResult, String, Int](s => Either.catchNonFatal(s.toInt))
scala> parseInt.local[List[String]](_.combineAll).run(List("1", "2"))
res0: ParseResult[Int] = Right(12)
Modify the output of the Kleisli function with f
.
Modify the output of the Kleisli function with f
.
scala> import cats.data.Kleisli, cats.implicits._
scala> val takeHead = Kleisli[Option, List[Int], Int](_.headOption)
scala> takeHead.map(_.toDouble).run(List(1))
res0: Option[Double] = Some(1.0)