Class/Object

cats.data

Kleisli

Related Docs: object Kleisli | package data

Permalink

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]
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Kleisli
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Kleisli(run: (A) ⇒ F[B])

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def andThen[C](k: Kleisli[F, B, C])(implicit F: FlatMap[F]): Kleisli[F, A, C]

    Permalink

    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 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)
  5. def andThen[C](f: (B) ⇒ F[C])(implicit F: FlatMap[F]): Kleisli[F, A, C]

    Permalink

    Composes run with a function B => F[C] not lifted into Kleisli.

  6. def ap[C](f: Kleisli[F, A, (B) ⇒ C])(implicit F: Apply[F]): Kleisli[F, A, C]

    Permalink
  7. def apply(a: A): F[B]

    Permalink
  8. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def compose[Z](k: Kleisli[F, Z, A])(implicit F: FlatMap[F]): Kleisli[F, Z, B]

    Permalink
  11. def compose[Z](f: (Z) ⇒ F[A])(implicit F: FlatMap[F]): Kleisli[F, Z, B]

    Permalink
  12. def dimap[C, D](f: (C) ⇒ A)(g: (B) ⇒ D)(implicit F: Functor[F]): Kleisli[F, C, D]

    Permalink

    Performs local and map simultaneously.

  13. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  14. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. def first[C](implicit F: Functor[F]): Kleisli[F, (A, C), (B, C)]

    Permalink
  16. def flatMap[C](f: (B) ⇒ Kleisli[F, A, C])(implicit F: FlatMap[F]): Kleisli[F, A, C]

    Permalink
  17. def flatMapF[C](f: (B) ⇒ F[C])(implicit F: FlatMap[F]): Kleisli[F, A, C]

    Permalink
  18. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  19. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  20. def lift[G[_]](implicit G: Applicative[G]): Kleisli[[α]G[F[α]], A, B]

    Permalink
  21. def local[AA](f: (AA) ⇒ A): Kleisli[F, AA, B]

    Permalink

    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)
  22. def lower(implicit F: Applicative[F]): Kleisli[F, A, F[B]]

    Permalink
  23. def map[C](f: (B) ⇒ C)(implicit F: Functor[F]): Kleisli[F, A, C]

    Permalink

    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)
  24. def mapF[N[_], C](f: (F[B]) ⇒ N[C]): Kleisli[N, A, C]

    Permalink
  25. def mapK[G[_]](f: ~>[F, G]): Kleisli[G, A, B]

    Permalink

    Modify the context F using transformation f.

  26. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  27. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  28. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  29. val run: (A) ⇒ F[B]

    Permalink
  30. def second[C](implicit F: Functor[F]): Kleisli[F, (C, A), (C, B)]

    Permalink
  31. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  32. def tap(implicit F: Functor[F]): Kleisli[F, A, A]

    Permalink

    Discard computed B and yield the input value.

  33. def tapWith[C](f: (A, B) ⇒ C)(implicit F: Functor[F]): Kleisli[F, A, C]

    Permalink

    Yield computed B combined with input value.

  34. def tapWithF[C](f: (A, B) ⇒ F[C])(implicit F: FlatMap[F]): Kleisli[F, A, C]

    Permalink
  35. def toReader: Reader[A, F[B]]

    Permalink
  36. def traverse[G[_]](f: G[A])(implicit F: Applicative[F], G: Traverse[G]): F[G[B]]

    Permalink
  37. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  38. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def transform[G[_]](f: FunctionK[F, G]): Kleisli[G, A, B]

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 1.0.0-RC2) Use mapK

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped