HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulegenerics-sop-0.5.1.4Haskell2010

Generics.SOP.Metadata

Metadata about what a datatype looks like

In generics-sop, the metadata is completely independent of the main universe. Many generic functions will use this metadata, but other don't, and yet others might need completely different metadata.

This module defines a datatype to represent standard metadata, i.e., names of the datatype, its constructors, and possibly its record selectors. Metadata descriptions are in general GADTs indexed by the code of the datatype they're associated with, so matching on the metadata will reveal information about the shape of the datatype.

Contents
  1. re-exports
Synopsis
datadata ConstructorInfo (a :: [Type]) where

Metadata for a single constructor.

This is indexed by the product structure of the constructor components.

Instances3Eq, Ord, Show
datadata DatatypeInfo (a :: [[Type]]) where

Metadata for a datatype.

A value of type DatatypeInfo c contains the information about a datatype that is not contained in Code c. 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.

Instances3Eq, Ord, Show
datadata FieldInfo a where

For records, this functor maps the component to its selector name.

Constructors

Instances4Functor, Eq, Ord, Show
  • Functor FieldInfoDefined in generics-sop-0.5.1.4 · Generics.SOP.Metadata
  • Eq (FieldInfo a)Defined in generics-sop-0.5.1.4 · Generics.SOP.Metadata
  • Ord (FieldInfo a)Defined in generics-sop-0.5.1.4 · Generics.SOP.Metadata
  • Show (FieldInfo a)Defined in generics-sop-0.5.1.4 · Generics.SOP.Metadata
datadata StrictnessInfo a where

Metadata for strictness information of a field.

Indexed by the type of the field.

Instances4Functor, Eq, Ord, Show

re-exports

datadata Associativity

Datatype to represent the associativity of a constructor

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

The strictness that GHC infers for a field during compilation. Whereas there are nine different combinations of SourceUnpackedness and SourceStrictness, the strictness that GHC decides will ultimately be one of lazy, strict, or unpacked. What GHC decides is affected both by what the user writes in the source code and by GHC flags. As an example, consider this data type:

data E = ExampleConstructor {-# UNPACK #-} !Int !Int Int
Instances20Bounded, Enum, Eq, Data, Ord, Read, …

The strictness of a field as the user wrote it in the source code. For example, in the following data type:

data E = ExampleConstructor Int ~Int !Int

The fields of ExampleConstructor have NoSourceStrictness, SourceLazy, and SourceStrict, respectively.

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

The unpackedness of a field as the user wrote it in the source code. For example, in the following data type:

data E = ExampleConstructor     Int
           {-# NOUNPACK #-} Int
           {-#   UNPACK #-} Int

The fields of ExampleConstructor have NoSourceUnpackedness, SourceNoUnpack, and SourceUnpack, respectively.

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