Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Algebra for Actions
Convention: the |'s in the operators point towards the higher-kinded number, representing an operator or action into a structure.
Synopsis
- class Additive (AdditiveScalar m) => AdditiveAction m where
- type AdditiveScalar m :: Type
- (|+) :: m -> AdditiveScalar m -> m
- (+|) :: AdditiveAction m => AdditiveScalar m -> m -> m
- class (AdditiveAction m, Subtractive (AdditiveScalar m)) => SubtractiveAction m where
- (|-) :: m -> AdditiveScalar m -> m
- (-|) :: (AdditiveAction m, Subtractive m) => AdditiveScalar m -> m -> m
- class Multiplicative (Scalar m) => MultiplicativeAction m where
- (*|) :: MultiplicativeAction m => Scalar m -> m -> m
- class (Divisive (Scalar m), MultiplicativeAction m) => DivisiveAction m where
- (/|) :: (MultiplicativeAction m, Divisive m) => Scalar m -> m -> m
- type Module m = (Distributive (Scalar m), MultiplicativeAction m)
Documentation
class Additive (AdditiveScalar m) => AdditiveAction m where Source #
Additive Action
m |+ zero == m
type AdditiveScalar m :: Type Source #
(|+) :: m -> AdditiveScalar m -> m infixl 6 Source #
(+|) :: AdditiveAction m => AdditiveScalar m -> m -> m infixl 6 Source #
flipped additive action
(+|) == flip (|+) zero +| m = m
class (AdditiveAction m, Subtractive (AdditiveScalar m)) => SubtractiveAction m where Source #
Subtractive Action
m |- zero = m
(|-) :: m -> AdditiveScalar m -> m infixl 6 Source #
(-|) :: (AdditiveAction m, Subtractive m) => AdditiveScalar m -> m -> m infixl 6 Source #
Subtraction with the scalar on the left
(-|) == (+|) . negate zero -| m = negate m
class Multiplicative (Scalar m) => MultiplicativeAction m where Source #
Multiplicative Action
m |* one = m m |* zero = zero
Instances
Multiplicative a => MultiplicativeAction (EuclideanPair a) Source # | |
Defined in NumHask.Algebra.Metric type Scalar (EuclideanPair a) Source # (|*) :: EuclideanPair a -> Scalar (EuclideanPair a) -> EuclideanPair a Source # |
(*|) :: MultiplicativeAction m => Scalar m -> m -> m infixl 7 Source #
flipped multiplicative action
(*|) == flip (|*) one *| m = one zero *| m = zero
class (Divisive (Scalar m), MultiplicativeAction m) => DivisiveAction m where Source #
Divisive Action
m |/ one = m
Instances
Divisive a => DivisiveAction (EuclideanPair a) Source # | |
Defined in NumHask.Algebra.Metric (|/) :: EuclideanPair a -> Scalar (EuclideanPair a) -> EuclideanPair a Source # |
(/|) :: (MultiplicativeAction m, Divisive m) => Scalar m -> m -> m Source #
left scalar division
(/|) == (*|) . recip one |/ m = recip m
type Module m = (Distributive (Scalar m), MultiplicativeAction m) Source #
A Module
a *| one == a (a + b) *| c == (a *| c) + (b *| c) c |* (a + b) == (c |* a) + (c |* b) a *| zero == zero a *| b == b |* a