generics-sop-0.1.1.1: Generic Programming using True Sums of Products

Safe HaskellNone
LanguageHaskell2010

Generics.SOP.GGP

Description

Derive generics-sop boilerplate instances from GHC's Generic.

The technique being used here is described in the following paper:

Synopsis

Documentation

type GCode a = ToSumCode (Rep a) [] Source

Compute the SOP code of a datatype.

This requires that Rep is defined, which in turn requires that the type has a Generic (from module GHC.Generics) instance.

This is the default definition for Code. For more info, see Generic.

type GFrom a = GSumFrom (Rep a) Source

Constraint for the class that computes gfrom.

type GTo a = GSumTo (Rep a) Source

Constraint for the class that computes gto.

type GDatatypeInfo a = GDatatypeInfo' (Rep a) Source

Constraint for the class that computes gdatatypeInfo.

gfrom :: (GFrom a, Generic a) => a -> SOP I (GCode a) Source

An automatically computed version of from.

This requires that the type being converted has a Generic (from module GHC.Generics) instance.

This is the default definition for from. For more info, see Generic.

gto :: forall a. (GTo a, Generic a) => SOP I (GCode a) -> a Source

An automatically computed version of to.

This requires that the type being converted has a Generic (from module GHC.Generics) instance.

This is the default definition for to. For more info, see Generic.

gdatatypeInfo :: forall a. GDatatypeInfo a => Proxy a -> DatatypeInfo (GCode a) Source

An automatically computed version of datatypeInfo.

This requires that the type being converted has a Generic (from module GHC.Generics) instance.

This is the default definition for datatypeInfo. For more info, see HasDatatypeInfo.