Packages

trait SemigroupK[F[_]] extends Serializable

SemigroupK is a universal semigroup 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. Thus, SemigroupK is like a Semigroup for kinds (i.e. parametrized types).

A SemigroupK[F] can produce a Semigroup[F[A]] for any type A.

Here's how to distinguish Semigroup and SemigroupK:

  • Semigroup[A] allows two A values to be combined.
  • SemigroupK[F] allows two F[A] values to be combined, for any A. The combination operation just depends on the structure of F, but not the structure of A.
Self Type
SemigroupK[F]
Annotations
@implicitNotFound( ... ) @typeclass( ... , ... )
Linear Supertypes
Serializable, Serializable, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SemigroupK
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. 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)
    Annotations
    @op( "<+>" , true )

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]: Semigroup[F[A]]

    Given a type A, create a concrete Semigroup[F[A]].

    Given a type A, create a concrete Semigroup[F[A]].

    Example:

    scala> import cats.implicits._
    scala> val s: Semigroup[List[Int]] = SemigroupK[List].algebra[Int]
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  7. def compose[G[_]]: SemigroupK[[α]F[G[α]]]

    "Compose" with a G[_] type to form a SemigroupK for λ[α => F[G[α]]].

    "Compose" with a G[_] type to form a SemigroupK for λ[α => F[G[α]]]. Note that this universally works for any G, 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)
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  16. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  17. def sum[A, B](fa: F[A], fb: F[B])(implicit F: Functor[F]): F[Either[A, B]]

    Combines F[A] and F[B] into a F[Either[A,B]]].

    Combines F[A] and F[B] into a F[Either[A,B]]].

    Example:

    scala> import cats.SemigroupK
    scala> import cats.data.NonEmptyList
    scala> SemigroupK[NonEmptyList].sum(NonEmptyList.one("abc"), NonEmptyList.one(2))
    res0: NonEmptyList[Either[String,Int]] = NonEmptyList(Left(abc), Right(2))
  18. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  19. def toString(): String
    Definition Classes
    AnyRef → Any
  20. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped