-- 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.19.1

-- | 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
class GSemigroup f => GMonoid f
instance (GHC.Generics.Generic a, Data.Semigroup.Generic.GSemigroup (GHC.Generics.Rep a)) => GHC.Base.Semigroup (Data.Semigroup.Generic.GenericSemigroupMonoid a)
instance (GHC.Generics.Generic a, Data.Semigroup.Generic.GMonoid (GHC.Generics.Rep a)) => GHC.Base.Monoid (Data.Semigroup.Generic.GenericSemigroupMonoid a)
instance Data.Semigroup.Generic.GMonoid GHC.Generics.U1
instance (GHC.Base.Semigroup a, GHC.Base.Monoid a) => Data.Semigroup.Generic.GMonoid (GHC.Generics.K1 i a)
instance Data.Semigroup.Generic.GMonoid f => Data.Semigroup.Generic.GMonoid (GHC.Generics.M1 i c f)
instance (Data.Semigroup.Generic.GMonoid f, Data.Semigroup.Generic.GMonoid g) => Data.Semigroup.Generic.GMonoid (f GHC.Generics.:*: g)
instance Data.Semigroup.Generic.GSemigroup GHC.Generics.U1
instance Data.Semigroup.Generic.GSemigroup GHC.Generics.V1
instance GHC.Base.Semigroup a => Data.Semigroup.Generic.GSemigroup (GHC.Generics.K1 i a)
instance Data.Semigroup.Generic.GSemigroup f => Data.Semigroup.Generic.GSemigroup (GHC.Generics.M1 i c f)
instance (Data.Semigroup.Generic.GSemigroup f, Data.Semigroup.Generic.GSemigroup g) => Data.Semigroup.Generic.GSemigroup (f GHC.Generics.:*: g)
