sealed class :+:[M, N] extends AnyRef
The coproduct (or free product) of monoids M
and N
.
Conceptually this is an alternating list of M
and N
values, with
the identity as the empty list, and composition as list concatenation that
combines adjacent elements when possible.
- Source
- MonoidCoproduct.scala
- Alphabetic
- By Inheritance
- :+:
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
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 appendLeft(m: M)(implicit M: Monoid[M], N: Monoid[N]): :+:[M, N]
Append a value from the left monoid
- def appendRight(n: N)(implicit M: Monoid[M], N: Monoid[N]): :+:[M, N]
Append a value from the right monoid
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def both[A >: M, B >: N](implicit arg0: Monoid[A], arg1: Monoid[B]): (A, B)
Project out both monoids individually
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def fold[Z](f: (M) => Z, g: (N) => Z)(implicit arg0: Monoid[Z]): Z
A homomorphism to a monoid
Z
(iff
andg
are homomorphisms). - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def left[A >: M](implicit arg0: Monoid[A]): A
Project out the value in the left monoid
- 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 prependLeft(m: M)(implicit M: Monoid[M], N: Monoid[N]): :+:[M, N]
Prepend a value from the left monoid
- def prependRight(n: N)(implicit M: Monoid[M], N: Monoid[N]): :+:[M, N]
Prepend a value from the right monoid
- def right[A >: N](implicit arg0: Monoid[A]): A
Project out the value in the right monoid
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def untangle[A >: M, B >: N](f: (B, A) => A, g: (A, B) => B)(implicit arg0: Monoid[A], arg1: Monoid[B]): (A, B)
Take a value from the coproduct monoid where each monoid acts on the other, and untangle into a pair of values.
Take a value from the coproduct monoid where each monoid acts on the other, and untangle into a pair of values. Before being folded into the answer an
N
value is combined with the sum of theM
values to its left viag
and anM
value is combined with the sum of theN
values to its left viaf
. This allows you to add upN
values while having the opportunity to "track" an evolvingM
value, and vice versa. - def untangleLeft[A >: M, B >: N](f: (A, B) => B)(implicit arg0: Monoid[A], arg1: Monoid[B]): (A, B)
Like
untangle
, exceptM
values are simply combined without regard to theN
values to the left of it. - def untangleRight[A >: M, B >: N](f: (B, A) => A)(implicit arg0: Monoid[A], arg1: Monoid[B]): (A, B)
Like
untangle
, exceptN
values are simply combined without regard to theN
values to the left of it. - 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()
- def |+|(m: :+:[M, N])(implicit M: Monoid[M], N: Monoid[N]): :+:[M, N]
The associative operation of the monoid coproduct