HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

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.

Contents
  1. Reifying simplified type info
  2. Reifying simplified info for specific declaration varieties
  3. Datatype info
  4. Data constructor info
  5. Data family info
  6. Type family info
  7. Other utilities
Synopsis

Reifying simplified type info

Reifying simplified info for specific declaration varieties

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