-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Algebraic structures
--
-- Algebraic structures
@package alg
@version 0.2.0.0
module Algebra
-- | The class of semigroups (types with an associative binary operation).
class Semigroup a
-- | An associative operation.
--
--
-- (a <> b) <> c = a <> (b <> c)
--
--
-- If a is also a Monoid we further require
--
--
-- (<>) = mappend
--
(<>) :: Semigroup a => a -> a -> a
-- | Reduce a non-empty list with <>
--
-- The default definition should be sufficient, but this can be
-- overridden for efficiency.
sconcat :: Semigroup a => NonEmpty a -> a
-- | Repeat a value n times.
--
-- Given that this works on a Semigroup it is allowed to fail if
-- you request 0 or fewer repetitions, and the default definition will do
-- so.
--
-- By making this a member of the class, idempotent semigroups and
-- monoids can upgrade this to execute in O(1) by picking
-- stimes = stimesIdempotent or stimes =
-- stimesIdempotentMonoid respectively.
stimes :: (Semigroup a, Integral b) => b -> a -> a
-- | The class of monoids (types with an associative binary operation that
-- has an identity). Instances should satisfy the following laws:
--
--
--
-- The method names refer to the monoid of lists under concatenation, but
-- there are many other instances.
--
-- Some types can be viewed as a monoid in more than one way, e.g. both
-- addition and multiplication on numbers. In such cases we often define
-- newtypes and make those instances of Monoid, e.g.
-- Sum and Product.
class Monoid a
-- | Identity of mappend
mempty :: Monoid a => a
class Monoid a => Group a
invert :: Group a => a -> a
class Semigroup a => Abelian a
class Semigroup a => Idempotent a
(+) :: Semigroup (Sum a) => a -> a -> a
(-) :: (Semigroup (Sum a), Group (Sum a)) => a -> a -> a
(*) :: Semigroup (Product a) => a -> a -> a
(/) :: (Semigroup (Product a), Group (Product a)) => a -> a -> a
instance Algebra.Abelian ()
instance (Algebra.Abelian a, Algebra.Abelian b) => Algebra.Abelian (a, b)
instance (Algebra.Abelian a, Algebra.Abelian b, Algebra.Abelian c) => Algebra.Abelian (a, b, c)
instance (Algebra.Abelian a, Algebra.Abelian b, Algebra.Abelian c, Algebra.Abelian d) => Algebra.Abelian (a, b, c, d)
instance (Algebra.Abelian a, Algebra.Abelian b, Algebra.Abelian c, Algebra.Abelian d, Algebra.Abelian e) => Algebra.Abelian (a, b, c, d, e)
instance Algebra.Abelian a => Algebra.Abelian (Data.Functor.Identity.Identity a)
instance Algebra.Abelian a => Algebra.Abelian (Data.Monoid.Dual a)
instance forall k (a :: k). Algebra.Abelian (Data.Proxy.Proxy a)
instance forall k a (b :: k). Algebra.Abelian a => Algebra.Abelian (Data.Functor.Const.Const a b)
instance Algebra.Abelian b => Algebra.Abelian (a -> b)
instance Algebra.Abelian (Data.Monoid.Sum GHC.Natural.Natural)
instance Algebra.Abelian (Data.Monoid.Sum GHC.Integer.Type.Integer)
instance Algebra.Abelian (Data.Monoid.Sum GHC.Types.Word)
instance Algebra.Abelian (Data.Monoid.Sum GHC.Types.Int)
instance Algebra.Abelian (Data.Monoid.Product GHC.Natural.Natural)
instance Algebra.Abelian (Data.Monoid.Product GHC.Integer.Type.Integer)
instance Algebra.Abelian (Data.Monoid.Product GHC.Types.Word)
instance Algebra.Abelian (Data.Monoid.Product GHC.Types.Int)
instance Algebra.Abelian (Data.Semigroup.Min GHC.Natural.Natural)
instance Algebra.Abelian (Data.Semigroup.Min GHC.Integer.Type.Integer)
instance Algebra.Abelian (Data.Semigroup.Min GHC.Types.Word)
instance Algebra.Abelian (Data.Semigroup.Min GHC.Types.Int)
instance Algebra.Abelian (Data.Semigroup.Max GHC.Natural.Natural)
instance Algebra.Abelian (Data.Semigroup.Max GHC.Integer.Type.Integer)
instance Algebra.Abelian (Data.Semigroup.Max GHC.Types.Word)
instance Algebra.Abelian (Data.Semigroup.Max GHC.Types.Int)
instance Algebra.Abelian Data.Monoid.All
instance Algebra.Abelian Data.Monoid.Any
instance Algebra.Idempotent ()
instance (Algebra.Idempotent a, Algebra.Idempotent b) => Algebra.Idempotent (a, b)
instance (Algebra.Idempotent a, Algebra.Idempotent b, Algebra.Idempotent c) => Algebra.Idempotent (a, b, c)
instance (Algebra.Idempotent a, Algebra.Idempotent b, Algebra.Idempotent c, Algebra.Idempotent d) => Algebra.Idempotent (a, b, c, d)
instance (Algebra.Idempotent a, Algebra.Idempotent b, Algebra.Idempotent c, Algebra.Idempotent d, Algebra.Idempotent e) => Algebra.Idempotent (a, b, c, d, e)
instance Algebra.Idempotent a => Algebra.Idempotent (Data.Functor.Identity.Identity a)
instance Algebra.Idempotent a => Algebra.Idempotent (Data.Monoid.Dual a)
instance forall k (a :: k). Algebra.Idempotent (Data.Proxy.Proxy a)
instance forall k a (b :: k). Algebra.Idempotent a => Algebra.Idempotent (Data.Functor.Const.Const a b)
instance Algebra.Idempotent b => Algebra.Idempotent (a -> b)
instance GHC.Classes.Ord a => Algebra.Idempotent (Data.Semigroup.Min a)
instance GHC.Classes.Ord a => Algebra.Idempotent (Data.Semigroup.Max a)
instance Algebra.Group ()
instance (Algebra.Group a, Algebra.Group b) => Algebra.Group (a, b)
instance (Algebra.Group a, Algebra.Group b, Algebra.Group c) => Algebra.Group (a, b, c)
instance (Algebra.Group a, Algebra.Group b, Algebra.Group c, Algebra.Group d) => Algebra.Group (a, b, c, d)
instance (Algebra.Group a, Algebra.Group b, Algebra.Group c, Algebra.Group d, Algebra.Group e) => Algebra.Group (a, b, c, d, e)
instance Algebra.Group a => Algebra.Group (Data.Functor.Identity.Identity a)
instance Algebra.Group a => Algebra.Group (Data.Monoid.Dual a)
instance forall k (a :: k). Algebra.Group (Data.Proxy.Proxy a)
instance forall k a (b :: k). Algebra.Group a => Algebra.Group (Data.Functor.Const.Const a b)
instance Algebra.Group b => Algebra.Group (a -> b)
instance Algebra.Group (Data.Monoid.Sum GHC.Integer.Type.Integer)
instance Algebra.Group (Data.Monoid.Sum GHC.Types.Int)
instance Algebra.Group (Data.Monoid.Sum GHC.Types.Word)