Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

## Synopsis

- genericMappend :: (Generic a, MappendProduct (Rep a)) => a -> a -> a
- genericMempty :: (Generic a, MemptyProduct (Rep a)) => a
- newtype GenericSemigroup a = GenericSemigroup a
- newtype GenericMonoid a = GenericMonoid a

# Documentation

genericMappend :: (Generic a, MappendProduct (Rep a)) => a -> a -> a Source #

genericMempty :: (Generic a, MemptyProduct (Rep a)) => a Source #

newtype GenericSemigroup a Source #

A newtype which allows you to using the `DerivingVia`

extension
to reduce boilerplate.

data X = X [Int] String deriving (Generic, Show) deriving Semigroup via GenericSemigroup X

## Instances

(Generic a, MappendProduct (Rep a)) => Semigroup (GenericSemigroup a) Source # | |

Defined in Data.Semigroup.Generic (<>) :: GenericSemigroup a -> GenericSemigroup a -> GenericSemigroup a # sconcat :: NonEmpty (GenericSemigroup a) -> GenericSemigroup a # stimes :: Integral b => b -> GenericSemigroup a -> GenericSemigroup a # |

newtype GenericMonoid a Source #

A newtype which allows you to using the `DerivingVia`

extension
to reduce boilerplate.

data X = X [Int] String deriving (Generic, Show) deriving Semigroup via GenericSemigroup X deriving Monoid via GenericMonoid X

Note: Do NOT attempt to `derive Semigroup via GenericMonoid`

. That will lead
to infinite recursion.

## Instances

Show a => Show (GenericMonoid a) Source # | |

Defined in Data.Monoid.Generic showsPrec :: Int -> GenericMonoid a -> ShowS # show :: GenericMonoid a -> String # showList :: [GenericMonoid a] -> ShowS # | |

Semigroup a => Semigroup (GenericMonoid a) Source # | |

Defined in Data.Monoid.Generic (<>) :: GenericMonoid a -> GenericMonoid a -> GenericMonoid a # sconcat :: NonEmpty (GenericMonoid a) -> GenericMonoid a # stimes :: Integral b => b -> GenericMonoid a -> GenericMonoid a # | |

(Semigroup a, Generic a, MemptyProduct (Rep a)) => Monoid (GenericMonoid a) Source # | |

Defined in Data.Monoid.Generic mempty :: GenericMonoid a # mappend :: GenericMonoid a -> GenericMonoid a -> GenericMonoid a # mconcat :: [GenericMonoid a] -> GenericMonoid a # |