semigroups-0.18: Anything that associates

Copyright(C) 2014-2015 Edward Kmett, Eric Mertens
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityprovisional
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

Data.Semigroup.Generic

Description

This module provides generic deriving tools for monoids and semigroups for product-like structures.

Synopsis

Documentation

class GSemigroup f Source

Minimal complete definition

gmappend'

gmappend :: (Generic a, GSemigroup (Rep a)) => a -> a -> a Source

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

class GSemigroup f => GMonoid f Source

Minimal complete definition

gmempty'

Instances

GMonoid U1 Source 
(Semigroup a, Monoid a) => GMonoid (K1 i a) Source 
(GMonoid f, GMonoid g) => GMonoid ((:*:) f g) Source 
GMonoid f => GMonoid (M1 i c f) Source 

gmempty :: (Generic a, GMonoid (Rep a)) => a Source

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