-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Constructive abstract algebra -- -- Constructive abstract algebra @package algebra @version 0.3.0 module Numeric.Natural.Internal newtype Natural Natural :: Integer -> Natural runNatural :: Natural -> Integer class Integral n => Whole n toNatural :: Whole n => n -> Natural unsafePred :: Whole n => n -> n instance Eq Natural instance Ord Natural instance Whole Natural instance Whole Word64 instance Whole Word32 instance Whole Word16 instance Whole Word8 instance Whole Word instance Integral Natural instance Enum Natural instance Real Natural instance Num Natural instance Read Natural instance Show Natural module Numeric.Natural data Natural class Integral n => Whole n toNatural :: Whole n => n -> Natural module Numeric.Order.Class class Order a (<~) :: Order a => a -> a -> Bool (<) :: Order a => a -> a -> Bool (>~) :: Order a => a -> a -> Bool (>) :: Order a => a -> a -> Bool (~~) :: Order a => a -> a -> Bool (/~) :: Order a => a -> a -> Bool order :: Order a => a -> a -> Maybe Ordering comparable :: Order a => a -> a -> Bool orderOrd :: Ord a => a -> a -> Maybe Ordering instance (Order a, Order b, Order c, Order d, Order e) => Order (a, b, c, d, e) instance (Order a, Order b, Order c, Order d) => Order (a, b, c, d) instance (Order a, Order b, Order c) => Order (a, b, c) instance (Order a, Order b) => Order (a, b) instance Order () instance Order Word64 instance Order Word32 instance Order Word16 instance Order Word8 instance Order Word instance Order Natural instance Order Int64 instance Order Int32 instance Order Int16 instance Order Int8 instance Order Int instance Order Integer instance Order Bool module Numeric.Semigroup.Additive -- |
--   (a + b) + c = a + (b + c)
--   replicate 1 a = a
--   replicate (2 * n) a = replicate n a + replicate n a
--   replicate (2 * n + 1) a = replicate n a + replicate n a + a
--   
class Additive r (+) :: Additive r => r -> r -> r replicate1p :: (Additive r, Whole n) => n -> r -> r sumWith1 :: (Additive r, Foldable1 f) => (a -> r) -> f a -> r sum1 :: (Foldable1 f, Additive r) => f r -> r instance (Additive a, Additive b, Additive c, Additive d, Additive e) => Additive (a, b, c, d, e) instance (Additive a, Additive b, Additive c, Additive d) => Additive (a, b, c, d) instance (Additive a, Additive b, Additive c) => Additive (a, b, c) instance (Additive a, Additive b) => Additive (a, b) instance Additive () instance Additive Word64 instance Additive Word32 instance Additive Word16 instance Additive Word8 instance Additive Word instance Additive Int64 instance Additive Int32 instance Additive Int16 instance Additive Int8 instance Additive Int instance Additive Integer instance Additive Natural instance Additive Bool instance Additive r => Additive (b -> r) module Numeric.Order.Additive -- | z + x <= z + y = x <= y = x + z <= y + z class (Additive r, Order r) => AdditiveOrder r instance (AdditiveOrder a, AdditiveOrder b, AdditiveOrder c, AdditiveOrder d, AdditiveOrder e) => AdditiveOrder (a, b, c, d, e) instance (AdditiveOrder a, AdditiveOrder b, AdditiveOrder c, AdditiveOrder d) => AdditiveOrder (a, b, c, d) instance (AdditiveOrder a, AdditiveOrder b, AdditiveOrder c) => AdditiveOrder (a, b, c) instance (AdditiveOrder a, AdditiveOrder b) => AdditiveOrder (a, b) instance AdditiveOrder () instance AdditiveOrder Bool instance AdditiveOrder Natural instance AdditiveOrder Integer module Numeric.Addition.Partitionable class Additive m => Partitionable m partitionWith :: Partitionable m => (m -> m -> r) -> m -> NonEmpty r instance (Partitionable a, Partitionable b, Partitionable c, Partitionable d, Partitionable e) => Partitionable (a, b, c, d, e) instance (Partitionable a, Partitionable b, Partitionable c, Partitionable d) => Partitionable (a, b, c, d) instance (Partitionable a, Partitionable b, Partitionable c) => Partitionable (a, b, c) instance (Partitionable a, Partitionable b) => Partitionable (a, b) instance Partitionable () instance Partitionable Natural instance Partitionable Bool module Numeric.Addition.Abelian -- | an additive abelian semigroup -- -- a + b = b + a class Additive r => Abelian r instance (Abelian a, Abelian b, Abelian c, Abelian d, Abelian e) => Abelian (a, b, c, d, e) instance (Abelian a, Abelian b, Abelian c, Abelian d) => Abelian (a, b, c, d) instance (Abelian a, Abelian b, Abelian c) => Abelian (a, b, c) instance (Abelian a, Abelian b) => Abelian (a, b) instance Abelian Word64 instance Abelian Word32 instance Abelian Word16 instance Abelian Word8 instance Abelian Word instance Abelian Int64 instance Abelian Int32 instance Abelian Int16 instance Abelian Int8 instance Abelian Int instance Abelian Natural instance Abelian Integer instance Abelian Bool instance Abelian () instance Abelian r => Abelian (e -> r) module Numeric.Algebra.Free.Class -- | An associative algebra built with a free module over a semiring class Semiring r => FreeAlgebra r a join :: FreeAlgebra r a => (a -> a -> r) -> a -> r class Semiring r => FreeCoalgebra r c cojoin :: FreeCoalgebra r c => (c -> r) -> c -> c -> r instance (FreeCoalgebra r a, FreeCoalgebra r b, FreeCoalgebra r c, FreeCoalgebra r d, FreeCoalgebra r e) => FreeCoalgebra r (a, b, c, d, e) instance (FreeCoalgebra r a, FreeCoalgebra r b, FreeCoalgebra r c, FreeCoalgebra r d) => FreeCoalgebra r (a, b, c, d) instance (FreeCoalgebra r a, FreeCoalgebra r b, FreeCoalgebra r c) => FreeCoalgebra r (a, b, c) instance (FreeCoalgebra r a, FreeCoalgebra r b) => FreeCoalgebra r (a, b) instance (FreeAlgebra r b, FreeCoalgebra r c) => FreeCoalgebra (b -> r) c instance FreeCoalgebra () c instance FreeAlgebra r m => FreeCoalgebra r (m -> r) module Numeric.Algebra.Free.Unital -- | An associative unital algebra over a semiring, built using a free -- module class (Unital r, FreeAlgebra r a) => FreeUnitalAlgebra r a unit :: FreeUnitalAlgebra r a => r -> a -> r class FreeCoalgebra r c => FreeCounitalCoalgebra r c counit :: FreeCounitalCoalgebra r c => (c -> r) -> r instance (FreeCounitalCoalgebra r a, FreeCounitalCoalgebra r b, FreeCounitalCoalgebra r c, FreeCounitalCoalgebra r d, FreeCounitalCoalgebra r e) => FreeCounitalCoalgebra r (a, b, c, d, e) instance (FreeCounitalCoalgebra r a, FreeCounitalCoalgebra r b, FreeCounitalCoalgebra r c, FreeCounitalCoalgebra r d) => FreeCounitalCoalgebra r (a, b, c, d) instance (FreeCounitalCoalgebra r a, FreeCounitalCoalgebra r b, FreeCounitalCoalgebra r c) => FreeCounitalCoalgebra r (a, b, c) instance (FreeCounitalCoalgebra r a, FreeCounitalCoalgebra r b) => FreeCounitalCoalgebra r (a, b) instance FreeCounitalCoalgebra () a instance (FreeUnitalAlgebra r a, FreeCounitalCoalgebra r c) => FreeCounitalCoalgebra (a -> r) c instance FreeUnitalAlgebra r m => FreeCounitalCoalgebra r (m -> r) module Numeric.Algebra.Free.Hopf -- | a Hopf algebra on a semiring, where the module is a free. -- -- If antipode . antipode = id then we are Involutive class (FreeUnitalAlgebra r h, FreeCounitalCoalgebra r h) => Hopf r h antipode :: Hopf r h => (h -> r) -> h -> r instance (Hopf r a, Hopf r b, Hopf r c, Hopf r d, Hopf r e) => Hopf r (a, b, c, d, e) instance (Hopf r a, Hopf r b, Hopf r c, Hopf r d) => Hopf r (a, b, c, d) instance (Hopf r a, Hopf r b, Hopf r c) => Hopf r (a, b, c) instance (Hopf r a, Hopf r b) => Hopf r (a, b) instance Hopf () h instance (FreeUnitalAlgebra r a, Hopf r h) => Hopf (a -> r) h module Numeric.Algebra.Free -- | An associative algebra built with a free module over a semiring class Semiring r => FreeAlgebra r a join :: FreeAlgebra r a => (a -> a -> r) -> a -> r -- | An associative unital algebra over a semiring, built using a free -- module class (Unital r, FreeAlgebra r a) => FreeUnitalAlgebra r a unit :: FreeUnitalAlgebra r a => r -> a -> r class Semiring r => FreeCoalgebra r c cojoin :: FreeCoalgebra r c => (c -> r) -> c -> c -> r class FreeCoalgebra r c => FreeCounitalCoalgebra r c counit :: FreeCounitalCoalgebra r c => (c -> r) -> r -- | a Hopf algebra on a semiring, where the module is a free. -- -- If antipode . antipode = id then we are Involutive class (FreeUnitalAlgebra r h, FreeCounitalCoalgebra r h) => Hopf r h antipode :: Hopf r h => (h -> r) -> h -> r module Numeric.Monoid.Multiplicative class Multiplicative r => Unital r one :: Unital r => r pow :: (Unital r, Whole n) => r -> n -> r productWith :: (Unital r, Foldable f) => (a -> r) -> f a -> r product :: (Foldable f, Unital r) => f r -> r module Numeric.Decidable.Associates class Unital r => DecidableAssociates r isAssociate :: DecidableAssociates r => r -> r -> Bool isAssociateIntegral :: Num n => n -> n -> Bool isAssociateWhole :: Eq n => n -> n -> Bool instance (DecidableAssociates a, DecidableAssociates b, DecidableAssociates c, DecidableAssociates d, DecidableAssociates e) => DecidableAssociates (a, b, c, d, e) instance (DecidableAssociates a, DecidableAssociates b, DecidableAssociates c, DecidableAssociates d) => DecidableAssociates (a, b, c, d) instance (DecidableAssociates a, DecidableAssociates b, DecidableAssociates c) => DecidableAssociates (a, b, c) instance (DecidableAssociates a, DecidableAssociates b) => DecidableAssociates (a, b) instance DecidableAssociates () instance DecidableAssociates Word64 instance DecidableAssociates Word32 instance DecidableAssociates Word16 instance DecidableAssociates Word8 instance DecidableAssociates Word instance DecidableAssociates Natural instance DecidableAssociates Int64 instance DecidableAssociates Int32 instance DecidableAssociates Int16 instance DecidableAssociates Int8 instance DecidableAssociates Int instance DecidableAssociates Integer instance DecidableAssociates Bool module Numeric.Semigroup.Multiplicative -- | A multiplicative semigroup class Multiplicative r (*) :: Multiplicative r => r -> r -> r pow1p :: (Multiplicative r, Whole n) => r -> n -> r productWith1 :: (Multiplicative r, Foldable1 f) => (a -> r) -> f a -> r pow1pIntegral :: (Integral r, Integral n) => r -> n -> r product1 :: (Foldable1 f, Multiplicative r) => f r -> r module Numeric.Band.Class -- | An multiplicative semigroup with idempotent multiplication. -- --
--   a * a = a
--   
class Multiplicative r => Band r pow1pBand :: Whole n => r -> n -> r powBand :: (Unital r, Whole n) => r -> n -> r instance (Band a, Band b, Band c, Band d, Band e) => Band (a, b, c, d, e) instance (Band a, Band b, Band c, Band d) => Band (a, b, c, d) instance (Band a, Band b, Band c) => Band (a, b, c) instance (Band a, Band b) => Band (a, b) instance Band Bool instance Band () module Numeric.Band.Rectangular -- | a rectangular band is a nowhere commutative semigroup. That is to say, -- if ab = ba then a = b. From this it follows classically that aa = a -- and that such a band is isomorphic to the following structure data Rect i j Rect :: i -> j -> Rect i j instance (Eq i, Eq j) => Eq (Rect i j) instance (Ord i, Ord j) => Ord (Rect i j) instance (Show i, Show j) => Show (Rect i j) instance (Read i, Read j) => Read (Rect i j) instance Band (Rect i j) instance Multiplicative (Rect i j) instance Semigroupoid Rect module Numeric.Band module Numeric.Decidable.Units class Unital r => DecidableUnits r recipUnit :: DecidableUnits r => r -> Maybe r isUnit :: (DecidableUnits r, DecidableUnits r) => r -> Bool (^?) :: (DecidableUnits r, Integral n) => r -> n -> Maybe r recipUnitIntegral :: Integral r => r -> Maybe r recipUnitWhole :: Integral r => r -> Maybe r instance (DecidableUnits a, DecidableUnits b, DecidableUnits c, DecidableUnits d, DecidableUnits e) => DecidableUnits (a, b, c, d, e) instance (DecidableUnits a, DecidableUnits b, DecidableUnits c, DecidableUnits d) => DecidableUnits (a, b, c, d) instance (DecidableUnits a, DecidableUnits b, DecidableUnits c) => DecidableUnits (a, b, c) instance (DecidableUnits a, DecidableUnits b) => DecidableUnits (a, b) instance DecidableUnits () instance DecidableUnits Word64 instance DecidableUnits Word32 instance DecidableUnits Word16 instance DecidableUnits Word8 instance DecidableUnits Word instance DecidableUnits Natural instance DecidableUnits Int64 instance DecidableUnits Int32 instance DecidableUnits Int16 instance DecidableUnits Int8 instance DecidableUnits Int instance DecidableUnits Integer instance DecidableUnits Bool module Numeric.Group.Multiplicative class Unital r => MultiplicativeGroup r recip :: MultiplicativeGroup r => r -> r (/) :: MultiplicativeGroup r => r -> r -> r (\\) :: MultiplicativeGroup r => r -> r -> r (^) :: (MultiplicativeGroup r, Integral n) => r -> n -> r instance (MultiplicativeGroup a, MultiplicativeGroup b, MultiplicativeGroup c, MultiplicativeGroup d, MultiplicativeGroup e) => MultiplicativeGroup (a, b, c, d, e) instance (MultiplicativeGroup a, MultiplicativeGroup b, MultiplicativeGroup c, MultiplicativeGroup d) => MultiplicativeGroup (a, b, c, d) instance (MultiplicativeGroup a, MultiplicativeGroup b, MultiplicativeGroup c) => MultiplicativeGroup (a, b, c) instance (MultiplicativeGroup a, MultiplicativeGroup b) => MultiplicativeGroup (a, b) instance MultiplicativeGroup () module Numeric.Multiplication.Commutative -- | A commutative multiplicative semigroup class Multiplicative r => Commutative r instance (Commutative a, Commutative b, Commutative c, Commutative d, Commutative e) => Commutative (a, b, c, d, e) instance (Commutative a, Commutative b, Commutative c, Commutative d) => Commutative (a, b, c, d) instance (Commutative a, Commutative b, Commutative c) => Commutative (a, b, c) instance (Commutative a, Commutative b) => Commutative (a, b) instance Commutative Word64 instance Commutative Word32 instance Commutative Word16 instance Commutative Word8 instance Commutative Word instance Commutative Natural instance Commutative Int64 instance Commutative Int32 instance Commutative Int16 instance Commutative Int8 instance Commutative Int instance Commutative Integer instance Commutative Bool instance Commutative () module Numeric.Multiplication.Involutive -- | An semigroup with involution -- --
--   adjoint a * adjoint b = adjoint (b * a)
--   
class Multiplicative r => InvolutiveMultiplication r adjoint :: InvolutiveMultiplication r => r -> r adjointCommutative :: Commutative r => r -> r instance (InvolutiveMultiplication a, InvolutiveMultiplication b, InvolutiveMultiplication c, InvolutiveMultiplication d, InvolutiveMultiplication e) => InvolutiveMultiplication (a, b, c, d, e) instance (InvolutiveMultiplication a, InvolutiveMultiplication b, InvolutiveMultiplication c, InvolutiveMultiplication d) => InvolutiveMultiplication (a, b, c, d) instance (InvolutiveMultiplication a, InvolutiveMultiplication b, InvolutiveMultiplication c) => InvolutiveMultiplication (a, b, c) instance (InvolutiveMultiplication a, InvolutiveMultiplication b) => InvolutiveMultiplication (a, b) instance InvolutiveMultiplication () instance InvolutiveMultiplication Word64 instance InvolutiveMultiplication Word32 instance InvolutiveMultiplication Word16 instance InvolutiveMultiplication Word8 instance InvolutiveMultiplication Natural instance InvolutiveMultiplication Word instance InvolutiveMultiplication Bool instance InvolutiveMultiplication Int64 instance InvolutiveMultiplication Int32 instance InvolutiveMultiplication Int16 instance InvolutiveMultiplication Int8 instance InvolutiveMultiplication Integer instance InvolutiveMultiplication Int module Numeric.Multiplication.Factorable -- | `factorWith f c` returns a non-empty list containing `f a b` for all -- `a, b` such that `a * b = c`. -- -- Results of factorWith f 0 are undefined and may result in either an -- error or an infinite list. class Multiplicative m => Factorable m factorWith :: Factorable m => (m -> m -> r) -> m -> NonEmpty r instance (Factorable a, Factorable b, Factorable c, Factorable d, Factorable e) => Factorable (a, b, c, d, e) instance (Factorable a, Factorable b, Factorable c, Factorable d) => Factorable (a, b, c, d) instance (Factorable a, Factorable b, Factorable c) => Factorable (a, b, c) instance (Factorable a, Factorable b) => Factorable (a, b) instance Factorable () instance Factorable Bool module Numeric.Multiplication module Numeric.Semiring.Class -- | A pair of an additive abelian semigroup, and a multiplicative -- semigroup, with the distributive laws: -- --
--   a(b + c) = ab + ac
--   (a + b)c = ac + bc
--   
-- -- Common notation includes the laws for additive and multiplicative -- identity in semiring. -- -- If you want that, look at Rig instead. -- -- Ideally we'd use the cyclic definition: -- --
--   class (LeftModule r r, RightModule r r, Additive r, Abelian r, Multiplicative r) => Semiring r
--   
-- -- to enforce that every semiring r is an r-module over itself, but -- Haskell doesn't like that. class (Additive r, Abelian r, Multiplicative r) => Semiring r module Numeric.Module.Class class (Semiring r, Additive m) => LeftModule r m (.*) :: LeftModule r m => r -> m -> m class (Semiring r, Additive m) => RightModule r m (*.) :: RightModule r m => m -> r -> m instance (RightModule r a, RightModule r b, RightModule r c, RightModule r d, RightModule r e) => RightModule r (a, b, c, d, e) instance (RightModule r a, RightModule r b, RightModule r c, RightModule r d) => RightModule r (a, b, c, d) instance (RightModule r a, RightModule r b, RightModule r c) => RightModule r (a, b, c) instance (RightModule r a, RightModule r b) => RightModule r (a, b) instance RightModule r m => RightModule r (e -> m) instance Semiring r => RightModule r () instance RightModule Integer Word64 instance RightModule Natural Word64 instance RightModule Integer Word32 instance RightModule Natural Word32 instance RightModule Integer Word16 instance RightModule Natural Word16 instance RightModule Integer Word8 instance RightModule Natural Word8 instance RightModule Integer Word instance RightModule Natural Word instance RightModule Integer Int64 instance RightModule Natural Int64 instance RightModule Integer Int32 instance RightModule Natural Int32 instance RightModule Integer Int16 instance RightModule Natural Int16 instance RightModule Integer Int8 instance RightModule Natural Int8 instance RightModule Integer Int instance RightModule Natural Int instance RightModule Integer Integer instance RightModule Natural Integer instance RightModule Natural Natural instance RightModule Natural Bool instance (LeftModule r a, LeftModule r b, LeftModule r c, LeftModule r d, LeftModule r e) => LeftModule r (a, b, c, d, e) instance (LeftModule r a, LeftModule r b, LeftModule r c, LeftModule r d) => LeftModule r (a, b, c, d) instance (LeftModule r a, LeftModule r b, LeftModule r c) => LeftModule r (a, b, c) instance (LeftModule r a, LeftModule r b) => LeftModule r (a, b) instance LeftModule r m => LeftModule r (e -> m) instance Semiring r => LeftModule r () instance LeftModule Integer Word64 instance LeftModule Natural Word64 instance LeftModule Integer Word32 instance LeftModule Natural Word32 instance LeftModule Integer Word16 instance LeftModule Natural Word16 instance LeftModule Integer Word8 instance LeftModule Natural Word8 instance LeftModule Integer Word instance LeftModule Natural Word instance LeftModule Integer Int64 instance LeftModule Natural Int64 instance LeftModule Integer Int32 instance LeftModule Natural Int32 instance LeftModule Integer Int16 instance LeftModule Natural Int16 instance LeftModule Integer Int8 instance LeftModule Natural Int8 instance LeftModule Integer Int instance LeftModule Natural Int instance LeftModule Integer Integer instance LeftModule Natural Integer instance LeftModule Natural Natural instance LeftModule Natural Bool module Numeric.Monoid.Additive -- | An additive monoid -- --
--   zero + a = a = a + zero
--   
class (LeftModule Natural m, RightModule Natural m) => AdditiveMonoid m zero :: AdditiveMonoid m => m replicate :: (AdditiveMonoid m, Whole n) => n -> m -> m sumWith :: (AdditiveMonoid m, Foldable f) => (a -> m) -> f a -> m sum :: (Foldable f, AdditiveMonoid m) => f m -> m instance (AdditiveMonoid a, AdditiveMonoid b, AdditiveMonoid c, AdditiveMonoid d, AdditiveMonoid e) => AdditiveMonoid (a, b, c, d, e) instance (AdditiveMonoid a, AdditiveMonoid b, AdditiveMonoid c, AdditiveMonoid d) => AdditiveMonoid (a, b, c, d) instance (AdditiveMonoid a, AdditiveMonoid b, AdditiveMonoid c) => AdditiveMonoid (a, b, c) instance (AdditiveMonoid a, AdditiveMonoid b) => AdditiveMonoid (a, b) instance AdditiveMonoid () instance AdditiveMonoid r => AdditiveMonoid (e -> r) instance AdditiveMonoid Word64 instance AdditiveMonoid Word32 instance AdditiveMonoid Word16 instance AdditiveMonoid Word8 instance AdditiveMonoid Word instance AdditiveMonoid Int64 instance AdditiveMonoid Int32 instance AdditiveMonoid Int16 instance AdditiveMonoid Int8 instance AdditiveMonoid Int instance AdditiveMonoid Integer instance AdditiveMonoid Natural instance AdditiveMonoid Bool module Numeric.Addition.Idempotent -- | An additive semigroup with idempotent addition. -- --
--   a + a = a
--   
-- -- An (Idempotent r, Rig r) => r is also known as a dioid class Additive r => Idempotent r replicate1pIdempotent :: Natural -> r -> r replicateIdempotent :: (Integral n, Idempotent r, AdditiveMonoid r) => n -> r -> r instance (Idempotent a, Idempotent b, Idempotent c, Idempotent d, Idempotent e) => Idempotent (a, b, c, d, e) instance (Idempotent a, Idempotent b, Idempotent c, Idempotent d) => Idempotent (a, b, c, d) instance (Idempotent a, Idempotent b, Idempotent c) => Idempotent (a, b, c) instance (Idempotent a, Idempotent b) => Idempotent (a, b) instance Idempotent r => Idempotent (e -> r) instance Idempotent Bool instance Idempotent () module Numeric.Semigroup module Numeric.Monoid module Numeric.Decidable.Zero class AdditiveMonoid r => DecidableZero r isZero :: DecidableZero r => r -> Bool instance (DecidableZero a, DecidableZero b, DecidableZero c, DecidableZero d, DecidableZero e) => DecidableZero (a, b, c, d, e) instance (DecidableZero a, DecidableZero b, DecidableZero c, DecidableZero d) => DecidableZero (a, b, c, d) instance (DecidableZero a, DecidableZero b, DecidableZero c) => DecidableZero (a, b, c) instance (DecidableZero a, DecidableZero b) => DecidableZero (a, b) instance DecidableZero () instance DecidableZero Word64 instance DecidableZero Word32 instance DecidableZero Word16 instance DecidableZero Word8 instance DecidableZero Word instance DecidableZero Natural instance DecidableZero Int64 instance DecidableZero Int32 instance DecidableZero Int16 instance DecidableZero Int8 instance DecidableZero Int instance DecidableZero Integer instance DecidableZero Bool module Numeric.Rig.Class -- | A Ring without (n)egation class (Semiring r, AdditiveMonoid r, Unital r) => Rig r fromNatural :: Rig r => Natural -> r fromNaturalNum :: Num r => Natural -> r fromWhole :: (Whole n, Rig r) => n -> r instance (Rig a, Rig b, Rig c, Rig d, Rig e) => Rig (a, b, c, d, e) instance (Rig a, Rig b, Rig c, Rig d) => Rig (a, b, c, d) instance (Rig a, Rig b, Rig c) => Rig (a, b, c) instance (Rig a, Rig b) => Rig (a, b) instance Rig () instance Rig Word64 instance Rig Word32 instance Rig Word16 instance Rig Word8 instance Rig Word instance Rig Int64 instance Rig Int32 instance Rig Int16 instance Rig Int8 instance Rig Int instance Rig Bool instance Rig Natural instance Rig Integer module Numeric.Rig.Ordered class (AdditiveOrder r, Rig r) => OrderedRig r instance (OrderedRig a, OrderedRig b, OrderedRig c, OrderedRig d, OrderedRig e) => OrderedRig (a, b, c, d, e) instance (OrderedRig a, OrderedRig b, OrderedRig c, OrderedRig d) => OrderedRig (a, b, c, d) instance (OrderedRig a, OrderedRig b, OrderedRig c) => OrderedRig (a, b, c) instance (OrderedRig a, OrderedRig b) => OrderedRig (a, b) instance OrderedRig () instance OrderedRig Bool instance OrderedRig Natural instance OrderedRig Integer module Numeric.Order module Numeric.Semiring.Involutive -- | adjoint (x + y) = adjoint x + adjoint y class (Rig r, InvolutiveMultiplication r) => Involutive r instance (Involutive a, Involutive b, Involutive c, Involutive d, Involutive e) => Involutive (a, b, c, d, e) instance (Involutive a, Involutive b, Involutive c, Involutive d) => Involutive (a, b, c, d) instance (Involutive a, Involutive b, Involutive c) => Involutive (a, b, c) instance (Involutive a, Involutive b) => Involutive (a, b) instance Involutive () instance Involutive Word64 instance Involutive Word32 instance Involutive Word16 instance Involutive Word8 instance Involutive Word instance Involutive Natural instance Involutive Int64 instance Involutive Int32 instance Involutive Int16 instance Involutive Int8 instance Involutive Int instance Involutive Integer module Numeric.Semiring.Integral class (AdditiveMonoid r, Semiring r) => IntegralSemiring r instance IntegralSemiring Bool instance IntegralSemiring Natural instance IntegralSemiring Integer module Numeric.Semiring module Numeric.Group.Additive class (LeftModule Integer r, RightModule Integer r, AdditiveMonoid r) => AdditiveGroup r (-) :: AdditiveGroup r => r -> r -> r negate :: AdditiveGroup r => r -> r subtract :: AdditiveGroup r => r -> r -> r times :: (AdditiveGroup r, Integral n) => n -> r -> r instance (AdditiveGroup a, AdditiveGroup b, AdditiveGroup c, AdditiveGroup d, AdditiveGroup e) => AdditiveGroup (a, b, c, d, e) instance (AdditiveGroup a, AdditiveGroup b, AdditiveGroup c, AdditiveGroup d) => AdditiveGroup (a, b, c, d) instance (AdditiveGroup a, AdditiveGroup b, AdditiveGroup c) => AdditiveGroup (a, b, c) instance (AdditiveGroup a, AdditiveGroup b) => AdditiveGroup (a, b) instance AdditiveGroup () instance AdditiveGroup Word64 instance AdditiveGroup Word32 instance AdditiveGroup Word16 instance AdditiveGroup Word8 instance AdditiveGroup Word instance AdditiveGroup Int64 instance AdditiveGroup Int32 instance AdditiveGroup Int16 instance AdditiveGroup Int8 instance AdditiveGroup Int instance AdditiveGroup Integer instance AdditiveGroup r => AdditiveGroup (e -> r) module Numeric.Group module Numeric.Rng.Class -- | A Ring without an identity. class (AdditiveGroup r, Semiring r) => Rng r instance (Rng a, Rng b, Rng c, Rng d, Rng e) => Rng (a, b, c, d, e) instance (Rng a, Rng b, Rng c, Rng d) => Rng (a, b, c, d) instance (Rng a, Rng b, Rng c) => Rng (a, b, c) instance (Rng a, Rng b) => Rng (a, b) instance Rng () instance Rng Word64 instance Rng Word32 instance Rng Word16 instance Rng Word8 instance Rng Word instance Rng Int64 instance Rng Int32 instance Rng Int16 instance Rng Int8 instance Rng Int instance Rng Integer module Numeric.Ring.Class class (Rig r, Rng r) => Ring r fromInteger :: Ring r => Integer -> r fromIntegral :: (Integral n, Ring r) => n -> r instance (Ring a, Ring b, Ring c, Ring d, Ring e) => Ring (a, b, c, d, e) instance (Ring a, Ring b, Ring c, Ring d) => Ring (a, b, c, d) instance (Ring a, Ring b, Ring c) => Ring (a, b, c) instance (Ring a, Ring b) => Ring (a, b) instance Ring () instance Ring Word64 instance Ring Word32 instance Ring Word16 instance Ring Word8 instance Ring Word instance Ring Int64 instance Ring Int32 instance Ring Int16 instance Ring Int8 instance Ring Int instance Ring Integer module Numeric.Module module Numeric.Addition module Numeric.Exp newtype Exp r Exp :: r -> Exp r runExp :: Exp r -> r instance Partitionable r => Factorable (Exp r) instance Idempotent r => Band (Exp r) instance Abelian r => Commutative (Exp r) instance AdditiveGroup r => MultiplicativeGroup (Exp r) instance AdditiveMonoid r => Unital (Exp r) instance Additive r => Multiplicative (Exp r) module Numeric.Functional.Linear -- | Linear functionals from elements of a free module to a scalar newtype Linear r a Linear :: ((a -> r) -> r) -> Linear r a ($*) :: Linear r a -> (a -> r) -> r (.*) :: LeftModule r m => r -> m -> m (*.) :: RightModule r m => m -> r -> m type Vector = (->) unitVector :: FreeUnitalAlgebra r a => a -> r type Covector a r = Linear r a counitCovector :: FreeCounitalCoalgebra r c => Linear r c embedCovector :: (Unital m, FreeCounitalCoalgebra r m) => r -> Linear r m -- | The augmentation ring homomorphism from r^a -> r, generalizes the -- augmentation homomorphism from a monoid semiring to the underlying -- semiring augmentCovector :: Unital s => Linear s a -> s instance RightModule r s => RightModule r (Linear s m) instance FreeCoalgebra r m => RightModule (Linear r m) (Linear r m) instance LeftModule r s => LeftModule r (Linear s m) instance FreeCoalgebra r m => LeftModule (Linear r m) (Linear r m) instance AdditiveGroup s => AdditiveGroup (Linear s a) instance Abelian s => Abelian (Linear s a) instance AdditiveMonoid s => AdditiveMonoid (Linear s a) instance (Ring r, FreeCounitalCoalgebra r m) => Ring (Linear r m) instance (Rng r, FreeCounitalCoalgebra r m) => Rng (Linear r m) instance (Rig r, FreeCounitalCoalgebra r m) => Rig (Linear r m) instance FreeCounitalCoalgebra r m => Unital (Linear r m) instance FreeCoalgebra r m => Semiring (Linear r m) instance (Commutative m, FreeCoalgebra r m) => Commutative (Linear r m) instance FreeCoalgebra r m => Multiplicative (Linear r m) instance Additive r => Additive (Linear r a) instance AdditiveMonoid r => MonadPlus (Linear r) instance AdditiveMonoid r => Alternative (Linear r) instance AdditiveMonoid r => Plus (Linear r) instance Additive r => Alt (Linear r) instance Monad (Linear r) instance Bind (Linear r) instance Applicative (Linear r) instance Apply (Linear r) instance Functor (Linear r) module Numeric.Functional.Antilinear -- | Antilinear functionals from elements of a free module to a scalar newtype Antilinear s a Antilinear :: ((a -> s) -> s) -> Antilinear s a appAntilinear :: Antilinear s a -> (a -> s) -> s instance RightModule r s => RightModule r (Antilinear s m) instance LeftModule r s => LeftModule r (Antilinear s m) instance Abelian s => Abelian (Antilinear s a) instance AdditiveGroup s => AdditiveGroup (Antilinear s a) instance AdditiveMonoid s => AdditiveMonoid (Antilinear s a) instance Additive s => Additive (Antilinear s a) instance AdditiveMonoid s => MonadPlus (Antilinear s) instance AdditiveMonoid s => Alternative (Antilinear s) instance AdditiveMonoid s => Plus (Antilinear s) instance Additive s => Alt (Antilinear s) instance Monad (Antilinear s) instance Bind (Antilinear s) instance Applicative (Antilinear s) instance Apply (Antilinear s) instance Functor (Antilinear s) module Numeric.Log newtype Log r Log :: r -> Log r runLog :: Log r -> r instance Factorable r => Partitionable (Log r) instance Band r => Idempotent (Log r) instance Commutative r => Abelian (Log r) instance MultiplicativeGroup r => AdditiveGroup (Log r) instance MultiplicativeGroup r => RightModule Integer (Log r) instance MultiplicativeGroup r => LeftModule Integer (Log r) instance Unital r => AdditiveMonoid (Log r) instance Unital r => RightModule Natural (Log r) instance Unital r => LeftModule Natural (Log r) instance Multiplicative r => Additive (Log r) module Numeric.Map.Linear -- | linear maps from elements of a free module to another free module over -- r -- --
--   f $# x + y = (f $# x) + (f $# y)
--   f $# (r .* x) = r .* (f $# x)
--   
-- -- Map r b a represents a linear mapping from a free module with -- basis a over r to a free module with basis -- b over r. -- -- Note well the change of direction, due to the contravariance of change -- of basis! -- -- This way enables we can employ arbitrary pure functions as linear maps -- by lifting them using arr, or build them by using the monad -- instance for Map r b. As a consequence Map is an instance of, well, -- almost everything. newtype Map r b a Map :: ((a -> r) -> b -> r) -> Map r b a ($#) :: Map r b a -> (a -> r) -> b -> r -- | extract a linear functional from a linear map ($@) :: Map r b a -> b -> Linear r a joinMap :: FreeAlgebra r a => Map r a (a, a) unitMap :: FreeUnitalAlgebra r a => Map r a () -- | Memoize the results of this linear map memoMap :: HasTrie a => Map r a a cojoinMap :: FreeCoalgebra r c => Map r (c, c) c counitMap :: FreeCounitalCoalgebra r c => Map r () c antipodeMap :: Hopf r h => Map r h h -- | convolution given an associative algebra and coassociative coalgebra convolveMap :: (FreeAlgebra r a, FreeCoalgebra r c) => Map r a c -> Map r a c -> Map r a c embedMap :: (Unital m, FreeCounitalCoalgebra r m) => (b -> r) -> Map r b m -- | The augmentation ring homomorphism from r^a -> r augmentMap :: Unital s => Map s b m -> b -> s -- | (inefficiently) combine a linear combination of basis vectors to make -- a map. arrMap :: (AdditiveMonoid r, Semiring r) => (b -> [(r, a)]) -> Map r b a instance (Ring r, FreeCounitalCoalgebra r m) => Ring (Map r a m) instance (Rng r, FreeCounitalCoalgebra r m) => Rng (Map r b m) instance (Rig r, FreeCounitalCoalgebra r m) => Rig (Map r b m) instance (Commutative m, FreeCoalgebra r m) => Commutative (Map r b m) instance AdditiveGroup s => AdditiveGroup (Map s b a) instance Abelian s => Abelian (Map s b a) instance AdditiveMonoid s => AdditiveMonoid (Map s b a) instance AdditiveMonoid r => MonadPlus (Map r b) instance AdditiveMonoid r => Alternative (Map r b) instance AdditiveMonoid r => Plus (Map r b) instance Additive r => Alt (Map r b) instance RightModule r s => RightModule r (Map s b m) instance FreeCoalgebra r m => RightModule (Map r b m) (Map r b m) instance LeftModule r s => LeftModule r (Map s b m) instance FreeCoalgebra r m => LeftModule (Map r b m) (Map r b m) instance FreeCoalgebra r m => Semiring (Map r b m) instance FreeCounitalCoalgebra r m => Unital (Map r b m) instance FreeCoalgebra r m => Multiplicative (Map r b m) instance Additive r => Additive (Map r b a) instance ArrowChoice (Map r) instance AdditiveMonoid r => ArrowPlus (Map r) instance AdditiveMonoid r => ArrowZero (Map r) instance MonadReader b (Map r b) instance ArrowApply (Map r) instance Arrow (Map r) instance Monoidal (Map r) Either instance Comonoidal (Map r) Either instance PreCoCartesian (Map r) instance Symmetric (Map r) Either instance Braided (Map r) Either instance Disassociative (Map r) Either instance Associative (Map r) Either instance Bifunctor Either (Map r) (Map r) (Map r) instance QFunctor Either (Map r) (Map r) instance PFunctor Either (Map r) (Map r) instance Distributive (Map r) instance CCC (Map r) instance PreCartesian (Map r) instance Comonoidal (Map r) (,) instance Monoidal (Map r) (,) instance Symmetric (Map r) (,) instance Braided (Map r) (,) instance Disassociative (Map r) (,) instance Associative (Map r) (,) instance Bifunctor (,) (Map r) (Map r) (Map r) instance QFunctor (,) (Map r) (Map r) instance PFunctor (,) (Map r) (Map r) instance Monad (Map r b) instance Bind (Map r b) instance Applicative (Map r b) instance Apply (Map r b) instance Functor (Map r b) instance Semigroupoid (Map r) instance Category (Map r) module Numeric.Ring.Endomorphism -- | The endomorphism ring of an abelian group or the endomorphism semiring -- of an abelian monoid -- -- http:en.wikipedia.orgwikiEndomorphism_ring newtype End a End :: (a -> a) -> End a appEnd :: End a -> a -> a toEnd :: Multiplicative r => r -> End r fromEnd :: Unital r => End r -> r instance RightModule r m => RightModule r (End m) instance LeftModule r m => LeftModule r (End m) instance (AdditiveMonoid m, Abelian m) => RightModule (End m) (End m) instance (AdditiveMonoid m, Abelian m) => LeftModule (End m) (End m) instance (Abelian r, AdditiveGroup r) => Ring (End r) instance (Abelian r, AdditiveGroup r) => Rng (End r) instance (Abelian r, AdditiveMonoid r) => Rig (End r) instance (Abelian r, AdditiveMonoid r) => Semiring (End r) instance (Abelian r, Commutative r) => Commutative (End r) instance Unital (End r) instance Multiplicative (End r) instance AdditiveGroup r => AdditiveGroup (End r) instance AdditiveMonoid r => AdditiveMonoid (End r) instance Abelian r => Abelian (End r) instance Additive r => Additive (End r) instance Monoid (End r) module Numeric.Rig.Characteristic class Rig r => Characteristic r char :: Characteristic r => Proxy r -> Natural charInt :: (Integral s, Bounded s) => Proxy s -> Natural charWord :: (Whole s, Bounded s) => Proxy s -> Natural frobenius :: Characteristic r => End r instance (Characteristic a, Characteristic b, Characteristic c, Characteristic d, Characteristic e) => Characteristic (a, b, c, d, e) instance (Characteristic a, Characteristic b, Characteristic c, Characteristic d) => Characteristic (a, b, c, d) instance (Characteristic a, Characteristic b, Characteristic c) => Characteristic (a, b, c) instance (Characteristic a, Characteristic b) => Characteristic (a, b) instance Characteristic () instance Characteristic Word64 instance Characteristic Word32 instance Characteristic Word16 instance Characteristic Word8 instance Characteristic Word instance Characteristic Int64 instance Characteristic Int32 instance Characteristic Int16 instance Characteristic Int8 instance Characteristic Int instance Characteristic Natural instance Characteristic Integer instance Characteristic Bool module Numeric.Rig module Numeric.Rng.Zero newtype ZeroRng r ZeroRng :: r -> ZeroRng r runZeroRng :: ZeroRng r -> r instance Eq r => Eq (ZeroRng r) instance Ord r => Ord (ZeroRng r) instance Show r => Show (ZeroRng r) instance Read r => Read (ZeroRng r) instance AdditiveGroup r => RightModule Integer (ZeroRng r) instance AdditiveGroup r => LeftModule Integer (ZeroRng r) instance AdditiveMonoid r => RightModule Natural (ZeroRng r) instance AdditiveMonoid r => LeftModule Natural (ZeroRng r) instance (AdditiveGroup r, Abelian r) => Rng (ZeroRng r) instance AdditiveMonoid r => Commutative (ZeroRng r) instance (AdditiveMonoid r, Abelian r) => Semiring (ZeroRng r) instance AdditiveMonoid r => Multiplicative (ZeroRng r) instance AdditiveGroup r => AdditiveGroup (ZeroRng r) instance AdditiveMonoid r => AdditiveMonoid (ZeroRng r) instance Abelian r => Abelian (ZeroRng r) instance Idempotent r => Idempotent (ZeroRng r) instance Additive r => Additive (ZeroRng r) module Numeric.Rng module Numeric.Ring.Opposite -- | http:en.wikipedia.orgwikiOpposite_ring newtype Opposite r Opposite :: r -> Opposite r runOpposite :: Opposite r -> r instance Show r => Show (Opposite r) instance Read r => Read (Opposite r) instance Ring r => Ring (Opposite r) instance Rig r => Rig (Opposite r) instance Rng r => Rng (Opposite r) instance Semiring r => Semiring (Opposite r) instance MultiplicativeGroup r => MultiplicativeGroup (Opposite r) instance Unital r => Unital (Opposite r) instance Band r => Band (Opposite r) instance Idempotent r => Idempotent (Opposite r) instance Commutative r => Commutative (Opposite r) instance Multiplicative r => Multiplicative (Opposite r) instance DecidableAssociates r => DecidableAssociates (Opposite r) instance DecidableUnits r => DecidableUnits (Opposite r) instance DecidableZero r => DecidableZero (Opposite r) instance Abelian r => Abelian (Opposite r) instance AdditiveGroup r => AdditiveGroup (Opposite r) instance Semiring r => RightModule (Opposite r) (Opposite r) instance LeftModule r s => RightModule r (Opposite s) instance RightModule r s => LeftModule r (Opposite s) instance Semiring r => LeftModule (Opposite r) (Opposite r) instance AdditiveMonoid r => AdditiveMonoid (Opposite r) instance Additive r => Additive (Opposite r) instance Traversable1 Opposite instance Foldable1 Opposite instance Traversable Opposite instance Foldable Opposite instance Functor Opposite instance Ord r => Ord (Opposite r) instance Eq r => Eq (Opposite r) module Numeric.Ring.Rng -- | The free Ring given a Rng obtained by adjoining Z, such that -- --
--   RngRing r = n*1 + r
--   
-- -- This ring is commonly denoted r^. data RngRing r RngRing :: !Integer -> r -> RngRing r -- | The rng homomorphism from r to RngRing r rngRingHom :: r -> RngRing r -- | given a rng homomorphism from a rng r into a ring s, liftRngHom yields -- a ring homomorphism from the ring `r^` into s. liftRngHom :: Ring s => (r -> s) -> RngRing r -> s instance Show r => Show (RngRing r) instance Read r => Read (RngRing r) instance Rng r => Ring (RngRing r) instance Rng r => Rig (RngRing r) instance Rng r => Rng (RngRing r) instance Rng r => Semiring (RngRing r) instance (Rng r, MultiplicativeGroup r) => MultiplicativeGroup (RngRing r) instance Rng r => Unital (RngRing r) instance Rng s => RightModule (RngRing s) (RngRing s) instance Rng s => LeftModule (RngRing s) (RngRing s) instance (Commutative r, Rng r) => Commutative (RngRing r) instance Rng r => Multiplicative (RngRing r) instance (Abelian r, AdditiveGroup r) => AdditiveGroup (RngRing r) instance (Abelian r, AdditiveGroup r) => RightModule Integer (RngRing r) instance (Abelian r, AdditiveGroup r) => LeftModule Integer (RngRing r) instance (Abelian r, AdditiveMonoid r) => AdditiveMonoid (RngRing r) instance (Abelian r, AdditiveMonoid r) => RightModule Natural (RngRing r) instance (Abelian r, AdditiveMonoid r) => LeftModule Natural (RngRing r) instance Abelian r => Abelian (RngRing r) instance Abelian r => Additive (RngRing r) module Numeric.Ring