The constructor info for a datatype (or newtype).
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.
- 13 types
- 5 values
- Packagegenerics-sop-0.5.1.4
- Exports18
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceMetadata.hs
The name of a constructor.
The name of a datatype (or newtype).
The name of a field.
The module name where a datatype is defined.
Metadata for a single constructor.
This is indexed by the product structure of the constructor components.
Constructors
Constructor :: SListI a => ConstructorName -> ConstructorInfo aInfix :: ConstructorName -> Associativity -> Fixity -> ConstructorInfo '[x, y]Record :: SListI a => ConstructorName -> NP FieldInfo a -> ConstructorInfo a
Instances3Eq, Ord, Show
All (Compose Eq FieldInfo) xs => Eq (ConstructorInfo xs)Defined in generics-sop-0.5.1.4 · Generics.SOP.Metadata(All (Compose Eq FieldInfo) xs, All (Compose Ord FieldInfo) xs) => Ord (ConstructorInfo xs)Defined in generics-sop-0.5.1.4 · Generics.SOP.MetadataAll (Compose Show FieldInfo) xs => Show (ConstructorInfo xs)Defined in generics-sop-0.5.1.4 · Generics.SOP.Metadata
The name of a data constructor.
Metadata for a datatype.
A value of type DatatypeInfo c contains the information about a datatype
that is not contained in . This information consists
primarily of the names of the datatype, its constructors, and possibly its
record selectors.Code c
The constructor indicates whether the datatype has been declared using newtype
or not.
Constructors
ADT :: ModuleName -> DatatypeName -> NP ConstructorInfo a -> POP StrictnessInfo a -> DatatypeInfo aNewtype :: ModuleName -> DatatypeName -> ConstructorInfo '[x] -> DatatypeInfo '['[x]]
Instances3Eq, Ord, Show
(All (Compose Eq ConstructorInfo) xs, All (Compose Eq (NP StrictnessInfo)) xs) => Eq (DatatypeInfo xs)Defined in generics-sop-0.5.1.4 · Generics.SOP.Metadata(All (Compose Eq ConstructorInfo) xs, All (Compose Ord ConstructorInfo) xs, All (Compose Eq (NP StrictnessInfo)) xs, All (Compose Ord (NP StrictnessInfo)) xs) => Ord (DatatypeInfo xs)Defined in generics-sop-0.5.1.4 · Generics.SOP.Metadata(All (Compose Show ConstructorInfo) xs, All (Compose Show (NP StrictnessInfo)) xs) => Show (DatatypeInfo xs)Defined in generics-sop-0.5.1.4 · Generics.SOP.Metadata
The name of a datatype.
For records, this functor maps the component to its selector name.
Instances4Functor, Eq, Ord, Show
The name of a field / record selector.
The fixity of an infix constructor.
The name of a module.
Metadata for strictness information of a field.
Indexed by the type of the field.
Constructors
Instances4Functor, Eq, Ord, Show
Functor StrictnessInfoDefined in generics-sop-0.5.1.4 · Generics.SOP.MetadataEq (StrictnessInfo a)Defined in generics-sop-0.5.1.4 · Generics.SOP.MetadataOrd (StrictnessInfo a)Defined in generics-sop-0.5.1.4 · Generics.SOP.MetadataShow (StrictnessInfo a)Defined in generics-sop-0.5.1.4 · Generics.SOP.Metadata
re-exports
4 declarationsDatatype to represent the associativity of a constructor
Instances20Bounded, Enum, Eq, Data, Ord, Read, …
Bounded AssociativityDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsEnum AssociativityDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsEq AssociativityDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsData AssociativityDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.DataOrd AssociativityDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsRead AssociativityDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsShow AssociativityDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsIx AssociativityDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsGeneric AssociativityDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsSingKind AssociativityDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsGeneric AssociativityDefined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphanHasDatatypeInfo AssociativityDefined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphanSingI 'LeftAssociativeDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsSingI 'NotAssociativeDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsSingI 'RightAssociativeDefined in ghc-internal-9.1401.0 · GHC.Internal.Genericstype Rep Associativity = D1 ('MetaDataDefined in ghc-internal-9.1401.0 · GHC.Internal.Generics"Associativity"
"GHC.Internal.Generics"
"ghc-internal"
'False) (C1 ('MetaCons"LeftAssociative"
'PrefixI 'False) U1 :+: (C1 ('MetaCons"RightAssociative"
'PrefixI 'False) U1 :+: C1 ('MetaCons"NotAssociative"
'PrefixI 'False) U1))type DemoteRep Associativity = AssociativityDefined in ghc-internal-9.1401.0 · GHC.Internal.Genericsdata SingSLeftAssociative :: R:SingAssociativitya 'LeftAssociativeSRightAssociative :: R:SingAssociativitya 'RightAssociativeSNotAssociative :: R:SingAssociativitya 'NotAssociative
type Code Associativity = '['[], '[], '[]]Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphantype DatatypeInfoOf Associativity = 'ADTDefined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan"GHC.Internal.Generics"
"Associativity"
'['Constructor"LeftAssociative"
, 'Constructor"RightAssociative"
, 'Constructor"NotAssociative"
] '['[], '[], '[]]
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
If compiled without optimization or other language extensions, then the fields of
ExampleConstructorwill have DecidedStrict, DecidedStrict, and DecidedLazy, respectively.If compiled with
-XStrictDataenabled, then the fields will have DecidedStrict, DecidedStrict, and DecidedStrict, respectively.If compiled with
-O2enabled, then the fields will have DecidedUnpack, DecidedStrict, and DecidedLazy, respectively.
Instances20Bounded, Enum, Eq, Data, Ord, Read, …
Bounded DecidedStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsEnum DecidedStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsEq DecidedStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsData DecidedStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.DataOrd DecidedStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsRead DecidedStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsShow DecidedStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsIx DecidedStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsGeneric DecidedStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsSingKind DecidedStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsGeneric DecidedStrictnessDefined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphanHasDatatypeInfo DecidedStrictnessDefined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphanSingI 'DecidedLazyDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsSingI 'DecidedStrictDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsSingI 'DecidedUnpackDefined in ghc-internal-9.1401.0 · GHC.Internal.Genericstype Rep DecidedStrictness = D1 ('MetaDataDefined in ghc-internal-9.1401.0 · GHC.Internal.Generics"DecidedStrictness"
"GHC.Internal.Generics"
"ghc-internal"
'False) (C1 ('MetaCons"DecidedLazy"
'PrefixI 'False) U1 :+: (C1 ('MetaCons"DecidedStrict"
'PrefixI 'False) U1 :+: C1 ('MetaCons"DecidedUnpack"
'PrefixI 'False) U1))type DemoteRep DecidedStrictness = DecidedStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.Genericsdata SingSDecidedLazy :: R:SingDecidedStrictnessa 'DecidedLazySDecidedStrict :: R:SingDecidedStrictnessa 'DecidedStrictSDecidedUnpack :: R:SingDecidedStrictnessa 'DecidedUnpack
type Code DecidedStrictness = '['[], '[], '[]]Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphantype DatatypeInfoOf DecidedStrictness = 'ADTDefined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan"GHC.Internal.Generics"
"DecidedStrictness"
'['Constructor"DecidedLazy"
, 'Constructor"DecidedStrict"
, 'Constructor"DecidedUnpack"
] '['[], '[], '[]]
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, …
Bounded SourceStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsEnum SourceStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsEq SourceStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsData SourceStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.DataOrd SourceStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsRead SourceStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsShow SourceStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsIx SourceStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsGeneric SourceStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsSingKind SourceStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsGeneric SourceStrictnessDefined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphanHasDatatypeInfo SourceStrictnessDefined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphanSingI 'NoSourceStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsSingI 'SourceLazyDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsSingI 'SourceStrictDefined in ghc-internal-9.1401.0 · GHC.Internal.Genericstype Rep SourceStrictness = D1 ('MetaDataDefined in ghc-internal-9.1401.0 · GHC.Internal.Generics"SourceStrictness"
"GHC.Internal.Generics"
"ghc-internal"
'False) (C1 ('MetaCons"NoSourceStrictness"
'PrefixI 'False) U1 :+: (C1 ('MetaCons"SourceLazy"
'PrefixI 'False) U1 :+: C1 ('MetaCons"SourceStrict"
'PrefixI 'False) U1))type DemoteRep SourceStrictness = SourceStrictnessDefined in ghc-internal-9.1401.0 · GHC.Internal.Genericsdata SingSNoSourceStrictness :: R:SingSourceStrictnessa 'NoSourceStrictnessSSourceLazy :: R:SingSourceStrictnessa 'SourceLazySSourceStrict :: R:SingSourceStrictnessa 'SourceStrict
type Code SourceStrictness = '['[], '[], '[]]Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphantype DatatypeInfoOf SourceStrictness = 'ADTDefined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan"GHC.Internal.Generics"
"SourceStrictness"
'['Constructor"NoSourceStrictness"
, 'Constructor"SourceLazy"
, 'Constructor"SourceStrict"
] '['[], '[], '[]]
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, …
Bounded SourceUnpackednessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsEnum SourceUnpackednessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsEq SourceUnpackednessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsData SourceUnpackednessDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.DataOrd SourceUnpackednessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsRead SourceUnpackednessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsShow SourceUnpackednessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsIx SourceUnpackednessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsGeneric SourceUnpackednessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsSingKind SourceUnpackednessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsGeneric SourceUnpackednessDefined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphanHasDatatypeInfo SourceUnpackednessDefined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphanSingI 'NoSourceUnpackednessDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsSingI 'SourceNoUnpackDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsSingI 'SourceUnpackDefined in ghc-internal-9.1401.0 · GHC.Internal.Genericstype Rep SourceUnpackedness = D1 ('MetaDataDefined in ghc-internal-9.1401.0 · GHC.Internal.Generics"SourceUnpackedness"
"GHC.Internal.Generics"
"ghc-internal"
'False) (C1 ('MetaCons"NoSourceUnpackedness"
'PrefixI 'False) U1 :+: (C1 ('MetaCons"SourceNoUnpack"
'PrefixI 'False) U1 :+: C1 ('MetaCons"SourceUnpack"
'PrefixI 'False) U1))type DemoteRep SourceUnpackedness = SourceUnpackednessDefined in ghc-internal-9.1401.0 · GHC.Internal.Genericsdata SingSNoSourceUnpackedness :: R:SingSourceUnpackednessa 'NoSourceUnpackednessSSourceNoUnpack :: R:SingSourceUnpackednessa 'SourceNoUnpackSSourceUnpack :: R:SingSourceUnpackednessa 'SourceUnpack
type Code SourceUnpackedness = '['[], '[], '[]]Defined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphantype DatatypeInfoOf SourceUnpackedness = 'ADTDefined in generics-sop-0.5.1.4 · Generics.SOP.Instances · orphan"GHC.Internal.Generics"
"SourceUnpackedness"
'['Constructor"NoSourceUnpackedness"
, 'Constructor"SourceNoUnpack"
, 'Constructor"SourceUnpack"
] '['[], '[], '[]]