Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- 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
- (*.) :: LeftSemimodule l a => l -> a -> a
- (/.) :: Semifield a => Functor f => a -> f a -> f a
- (\.) :: Semifield a => Functor f => a -> f a -> f a
- lerp :: LeftModule r a => r -> a -> a -> a
- lscaleDef :: Semiring a => Functor f => a -> f a -> f a
- negateDef :: LeftModule Integer a => a -> 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
- (.*) :: RightSemimodule r a => a -> r -> a
- (./) :: Semifield a => Functor f => f a -> a -> f a
- (.\) :: Semifield a => Functor f => f a -> a -> f a
- rscaleDef :: Semiring a => Functor f => a -> f a -> f a
- type Bimodule l r a = (LeftModule l a, RightModule r a, Bisemimodule l r a)
- type FreeModule a f = (Free f, (Additive - Group) (f a), Bimodule a a (f a))
- type FreeSemimodule a f = (Free f, Bisemimodule a a (f a))
- class (LeftSemimodule l a, RightSemimodule r a) => Bisemimodule l r a where
- discale :: l -> r -> a -> a
- type FreeAlgebra a f = (FreeSemimodule a f, Algebra a (Rep f))
- class Semiring a => Algebra a b where
- joined :: (b -> b -> a) -> b -> a
- type FreeUnital a f = (FreeAlgebra a f, Unital a (Rep f))
- class Algebra a b => Unital a b where
- unital :: a -> b -> a
- type FreeCoalgebra a f = (FreeSemimodule a f, Coalgebra a (Rep f))
- class Semiring a => Coalgebra a c where
- cojoined :: (c -> a) -> c -> c -> a
- type FreeCounital a f = (FreeCoalgebra a f, Counital a (Rep f))
- class Coalgebra a c => Counital a c where
- counital :: (c -> a) -> a
- type FreeBialgebra a f = (FreeAlgebra a f, FreeCoalgebra a f, Bialgebra a (Rep f))
- class (Unital a b, Counital a b) => Bialgebra a b
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
(*.) :: LeftSemimodule l a => l -> a -> a infixr 7 Source #
Left-multiply a module element by a scalar.
(/.) :: Semifield a => Functor f => a -> f a -> f a infixr 7 Source #
Right-divide a vector by a scalar (on the left).
(\.) :: Semifield a => Functor f => a -> f a -> f a infixr 7 Source #
Left-divide a vector by a scalar.
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)
lscaleDef :: Semiring a => Functor f => a -> f a -> f a infixr 7 Source #
Default definition of lscale
for a free module.
negateDef :: LeftModule Integer a => a -> a Source #
Default definition of <<
for a commutative group.
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
(.*) :: RightSemimodule r a => a -> r -> a infixl 7 Source #
Right-multiply a module element by a scalar.
(./) :: Semifield a => Functor f => f a -> a -> f a infixl 7 Source #
Right-divide a vector by a scalar.
(.\) :: Semifield a => Functor f => f a -> a -> f a infixl 7 Source #
Left-divide a vector by a scalar (on the right).
rscaleDef :: Semiring a => Functor f => a -> f a -> f a infixl 7 Source #
Default definition of rscale
for a free module.
Bimodules
type Bimodule l r a = (LeftModule l a, RightModule r a, Bisemimodule l r a) Source #
type FreeSemimodule a f = (Free f, Bisemimodule a a (f 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
Instances
Algebras
type FreeAlgebra a f = (FreeSemimodule a f, Algebra a (Rep f)) Source #
An algebra over a free module f.
Note that this is distinct from a free algebra.
class Semiring a => Algebra a b where Source #
An algebra over a semiring.
Note that the algebra needn't be associative.
Instances
Semiring a => Algebra a IntSet Source # | |
Semiring a => Algebra a () Source # | |
Defined in Data.Semimodule | |
Semiring r => Algebra r E4 Source # | |
Semiring r => Algebra r E3 Source # | |
Semiring r => Algebra r E2 Source # | |
Semiring r => Algebra r E1 Source # | |
(Semiring a, Ord b) => Algebra a (Set b) Source # | |
Semiring a => Algebra a (Seq b) Source # | |
Semiring a => Algebra a [b] Source # | Tensor algebra on b.
|
Defined in Data.Semimodule | |
(Algebra a b1, Algebra a b2) => Algebra a (b1, b2) Source # | |
Defined in Data.Semimodule | |
(Algebra a b1, Algebra a b2, Algebra a b3) => Algebra a (b1, b2, b3) Source # | |
Defined in Data.Semimodule |
Unital algebras
type FreeUnital a f = (FreeAlgebra a f, Unital a (Rep f)) Source #
A unital algebra over a free semimodule f.
class Algebra a b => Unital a b where Source #
A unital algebra over a semiring.
Instances
Semiring a => Unital a IntSet Source # | |
Defined in Data.Semimodule | |
Semiring a => Unital a () Source # | |
Defined in Data.Semimodule | |
Semiring r => Unital r E4 Source # | |
Defined in Data.Semimodule.Basis | |
Semiring r => Unital r E3 Source # | |
Defined in Data.Semimodule.Basis | |
Semiring r => Unital r E2 Source # | |
Defined in Data.Semimodule.Basis | |
Semiring r => Unital r E1 Source # | |
Defined in Data.Semimodule.Basis | |
(Semiring a, Ord b) => Unital a (Set b) Source # | |
Defined in Data.Semimodule | |
Semiring a => Unital a (Seq b) Source # | |
Defined in Data.Semimodule | |
Semiring a => Unital a [b] Source # | |
Defined in Data.Semimodule | |
(Unital a b1, Unital a b2) => Unital a (b1, b2) Source # | |
Defined in Data.Semimodule | |
(Unital a b1, Unital a b2, Unital a b3) => Unital a (b1, b2, b3) Source # | |
Defined in Data.Semimodule |
Coalgebras
type FreeCoalgebra a f = (FreeSemimodule a f, Coalgebra a (Rep f)) Source #
A coalgebra over a free semimodule f.
class Semiring a => Coalgebra a c where Source #
A coalgebra over a semiring.
Instances
Semiring a => Coalgebra a IntSet Source # | The free commutative band coalgebra over Int |
Semiring a => Coalgebra a () Source # | |
Defined in Data.Semimodule | |
Semiring r => Coalgebra r E4 Source # | |
Semiring r => Coalgebra r E3 Source # | |
Semiring r => Coalgebra r E2 Source # | |
Semiring r => Coalgebra r E1 Source # | |
(Semiring a, Ord c) => Coalgebra a (Set c) Source # | The free commutative band coalgebra |
Semiring a => Coalgebra a (Seq c) Source # | |
Semiring a => Coalgebra a [c] Source # | The tensor coalgebra on c. |
Defined in Data.Semimodule | |
Algebra a b => Coalgebra a (b -> a) Source # | |
Defined in Data.Semimodule | |
(Coalgebra a c1, Coalgebra a c2) => Coalgebra a (c1, c2) Source # | |
Defined in Data.Semimodule | |
(Coalgebra a c1, Coalgebra a c2, Coalgebra a c3) => Coalgebra a (c1, c2, c3) Source # | |
Defined in Data.Semimodule |
Unital coalgebras
type FreeCounital a f = (FreeCoalgebra a f, Counital a (Rep f)) Source #
A counital coalgebra over a free semimodule f.
class Coalgebra a c => Counital a c where Source #
A counital coalgebra over a semiring.
Instances
Semiring a => Counital a IntSet Source # | |
Defined in Data.Semimodule | |
Semiring a => Counital a () Source # | |
Defined in Data.Semimodule | |
Semiring r => Counital r E4 Source # | |
Defined in Data.Semimodule.Basis | |
Semiring r => Counital r E3 Source # | |
Defined in Data.Semimodule.Basis | |
Semiring r => Counital r E2 Source # | |
Defined in Data.Semimodule.Basis | |
Semiring r => Counital r E1 Source # | |
Defined in Data.Semimodule.Basis | |
(Semiring a, Ord c) => Counital a (Set c) Source # | |
Defined in Data.Semimodule | |
Semiring a => Counital a (Seq c) Source # | |
Defined in Data.Semimodule | |
Semiring a => Counital a [c] Source # | |
Defined in Data.Semimodule | |
Unital a b => Counital a (b -> a) Source # | |
Defined in Data.Semimodule | |
(Counital a c1, Counital a c2) => Counital a (c1, c2) Source # | |
Defined in Data.Semimodule | |
(Counital a c1, Counital a c2, Counital a c3) => Counital a (c1, c2, c3) Source # | |
Defined in Data.Semimodule |
Bialgebras
type FreeBialgebra a f = (FreeAlgebra a f, FreeCoalgebra a f, Bialgebra a (Rep f)) Source #
A bialgebra over a free semimodule f.
class (Unital a b, Counital a b) => Bialgebra a b Source #
A bialgebra over a semiring.
Instances
Semiring a => Bialgebra a () Source # | |
Defined in Data.Semimodule | |
Semiring r => Bialgebra r E4 Source # | |
Defined in Data.Semimodule.Basis | |
Semiring r => Bialgebra r E3 Source # | |
Defined in Data.Semimodule.Basis | |
Semiring r => Bialgebra r E2 Source # | |
Defined in Data.Semimodule.Basis | |
Semiring r => Bialgebra r E1 Source # | |
Defined in Data.Semimodule.Basis | |
Semiring a => Bialgebra a (Seq b) Source # | |
Defined in Data.Semimodule | |
Semiring a => Bialgebra a [b] Source # | |
Defined in Data.Semimodule | |
(Bialgebra a b1, Bialgebra a b2) => Bialgebra a (b1, b2) Source # | |
Defined in Data.Semimodule | |
(Bialgebra a b1, Bialgebra a b2, Bialgebra a b3) => Bialgebra a (b1, b2, b3) Source # | |
Defined in Data.Semimodule |