generics-sop
generics-sop copied to clipboard
Added SOP.Generically and a SOP.Generic instance for GHC.Generically. Updated documentation.
For #153, this adds:
-
generically (package) as a dependency, to support versions before
GHC.Generically
was added (base 4.17). - An
SOP.Generic (GHC.Generically a)
instance.instance (GHC.Generic a, GFrom a, GTo a, All SListI (GCode a)) => Generic (GHC.Generically a) where type Code (GHC.Generically a) = GCode a from :: GHC.Generically a -> Rep (GHC.Generically a) from (GHC.Generically a) = gfrom a to :: Rep (GHC.Generically a) -> GHC.Generically a to rep = GHC.Generically (gto rep)
- An
SOP.HasDatatypeInfo (GHC.Generically a)
instance. - A SOP
Generically
newtype for attaching generic SOP definitions:newtype Generically a = Generically a
All in all deriving SOP.Generic
can be done GHC.Generically
and deriving SOP instances can be done SOP.Generically
:
data Ok = Ok Int Int Int
deriving
stock GHC.Generic
deriving (SOP.Generic, HasDatatypeInfo)
via GHC.Generically
deriving (Eq, NFData, ..) -- assuming we have instances of SOP.Generically
via SOP.Generically
The next step should be writing SOP generic instances for SOP.Generically
, for type classes in base.
Ping on this