final case class Kleisli[F[_], -A, B](run: (A) ⇒ F[B]) extends Product with Serializable
Represents a function A => F[B]
.
- Self Type
- Kleisli[F, A, B]
- Source
- Kleisli.scala
- Alphabetic
- By Inheritance
- Kleisli
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new Kleisli(run: (A) ⇒ F[B])
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
andThen[C](k: Kleisli[F, B, C])(implicit F: FlatMap[F]): Kleisli[F, A, C]
Tip to tail Kleisli arrow composition.
Tip to tail Kleisli arrow composition. Creates a function
A => F[C]
from run (A => F[B]
) and the given Kleisli ofB => 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)
-
def
andThen[C](f: (B) ⇒ F[C])(implicit F: FlatMap[F]): Kleisli[F, A, C]
Composes run with a function
B => F[C]
not lifted into Kleisli. - def ap[C, D, AA <: A](f: Kleisli[F, AA, C])(implicit F: Apply[F], ev: As[B, (C) ⇒ D]): Kleisli[F, AA, D]
- def apply(a: A): F[B]
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @IntrinsicCandidate()
- def compose[Z, AA <: A](k: Kleisli[F, Z, AA])(implicit F: FlatMap[F]): Kleisli[F, Z, B]
- def compose[Z, AA <: A](f: (Z) ⇒ F[AA])(implicit F: FlatMap[F]): Kleisli[F, Z, B]
- def dimap[C, D](f: (C) ⇒ A)(g: (B) ⇒ D)(implicit F: Functor[F]): Kleisli[F, C, D]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def first[C](implicit F: Functor[F]): Kleisli[F, (A, C), (B, C)]
- def flatMap[C, AA <: A](f: (B) ⇒ Kleisli[F, AA, C])(implicit F: FlatMap[F]): Kleisli[F, AA, C]
- def flatMapF[C](f: (B) ⇒ F[C])(implicit F: FlatMap[F]): Kleisli[F, A, C]
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def lift[G[_]](implicit G: Applicative[G]): Kleisli[[α]G[F[α]], A, B]
-
def
local[AA](f: (AA) ⇒ A): Kleisli[F, AA, B]
Contramap the input using
f
, wheref
may modify the input type of the Kleisli arrow.Contramap the input using
f
, wheref
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)
- def lower(implicit F: Applicative[F]): Kleisli[F, A, F[B]]
-
def
map[C](f: (B) ⇒ C)(implicit F: Functor[F]): Kleisli[F, A, C]
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)
- def mapF[N[_], C](f: (F[B]) ⇒ N[C]): Kleisli[N, A, C]
-
def
mapK[G[_]](f: ~>[F, G]): Kleisli[G, A, B]
Modify the context
F
using transformationf
. -
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- val run: (A) ⇒ F[B]
- def second[C](implicit F: Functor[F]): Kleisli[F, (C, A), (C, B)]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
tap[AA <: A](implicit F: Functor[F]): Kleisli[F, AA, AA]
Discard computed B and yield the input value.
-
def
tapWith[C, AA <: A](f: (AA, B) ⇒ C)(implicit F: Functor[F]): Kleisli[F, AA, C]
Yield computed B combined with input value.
- def tapWithF[C, AA <: A](f: (AA, B) ⇒ F[C])(implicit F: FlatMap[F]): Kleisli[F, AA, C]
- def toReader: Reader[A, F[B]]
- def traverse[G[_], AA <: A](f: G[AA])(implicit F: Applicative[F], G: Traverse[G]): F[G[B]]
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )