HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleth-utilities-0.2.5.2Haskell2010

TH.ReifySimple

Utilities for reifying simplified datatype info. It omits details that aren't usually relevant to generating instances that work with the datatype. This makes it easier to use TH to derive instances.

The "Simple" in the module name refers to the simplicity of the datatypes, not the module itself, which exports quite a few things which are useful in some circumstance or another. I anticipate that the most common uses of this will be the following APIs:

  • Getting info about a data or newtype declaration, via DataType, reifyDataType, and DataCon. This is useful for writing something which generates declarations based on a datatype, one of the most common uses of Template Haskell.

  • Getting nicely structured info about a named type. See TypeInfo and reifyType. This does not yet support reifying typeclasses, primitive type constructors, or type variables (TyVarI).

Currently, this module supports reifying simplified versions of the following Info constructors:

In the future it will hopefully also have support for the remaining Info constructors, ClassI, ClassOpI, PrimTyConI, VarI, and TyVarI.

  • 7 types
  • 15 values

Reifying simplified type info

5 declarations

Reifying simplified info for specific declaration varieties

0 declarations

Datatype info

datadata DataType
#

Simplified info about a DataD. Omits deriving, strictness, kind info, and whether it's data or newtype.

Constructors

Instances6Eq, Data, Ord, Show, Generic, Rep

Data constructor info

datadata DataCon
#

Simplified info about a Con. Omits deriving, strictness, and kind info. This is much nicer than consuming Con directly, because it unifies all the constructors into one.

Constructors

Instances6Eq, Data, Ord, Show, Generic, Rep

Data family info

datadata DataFamily
#

Simplified info about a data family. Omits deriving, strictness, and kind info.

Instances6Eq, Data, Ord, Show, Generic, Rep
datadata DataInst
#

Simplified info about a data family instance. Omits deriving, strictness, and kind info.

Instances6Eq, Data, Ord, Show, Generic, Rep

Type family info

datadata TypeFamily
#

Simplified info about a type family. Omits kind info and injectivity info.

Instances6Eq, Data, Ord, Show, Generic, Rep
datadata TypeInst
#

Simplified info about a type family instance. Omits nothing.

Instances6Eq, Data, Ord, Show, Generic, Rep

Other utilities

2 declarations