HORIZON HASKELLDocslts/ghc-10.0.x2b276322026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 2b27632 · 2026-10-31

Modulesemigroups-0.20.1Haskell98

Data.Semigroup.Generic

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

Contents
  1. Generic method implementations
  2. Adapter newtype
  3. Internal classes
Synopsis

Generic method implementations

Adapter newtype

newtypenewtype GenericSemigroupMonoid 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))
Instances2Semigroup, Monoid

Internal classes