Algebra
Algebraic structures.
Kex traits do not inherit from one another, so concrete types explicitly implement every structure whose laws they satisfy.
type Ordering
The result of Comparable.compare. Declared here rather than only inside the interpreter so that Ordering, Less, Equal and Greater reach the semantic layer the same way every other stdlib type does — through the collected interfaces — instead of existing solely as native environment bindings the type checker and name resolver cannot see.
Variants
LessEqualGreater
Implements Monoid.
Methods
Ordering is a Monoid under "first decision wins", with Equal as identity. That is what makes multi-key comparison compose instead of nesting ifs:
a.name.compare(b.name).combine(a.age.compare(b.age))
combine evaluates its argument eagerly, so the later comparison runs even when the earlier one already decided. Use thenBy when that matters.
From Monoid
repeat- Combines this value with itself
ntimes.
trait Comparable
Implemented by Number.
Required methods
An implementor writes these.
extends Number
More methods of Number, added by this module.
Implements Comparable.
Number carries the implementation, so Integer and Float both inherit it rather than repeating the same three comparisons. Mixed receivers work because < and > promote across the two (1.compare(1.0) is Equal).
compare Comparable
compare(other: Number) -> Ordering
trait Monoid
Implemented by Integer, String, [A], Ordering, Map<K, V>.
Required methods
An implementor writes these.
combine
combine : This -> This
Provided methods
Every implementor gets these, written in terms of the required methods.
trait Group
Implemented by Integer.
Required methods
An implementor writes these.
extends Integer
More methods of Integer, added by this module.
type String
Implements Monoid, Blankable, Truthyable.
From Monoid
repeat- Combines this value with itself
ntimes.
Defined in other modules
extends [A]
More methods of List, added by this module.
Implements Monoid.