Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- type Free f = (Representable f, Eq (Rep f))
- type Basis b f = (Free f, Rep f ~ b)
- type Basis2 b c f g = (Basis b f, Basis c g)
- type Basis3 b c d f g h = (Basis b f, Basis c g, Basis d h)
- type FreeModule a f = (Free f, Bimodule a a (f a))
- type FreeSemimodule a f = (Free f, Bisemimodule a a (f a))
- type LeftModule l a = (Ring l, (Additive - Group) a, LeftSemimodule l a)
- class (Semiring l, (Additive - Monoid) a) => LeftSemimodule l a where
- lscale :: l -> a -> a
- lscaleDef :: Semiring a => Functor f => a -> f a -> f a
- negateDef :: LeftModule Integer a => a -> a
- lerp :: LeftModule r a => r -> a -> a -> a
- (*.) :: LeftSemimodule l a => l -> a -> a
- (/.) :: Semifield a => Functor f => a -> f a -> f a
- (\.) :: Semifield a => Functor f => a -> f a -> f a
- type RightModule r a = (Ring r, (Additive - Group) a, RightSemimodule r a)
- class (Semiring r, (Additive - Monoid) a) => RightSemimodule r a where
- rscale :: r -> a -> a
- rscaleDef :: Semiring a => Functor f => a -> f a -> f a
- (.*) :: RightSemimodule r a => a -> r -> a
- (./) :: Semifield a => Functor f => f a -> a -> f a
- (.\) :: Semifield a => Functor f => f a -> a -> f a
- type Bimodule l r a = (LeftModule l a, RightModule r a, Bisemimodule l r a)
- class (LeftSemimodule l a, RightSemimodule r a) => Bisemimodule l r a where
- discale :: l -> r -> a -> a
Types
type FreeModule a f = (Free f, Bimodule a a (f a)) Source #
type FreeSemimodule a f = (Free f, Bisemimodule a a (f a)) Source #
Left modules
type LeftModule l a = (Ring l, (Additive - Group) a, LeftSemimodule l a) Source #
class (Semiring l, (Additive - Monoid) a) => LeftSemimodule l a where Source #
Left semimodule over a commutative semiring.
All instances must satisfy the following identities:
lscale
s (x+
y) =lscale
s x+
lscale
s ylscale
(s1+
s2) x =lscale
s1 x+
lscale
s2 xlscale
(s1*
s2) =lscale
s1 .lscale
s2lscale
zero
=zero
When the ring of coefficients s is unital we must additionally have:
lscale
one
= id
See the properties module for a detailed specification of the laws.
Instances
lscaleDef :: Semiring a => Functor f => a -> f a -> f a Source #
Default definition of lscale
for a free module.
negateDef :: LeftModule Integer a => a -> a Source #
Default definition of <<
for a commutative group.
lerp :: LeftModule r a => r -> a -> a -> a Source #
Linearly interpolate between two vectors.
>>>
u = V3 (1 :% 1) (2 :% 1) (3 :% 1) :: V3 Rational
>>>
v = V3 (2 :% 1) (4 :% 1) (6 :% 1) :: V3 Rational
>>>
r = 1 :% 2 :: Rational
>>>
lerp r u v
V3 (6 % 4) (12 % 4) (18 % 4)
(*.) :: LeftSemimodule l a => l -> a -> a infixr 7 Source #
Right modules
type RightModule r a = (Ring r, (Additive - Group) a, RightSemimodule r a) Source #
class (Semiring r, (Additive - Monoid) a) => RightSemimodule r a where Source #
Right semimodule over a commutative semiring.
The laws for right semimodules are analagous to those of left semimodules.
See the properties module for a detailed specification.
Instances
rscaleDef :: Semiring a => Functor f => a -> f a -> f a Source #
Default definition of rscale
for a free module.
(.*) :: RightSemimodule r a => a -> r -> a infixl 7 Source #
Bimodules
type Bimodule l r a = (LeftModule l a, RightModule r a, Bisemimodule l r a) Source #
class (LeftSemimodule l a, RightSemimodule r a) => Bisemimodule l r a where Source #
Bisemimodule over a commutative semiring.
lscale
l .rscale
r =rscale
r .lscale
l
Nothing