trait FunctionK[F[_], G[_]] extends Serializable
FunctionK[F[_], G[_]]
is a functor transformation from F
to G
in the same manner that function A => B
is a morphism from values
of type A
to B
.
An easy way to create a FunctionK instance is to use the Polymorphic
lambdas provided by typelevel/kind-projector v0.9+. E.g.
val listToOption = λ[FunctionK[List, Option]](_.headOption)
- Self Type
- FunctionK[F, G]
- Source
- FunctionK.scala
- Alphabetic
- By Inheritance
- FunctionK
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
apply[A](fa: F[A]): G[A]
Applies this functor transformation from
F
toG
Concrete 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
and[H[_]](h: FunctionK[F, H]): FunctionK[F, [γ$2$]Tuple2K[G, H, γ$2$]]
Composes two instances of
FunctionK
into a newFunctionK
that transforms one single functor to a cats.data.Tuple2K of two functors.Composes two instances of
FunctionK
into a newFunctionK
that transforms one single functor to a cats.data.Tuple2K of two functors.scala> import cats.arrow.FunctionK scala> val list2option = λ[FunctionK[List, Option]](_.headOption) scala> val list2vector = λ[FunctionK[List, Vector]](_.toVector) scala> val optionAndVector = list2option and list2vector scala> optionAndVector(List(1,2,3)) res0: cats.data.Tuple2K[Option,Vector,Int] = Tuple2K(Some(1),Vector(1, 2, 3))
-
def
andThen[H[_]](f: FunctionK[G, H]): FunctionK[F, H]
Composes two instances of FunctionK into a new FunctionK with this transformation applied first.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @IntrinsicCandidate()
-
def
compose[E[_]](f: FunctionK[E, F]): FunctionK[E, G]
Composes two instances of FunctionK into a new FunctionK with this transformation applied last.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
narrow[F0[x] <: F[x]]: FunctionK[F0, G]
Narrows the input type of this
FunctionK
fromF
toF0
-
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()
-
def
or[H[_]](h: FunctionK[H, G]): FunctionK[[γ$0$]EitherK[F, H, γ$0$], G]
Composes two instances of FunctionK into a new FunctionK that transforms a cats.data.EitherK to a single functor.
Composes two instances of FunctionK into a new FunctionK that transforms a cats.data.EitherK to a single functor.
This transformation will be used to transform left
F
values whileh
will be used to transform rightH
values. -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
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( ... )
-
def
widen[G0[x] >: G[x]]: FunctionK[F, G0]
Widens the output type of this
FunctionK
fromG
toG0