trait MonoidK[F[_]] extends SemigroupK[F] with Serializable
MonoidK is a universal monoid which operates on kinds.
This type class is useful when its type parameter F[_] has a structure that can be combined for any particular type, and which also has an "empty" representation. Thus, MonoidK is like a Monoid for kinds (i.e. parametrized types).
A MonoidK[F] can produce a Monoid[F[A]] for any type A.
Here's how to distinguish Monoid and MonoidK:
- Monoid[A] allows A values to be combined, and also means there is an "empty" A value that functions as an identity.
- MonoidK[F] allows two F[A] values to be combined, for any A. It also means that for any A, there is an "empty" F[A] value. The combination operation and empty value just depend on the structure of F, but not on the structure of A.
- Self Type
- MonoidK[F]
- Alphabetic
- By Inheritance
- MonoidK
- SemigroupK
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
combineK[A](x: F[A], y: F[A]): F[A]
Combine two F[A] values.
Combine two F[A] values.
Example:
scala> import cats.implicits._ scala> SemigroupK[List].combineK(List(1, 2), List(3, 4)) res0: List[Int] = List(1, 2, 3, 4)
- Definition Classes
- SemigroupK
- Annotations
- @op( "<+>" , true )
-
abstract
def
empty[A]: F[A]
Given a type A, create an "empty" F[A] value.
Given a type A, create an "empty" F[A] value.
Example:
scala> import cats.implicits._ scala> MonoidK[List].empty[Long] res0: List[Long] = List()
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
algebra[A]: Monoid[F[A]]
Given a type A, create a concrete Monoid[F[A]].
Given a type A, create a concrete Monoid[F[A]].
- Definition Classes
- MonoidK → SemigroupK
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
compose[G[_]]: MonoidK[[α]F[G[α]]]
"Compose" with a
G[_]
type to form aSemigroupK
forλ[α => F[G[α]]]
."Compose" with a
G[_]
type to form aSemigroupK
forλ[α => F[G[α]]]
. Note that this universally works for anyG
, because the "inner" structure isn't considered when combining two instances.Example:
scala> import cats.implicits._ scala> type ListOption[A] = List[Option[A]] scala> val s: SemigroupK[ListOption] = SemigroupK[List].compose[Option] scala> s.combineK(List(Some(1), None, Some(2)), List(Some(3), None)) res0: List[Option[Int]] = List(Some(1), None, Some(2), Some(3), None)
- Definition Classes
- MonoidK → SemigroupK
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
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()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )