HORIZON HASKELLDocslts/ghc-9.14.x7a6c33e2026-10-12Search packagesCtrl K
Theme: |

GHC 9.14.1 · lts/ghc-9.14.x · 7a6c33e · 2026-10-12

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