HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulegenerics-sop-0.5.1.4Haskell2010

Generics.SOP.Type.Metadata

Type-level metadata

This module provides datatypes (to be used promoted) that can represent the metadata of Haskell datatypes on the type level.

We do not reuse the term-level metadata types, because these are GADTs that incorporate additional invariants. We could (at least in GHC 8) impose the same invariants on the type level as well, but some tests have revealed that the resulting type are rather inconvenient to work with.

So we use simple datatypes to represent the type-level metadata, even if this means that some invariants are not explicitly captured.

We establish a relation between the term- and type-level versions of the metadata by automatically computing the term-level version from the type-level version.

As we now have two versions of metadata (term-level and type-level) with very similar, yet slightly different datatype definitions, the names between the modules clash, and this module is recommended to be imported qualified when needed.

The interface exported by this module is still somewhat experimental.

  • 10 types
  • 12 classes
datadata DatatypeInfo
#

Metadata for a datatype (to be used promoted).

A type of kind DatatypeInfo contains meta-information about a datatype that is not contained in its code. This information consists primarily of the names of the datatype, its constructors, and possibly its record selectors.

The constructor indicates whether the datatype has been declared using newtype or not.

datadata ConstructorInfo
#

Metadata for a single constructors (to be used promoted).

Constructors

Instances2DemoteConstructorInfos
typetype Fixity = Nat
#

The fixity of an infix constructor.

datadata StrictnessInfo
#

Strictness information for a single field (to be used promoted).

Instances4DemoteStrictnessInfos, DemoteStrictnessInfoss
classclass DemoteDatatypeInfo (x :: DatatypeInfo) (xss :: [[Type]]) where
#

Class for computing term-level datatype information from type-level datatype information.

Methods

  • demoteDatatypeInfo :: proxy x -> DatatypeInfo xss

    Given a proxy of some type-level datatype information, return the corresponding term-level information.

Instances2DemoteDatatypeInfo
classclass DemoteConstructorInfos (cs :: [ConstructorInfo]) (xss :: [[Type]]) where
#

Class for computing term-level constructor information from type-level constructor information.

Methods

Instances2DemoteConstructorInfos
classclass DemoteConstructorInfo (x :: ConstructorInfo) (xs :: [Type]) where
#

Class for computing term-level constructor information from type-level constructor information.

Methods

Instances3DemoteConstructorInfo
classclass DemoteAssociativity (a :: Associativity) where
#

Class for computing term-level associativity information from type-level associativity information.

Methods

Instances3DemoteAssociativity
classclass SListI xs => DemoteFieldInfos (fs :: [FieldInfo]) (xs :: [Type]) where
#

Class for computing term-level field information from type-level field information.

Methods

  • demoteFieldInfos :: proxy fs -> NP FieldInfo xs

    Given a proxy of some type-level field information, return the corresponding term-level information as a product.

Instances2DemoteFieldInfos
classclass DemoteSourceUnpackedness (a :: SourceUnpackedness) where
#

Class for computing term-level source unpackedness information from type-level source unpackedness information.

Methods

Instances3DemoteSourceUnpackedness
classclass DemoteSourceStrictness (a :: SourceStrictness) where
#

Class for computing term-level source strictness information from type-level source strictness information.

Methods

Instances3DemoteSourceStrictness
classclass DemoteDecidedStrictness (a :: DecidedStrictness) where
#

Class for computing term-level decided strictness information from type-level decided strictness information.

Methods

Instances3DemoteDecidedStrictness
classclass DemoteFieldInfo (x :: FieldInfo) a where
#

Class for computing term-level field information from type-level field information.

Methods

  • demoteFieldInfo :: proxy x -> FieldInfo a

    Given a proxy of some type-level field information, return the corresponding term-level information.

Instances1DemoteFieldInfo

re-exports

1 declaration
datadata Associativity
#

Datatype to represent the associativity of a constructor

Instances20Bounded, Enum, Eq, Data, Ord, Read, …