package algebra
- Alphabetic
- Public
- All
Type Members
-
trait
Applicative
[Context[_]] extends Functor[Context]
Typeclass trait representing an algebraic structure that is a
Functor[Context](i.e., it declares amapmethod that obeys the functor laws) augmented byinsertandapplyingmethods that obey laws of homomorphism and interchange.Typeclass trait representing an algebraic structure that is a
Functor[Context](i.e., it declares amapmethod that obeys the functor laws) augmented byinsertandapplyingmethods that obey laws of homomorphism and interchange.The homomorphism law states that given a value,
a, of typeAand a function,f, of typeA => B(and implicitApplicative.adaptersimported):val ca = applicative.insert(a) val cf = applicative.insert(f) ca.applying(cf) === applicative.insert(f(a))
The interchange law states that given a value,
a, of typeAand a function,cf, of typeContext[A => B](and implicitApplicative.adaptersimported):val ca = applicative.insert(a) val cg = applicative.insert((f: A => B) => f(a)) ca.applying(cf) === cf.applying(cg)
-
trait
Associative
[A] extends AnyRef
Typeclass trait representing a binary operation that obeys the associative law.
Typeclass trait representing a binary operation that obeys the associative law.
The associative law states that given values
a,b, andcof typeA(and implicitAssociative.adaptersimported):((a combine b) combine c) === (a combine (b combine c))
Note: In mathematics, the algebraic structure consisting of a set along with an associative binary operation is known as a semigroup.
-
trait
Commutative
[A] extends AnyRef
Typeclass trait representing a binary operation that obeys the commutative law.
Typeclass trait representing a binary operation that obeys the commutative law.
The commutative law states that changing the order of the operands to a binary operation does not change the result, i.e. given values
a,b(a combine b) === (b combine a)
-
trait
Distributive
[A] extends AnyRef
Typeclass trait representing two binary operations that obeys the distributive law: one,
dcombinethat does the distributing, and the othercombinebinary combine that dcombine is applied to.Typeclass trait representing two binary operations that obeys the distributive law: one,
dcombinethat does the distributing, and the othercombinebinary combine that dcombine is applied to.The distributive law states that given values
a,b,ca dcombine (b combine c) === (a dcombine b) combine (a dcombine c)
-
trait
Functor
[Context[_]] extends AnyRef
Typeclass trait representing an algebraic structure defined by a
mapmethod that obeys laws of identity and composition.Typeclass trait representing an algebraic structure defined by a
mapmethod that obeys laws of identity and composition.The identity law states that given a value
caof typeContext[A]and the identity function,(a: A) => a(and implicitFunctor.adaptersimported):ca.map((a: A) => a) === ca
The composition law states that given a value
caof typeContext[A]and two functions,fof typeA => Bandgof typeB => C(and implicitFunctor.adaptersimported):ca.map(f).map(g) === ca.map(g compose f)
-
trait
Monad
[Context[_]] extends Applicative[Context]
Typeclass trait for algebraic structure containing insertion and flat-mapping methods that obey laws of identity and associativity.
Typeclass trait for algebraic structure containing insertion and flat-mapping methods that obey laws of identity and associativity.
A
Monadinstance wraps an object that in some way behaves as aMonad. -
trait
Monoid
[A] extends Associative[A]
Typeclass trait representing a binary operation that obeys the associative law and an identity element that obeys the left and right identity laws.
Typeclass trait representing a binary operation that obeys the associative law and an identity element that obeys the left and right identity laws.
The associative law states that given values
a,b, andcof typeA(and implicitMonoid.adaptersimported):((a combine b) combine c) === (a combine (b combine c))
The left identity law states that given the identity value,
z, and any other value,a, of typeA(and implicitMonoid.adaptersimported):(z combine a) === a
An similarly, the right identity law states that given the same values and implicit:
(a combine z) === a
Value Members
-
object
Applicative
Companion object for trait
Applicative. -
object
Associative
Companion object for
Associative.Companion object for
Associative. an implicit conversion method fromAtoAssociative.Adapter[A] -
object
Commutative
Companion object for
Commutative.Companion object for
Commutative. an implicit conversion method fromAtoCommutative.Adapter[A] -
object
Distributive
Companion object for
Distributive.Companion object for
Distributive. an implicit conversion method fromAtoDistributive.Adapter[A] -
object
Functor
Companion object for trait
Functor. -
object
Monad
Companion object for
Monadtypeclass. -
object
Monoid
Companion object for trait
Monoid.