Description
Generically derive Group instances.
Description
Generically derive group instances:
{-# LANGUAGE DeriveGeneric, DerivingVia #-}
import GHC.Generics ( Generic, Generically (..) )
data MyRecord
= MyRecord
{ field1 :: Sum Double
, field2 :: Product Double
, field3 :: ( Sum Int, Sum Int )
}
deriving Generic
deriving ( Semigroup, Monoid, Group )
via Generically MyRecord