Packages

p

org.scalactic

algebra

package algebra

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. All

Type Members

  1. trait Applicative [Context[_]] extends Functor[Context]

    Typeclass trait representing an algebraic structure that is a Functor[Context] (i.e., it declares a map method that obeys the functor laws) augmented by insert and applying methods that obey laws of homomorphism and interchange.

    Typeclass trait representing an algebraic structure that is a Functor[Context] (i.e., it declares a map method that obeys the functor laws) augmented by insert and applying methods that obey laws of homomorphism and interchange.

    The homomorphism law states that given a value, a, of type A and a function, f, of type A => B (and implicit Applicative.adapters imported):

    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 type A and a function, cf, of type Context[A => B] (and implicit Applicative.adapters imported):

    val ca = applicative.insert(a)
    val cg = applicative.insert((f: A => B) => f(a))
    ca.applying(cf) === cf.applying(cg)
    

  2. 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, and c of type A (and implicit Associative.adapters imported):

    ((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.

  3. 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)
    

  4. trait Distributive [A] extends AnyRef

    Typeclass trait representing two binary operations that obeys the distributive law: one, dcombine that does the distributing, and the other combine binary combine that dcombine is applied to.

    Typeclass trait representing two binary operations that obeys the distributive law: one, dcombine that does the distributing, and the other combine binary combine that dcombine is applied to.

    The distributive law states that given values a, b, c

    a dcombine (b combine c) === (a dcombine b) combine (a dcombine c)
    

  5. trait Functor [Context[_]] extends AnyRef

    Typeclass trait representing an algebraic structure defined by a map method that obeys laws of identity and composition.

    Typeclass trait representing an algebraic structure defined by a map method that obeys laws of identity and composition.

    The identity law states that given a value ca of type Context[A] and the identity function, (a: A) => a (and implicit Functor.adapters imported):

    ca.map((a: A) => a) === ca
    

    The composition law states that given a value ca of type Context[A] and two functions, f of type A => B and g of type B => C (and implicit Functor.adapters imported):

    ca.map(f).map(g) === ca.map(g compose f)
    

  6. 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 Monad instance wraps an object that in some way behaves as a Monad.

  7. 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, and c of type A (and implicit Monoid.adapters imported):

    ((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 type A (and implicit Monoid.adapters imported):

    (z combine a) === a
    

    An similarly, the right identity law states that given the same values and implicit:

    (a combine z) === a
    

Value Members

  1. object Applicative

    Companion object for trait Applicative.

  2. object Associative

    Companion object for Associative.

    Companion object for Associative. an implicit conversion method from A to Associative.Adapter[A]

  3. object Commutative

    Companion object for Commutative.

    Companion object for Commutative. an implicit conversion method from A to Commutative.Adapter[A]

  4. object Distributive

    Companion object for Distributive.

    Companion object for Distributive. an implicit conversion method from A to Distributive.Adapter[A]

  5. object Functor

    Companion object for trait Functor.

  6. object Monad

    Companion object for Monad typeclass.

  7. object Monoid

    Companion object for trait Monoid.

Ungrouped