HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulegeneric-monoid-0.1.0.1Haskell2010

Data.Semigroup.Generic

  • 1 type
  • 1 value
valuegenericMappend :: (Generic a, MappendProduct (Rep a)) => a -> a -> a
#

A generic <> function which works for product types where each contained type is itself a Semigroup. It simply calls <> for each field.

If you don't want to use the deriving via mechanism, use this function to implement the Semigroup type class.

newtypenewtype GenericSemigroup a
#

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

Constructors

Instances1Semigroup