OrderPreservingSemigroup

Semigroup whose operation preserves the Order:

∀ a,b,c: (a ≤ b) → (a⊕c ≤ b⊕c) (a ≤ b) → (c⊕a ≤ c⊕b)

See also:
Companion:
object
trait Order[A]
trait Equal[A]
trait Semigroup[A]
class Object
trait Matchable
class Any

Type members

Inherited classlikes

trait EqualLaw
Inherited from:
Equal
trait OrderLaw extends EqualLaw
Inherited from:
Order

A semigroup in type F must satisfy two laws:

A semigroup in type F must satisfy two laws:

  • '''closure''': ∀ a, b in F, append(a, b) is also in F. This is enforced by the type system.
  • '''associativity''': ∀ a, b, c in F, the equation append(append(a, b), c) = append(a, append(b , c)) holds.
Inherited from:
Semigroup

Value members

Inherited methods

def append(f1: A, f2: => A): A

The binary operation to combine f1 and f2.

The binary operation to combine f1 and f2.

Implementations should not evaluate the by-name parameter f2 if result can be determined by f1.

Inherited from:
Semigroup
def apply(x: A, y: A): Ordering
Inherited from:
Order
final def apply: Apply[[α] =>> A]

An scalaz.Apply, that implements ap with append. Note that the type parameter α in Apply[λ[α => F]] is discarded; it is a phantom type. As such, the functor cannot support scalaz.Bind.

An scalaz.Apply, that implements ap with append. Note that the type parameter α in Apply[λ[α => F]] is discarded; it is a phantom type. As such, the functor cannot support scalaz.Bind.

Inherited from:
Semigroup
final def compose: Compose[[α, β] =>> A]

Every Semigroup gives rise to a scalaz.Compose, for which the type parameters are phantoms.

Every Semigroup gives rise to a scalaz.Compose, for which the type parameters are phantoms.

Note:

compose.semigroup = this

Inherited from:
Semigroup
override def contramap[B](f: B => A): Order[B]
Definition Classes
Order -> Equal
Inherited from:
Order
def equal(x: A, y: A): Boolean
Inherited from:
Order
def equalIsNatural: Boolean
Returns:

true, if equal(f1, f2) is known to be equivalent to f1 == f2

Inherited from:
Equal
Inherited from:
Equal
def greaterThan(x: A, y: A): Boolean
Inherited from:
Order
def greaterThanOrEqual(x: A, y: A): Boolean
Inherited from:
Order
def lessThan(x: A, y: A): Boolean
Inherited from:
Order
def lessThanOrEqual(x: A, y: A): Boolean
Inherited from:
Order
def max(x: A, y: A): A
Inherited from:
Order
def min(x: A, y: A): A
Inherited from:
Order
def multiply1(value: A, n: Int): A

For n = 0, value For n = 1, append(value, value) For n = 2, append(append(value, value), value)

For n = 0, value For n = 1, append(value, value) For n = 2, append(append(value, value), value)

The default definition uses peasant multiplication, exploiting associativity to only require O(log n) uses of append

Inherited from:
Semigroup
def order(x: A, y: A): Ordering
Inherited from:
Order
Inherited from:
Order
def reverseOrder: Order[A]
Inherited from:
Order
Inherited from:
Semigroup
def sort(x: A, y: A): (A, A)
Inherited from:
Order
def toScalaOrdering: Ordering[A]
Note:

Order.fromScalaOrdering(toScalaOrdering).order(x, y) = this.order(x, y)

Inherited from:
Order
def unfoldlSumOpt[S](seed: S)(f: S => Maybe[(S, A)]): Maybe[A]

Unfold seed to the left and sum using append. Semigroups with right absorbing elements may override this method to not unfold more than is necessary to determine the result.

Unfold seed to the left and sum using append. Semigroups with right absorbing elements may override this method to not unfold more than is necessary to determine the result.

Inherited from:
Semigroup
def unfoldrSumOpt[S](seed: S)(f: S => Maybe[(A, S)]): Maybe[A]

Unfold seed to the right and sum using append. Semigroups with left absorbing elements may override this method to not unfold more than is necessary to determine the result.

Unfold seed to the right and sum using append. Semigroups with left absorbing elements may override this method to not unfold more than is necessary to determine the result.

Inherited from:
Semigroup

Inherited fields

val equalSyntax: EqualSyntax[A]
Inherited from:
Equal
val orderSyntax: OrderSyntax[A]
Inherited from:
Order
val semigroupSyntax: SemigroupSyntax[A]
Inherited from:
Semigroup