-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Anything that associates
--   
--   In mathematics, a semigroup is an algebraic structure consisting of a
--   set together with an associative binary operation. A semigroup
--   generalizes a monoid in that there might not exist an identity
--   element. It also (originally) generalized a group (a monoid with all
--   inverses) to a type where every element did not have to have an
--   inverse, thus the name semigroup.
@package semigroups
@version 0.20

-- | This module provides generic deriving tools for monoids and semigroups
--   for product-like structures.
module Data.Semigroup.Generic

-- | Generically generate a Semigroup (<>) operation
--   for any type implementing Generic. This operation will append
--   two values by point-wise appending their component fields. It is only
--   defined for product types.
--   
--   
--   gmappend a (gmappend b c) = gmappend (gmappend a b) c
--   
gmappend :: (Generic a, GSemigroup (Rep a)) => a -> a -> a

-- | Generically generate a Monoid mempty for any
--   product-like type implementing Generic.
--   
--   It is only defined for product types.
--   
--   
--   gmappend gmempty a = a = gmappend a gmempty
--   
gmempty :: (Generic a, GMonoid (Rep a)) => a

-- | An adapter newtype, suitable for DerivingVia. Its
--   Semigroup and Monoid instances leverage the
--   Generic-based defaults defined by gmappend and
--   gmempty. Here is an example of how to use it:
--   
--   
--   {-# LANGUAGE DerivingVia #-}
--   import Data.Semigroup.Generic
--   
--   data Pair a = MkPair a a
--     deriving (Semigroup, Monoid) via (GenericSemigroupMonoid (Pair a))
--   
newtype GenericSemigroupMonoid a
GenericSemigroupMonoid :: a -> GenericSemigroupMonoid a
[getGenericSemigroupMonoid] :: GenericSemigroupMonoid a -> a
class GSemigroup (f :: Type -> Type)
class GSemigroup f => GMonoid (f :: Type -> Type)
instance (Data.Semigroup.Generic.GMonoid f, Data.Semigroup.Generic.GMonoid g) => Data.Semigroup.Generic.GMonoid (f GHC.Internal.Generics.:*: g)
instance (GHC.Internal.Base.Semigroup a, GHC.Internal.Base.Monoid a) => Data.Semigroup.Generic.GMonoid (GHC.Internal.Generics.K1 i a)
instance Data.Semigroup.Generic.GMonoid f => Data.Semigroup.Generic.GMonoid (GHC.Internal.Generics.M1 i c f)
instance Data.Semigroup.Generic.GMonoid GHC.Internal.Generics.U1
instance (Data.Semigroup.Generic.GSemigroup f, Data.Semigroup.Generic.GSemigroup g) => Data.Semigroup.Generic.GSemigroup (f GHC.Internal.Generics.:*: g)
instance GHC.Internal.Base.Semigroup a => Data.Semigroup.Generic.GSemigroup (GHC.Internal.Generics.K1 i a)
instance Data.Semigroup.Generic.GSemigroup f => Data.Semigroup.Generic.GSemigroup (GHC.Internal.Generics.M1 i c f)
instance Data.Semigroup.Generic.GSemigroup GHC.Internal.Generics.U1
instance Data.Semigroup.Generic.GSemigroup GHC.Internal.Generics.V1
instance (GHC.Internal.Generics.Generic a, Data.Semigroup.Generic.GMonoid (GHC.Internal.Generics.Rep a)) => GHC.Internal.Base.Monoid (Data.Semigroup.Generic.GenericSemigroupMonoid a)
instance (GHC.Internal.Generics.Generic a, Data.Semigroup.Generic.GSemigroup (GHC.Internal.Generics.Rep a)) => GHC.Internal.Base.Semigroup (Data.Semigroup.Generic.GenericSemigroupMonoid a)
