Packages

trait ArrowChoice[F[_, _]] extends Arrow[F] with Choice[F] with Serializable

Must obey the laws defined in cats.laws.ArrowChoiceLaws.

Self Type
ArrowChoice[F]
Linear Supertypes
Choice[F], Arrow[F], Strong[F], Profunctor[F], Category[F], Compose[F], Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ArrowChoice
  2. Choice
  3. Arrow
  4. Strong
  5. Profunctor
  6. Category
  7. Compose
  8. Serializable
  9. Serializable
  10. AnyRef
  11. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def choose[A, B, C, D](f: F[A, C])(g: F[B, D]): F[Either[A, B], Either[C, D]]

    ArrowChoice yields Arrows with choice, allowing distribution over coproducts.

    ArrowChoice yields Arrows with choice, allowing distribution over coproducts.

    Given two Fs (f and g), create a new F with domain the coproduct of the domains of f and g, and codomain the coproduct of the codomains of f and g. This is the sum notion to split's product.

    Example:

    scala> import cats.implicits._
    scala> val toLong: Int => Long = _.toLong
    scala> val toDouble: Float => Double = _.toDouble
    scala> val f: Either[Int, Float] => Either[Long, Double] = toLong +++ toDouble
    scala> f(Left(3))
    res0: Either[Long,Double] = Left(3)
    scala> f(Right(3))
    res1: Either[Long,Double] = Right(3.0)
    Annotations
    @op( "+++" , true )
  2. abstract def compose[A, B, C](f: F[B, C], g: F[A, B]): F[A, C]
    Definition Classes
    Compose
  3. abstract def first[A, B, C](fa: F[A, B]): F[(A, C), (B, C)]

    Create a new F that takes two inputs, but only modifies the first input

    Create a new F that takes two inputs, but only modifies the first input

    Example:

    scala> import cats.implicits._
    scala> import cats.arrow.Strong
    scala> val f: Int => Int = _ * 2
    scala> val fab = Strong[Function1].first[Int,Int,Int](f)
    scala> fab((2,3))
    res0: (Int, Int) = (4,3)
    Definition Classes
    Strong
  4. abstract def lift[A, B](f: (A) ⇒ B): F[A, B]

    Lift a function into the context of an Arrow.

    Lift a function into the context of an Arrow.

    In the reference articles "Arrows are Promiscuous...", and in the corresponding Haskell library Control.Arrow, this function is called arr.

    Definition Classes
    Arrow

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def algebra[A]: Monoid[F[A, A]]
    Definition Classes
    CategoryCompose
  5. def algebraK: MonoidK[[α]F[α, α]]
    Definition Classes
    CategoryCompose
  6. def andThen[A, B, C](f: F[A, B], g: F[B, C]): F[A, C]
    Definition Classes
    Compose
  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def choice[A, B, C](f: F[A, C], g: F[B, C]): F[Either[A, B], C]

    Given two Fs (f and g) with a common target type, create a new F with the same target type, but with a source type of either f's source type OR g's source type.

    Given two Fs (f and g) with a common target type, create a new F with the same target type, but with a source type of either f's source type OR g's source type.

    Example:

    scala> import cats.implicits._
    scala> val b: Boolean => String = _ + " is a boolean"
    scala> val i: Int => String =  _ + " is an integer"
    scala> val f: (Either[Boolean, Int]) => String = b ||| i
    
    scala> f(Right(3))
    res0: String = 3 is an integer
    
    scala> f(Left(false))
    res0: String = false is a boolean
    Definition Classes
    ArrowChoiceChoice
  9. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  10. def codiagonal[A]: F[Either[A, A], A]

    An F that, given a source A on either the right or left side, will return that same A object.

    An F that, given a source A on either the right or left side, will return that same A object.

    Example:

    scala> import cats.implicits._
    scala> val f: (Either[Int, Int]) => Int = Choice[Function1].codiagonal[Int]
    
    scala> f(Right(3))
    res0: Int = 3
    
    scala> f(Left(3))
    res1: Int = 3
    Definition Classes
    Choice
  11. def dimap[A, B, C, D](fab: F[A, B])(f: (C) ⇒ A)(g: (B) ⇒ D): F[C, D]

    Contramap on the first type parameter and map on the second type parameter

    Contramap on the first type parameter and map on the second type parameter

    Example:

    scala> import cats.implicits._
    scala> import cats.arrow.Profunctor
    scala> val fab: Double => Double = x => x + 0.3
    scala> val f: Int => Double = x => x.toDouble / 2
    scala> val g: Double => Double = x => x * 3
    scala> val h = Profunctor[Function1].dimap(fab)(f)(g)
    scala> h(3)
    res0: Double = 5.4
    Definition Classes
    ArrowProfunctor
  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  14. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  17. def id[A]: F[A, A]
    Definition Classes
    ArrowCategory
  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. def left[A, B, C](fab: F[A, B]): F[Either[A, C], Either[B, C]]
  20. def lmap[A, B, C](fab: F[A, B])(f: (C) ⇒ A): F[C, B]

    contramap on the first type parameter

    contramap on the first type parameter

    Definition Classes
    Profunctor
  21. def merge[A, B, C](f: F[A, B], g: F[A, C]): F[A, (B, C)]

    Create a new computation F that merge outputs of f and g both having the same input

    Create a new computation F that merge outputs of f and g both having the same input

    Example:

    scala> import cats.implicits._
    scala> val addEmpty: Int => Int = _ + 0
    scala> val multiplyEmpty: Int => Double= _ * 1d
    scala> val f: Int => (Int, Double) = addEmpty &&& multiplyEmpty
    scala> f(1)
    res0: (Int, Double) = (1,1.0)

    Note that the arrow laws do not guarantee the non-interference between the _effects_ of f and g in the context of F. This means that f &&& g may not be equivalent to g &&& f.

    Definition Classes
    Arrow
    Annotations
    @op( "&&&" , true )
  22. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  24. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  25. def right[A, B, C](fab: F[A, B]): F[Either[C, A], Either[C, B]]
  26. def rmap[A, B, C](fab: F[A, B])(f: (B) ⇒ C): F[A, C]

    map on the second type parameter

    map on the second type parameter

    Definition Classes
    Profunctor
  27. def second[A, B, C](fa: F[A, B]): F[(C, A), (C, B)]

    Create a new F that takes two inputs, but only modifies the second input

    Create a new F that takes two inputs, but only modifies the second input

    Example:

    scala> import cats.implicits._
    scala> import cats.arrow.Strong
    scala> val f: Int => Int = _ * 2
    scala> val fab = Strong[Function1].second[Int,Int,Int](f)
    scala> fab((2,3))
    res0: (Int, Int) = (2,6)
    Definition Classes
    ArrowStrong
  28. def split[A, B, C, D](f: F[A, B], g: F[C, D]): F[(A, C), (B, D)]

    Create a new computation F that splits its input between f and g and combines the output of each.

    Create a new computation F that splits its input between f and g and combines the output of each.

    Example:

    scala> import cats.implicits._
    scala> import cats.arrow.Arrow
    scala> val toLong: Int => Long = _.toLong
    scala> val toDouble: Float => Double = _.toDouble
    scala> val f: ((Int, Float)) => (Long, Double) = Arrow[Function1].split(toLong, toDouble)
    scala> f((3, 4.0f))
    res0: (Long, Double) = (3,4.0)

    Note that the arrow laws do not guarantee the non-interference between the _effects_ of f and g in the context of F. This means that f *** g may not be equivalent to g *** f.

    Definition Classes
    Arrow
    Annotations
    @op( "***" , true )
  29. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  30. def toString(): String
    Definition Classes
    AnyRef → Any
  31. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from Choice[F]

Inherited from Arrow[F]

Inherited from Strong[F]

Inherited from Profunctor[F]

Inherited from Category[F]

Inherited from Compose[F]

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped