final case class Cokleisli[F[_], A, B](run: (F[A]) => B) extends Product with Serializable
Represents a function F[A] => B
.
- Self Type
- Cokleisli[F, A, B]
- Source
- Cokleisli.scala
- Alphabetic
- By Inheritance
- Cokleisli
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Cokleisli(run: (F[A]) => 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](c: Cokleisli[F, B, C])(implicit F: CoflatMap[F]): Cokleisli[F, A, C]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def compose[C](c: Cokleisli[F, C, A])(implicit F: CoflatMap[F]): Cokleisli[F, C, B]
- def contramapValue[C](f: (F[C]) => F[A]): Cokleisli[F, C, B]
Example:
Example:
scala> import cats._, data._ scala> val sum = Cokleisli((xs: NonEmptyList[Int]) => xs.reduceLeft(_ + _)) scala> sum.contramapValue((xs: NonEmptyList[String]) => xs.map(_.toInt)).run(NonEmptyList.of("1","2","3")) res4: Int = 6
- def dimap[C, D](f: (C) => A)(g: (B) => D)(implicit F: Functor[F]): Cokleisli[F, C, D]
Example:
Example:
scala> import cats._, data._ scala> val f = Cokleisli((xs: NonEmptyList[Int]) => xs.reverse.head) scala> def before(x: Double) = x.toInt scala> def after(x: Int) = x.toString scala> f.dimap(before)(after).run(NonEmptyList.of(1.0,2.0)) res0: String = 2
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def first[C](implicit F: Comonad[F]): Cokleisli[F, (A, C), (B, C)]
- def flatMap[C](f: (B) => Cokleisli[F, A, C]): Cokleisli[F, A, C]
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def lmap[C](f: (C) => A)(implicit F: Functor[F]): Cokleisli[F, C, B]
Example:
Example:
scala> import cats._, data._, implicits._ scala> val f = Cokleisli((xs: NonEmptyList[Int]) => xs.reverse.head) scala> def before(x: Double) = x.toInt scala> def after(x: Int) = x.toString scala> f.lmap(before).rmap(after).run(NonEmptyList.of(1.0,2.0)) res0: String = 2
- def map[C](f: (B) => C): Cokleisli[F, A, C]
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- val run: (F[A]) => B
- def second[C](implicit F: Comonad[F]): Cokleisli[F, (C, A), (C, B)]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()