Safe Haskell | None |
---|---|
Language | Haskell2010 |
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.
- data DatatypeInfo :: [[*]] -> * where
- ADT :: ModuleName -> DatatypeName -> NP ConstructorInfo xss -> DatatypeInfo xss
- Newtype :: ModuleName -> DatatypeName -> ConstructorInfo '[x] -> DatatypeInfo '['[x]]
- data ConstructorInfo :: [*] -> * where
- Constructor :: SListI xs => ConstructorName -> ConstructorInfo xs
- Infix :: ConstructorName -> Associativity -> Fixity -> ConstructorInfo '[x, y]
- Record :: SListI xs => ConstructorName -> NP FieldInfo xs -> ConstructorInfo xs
- data FieldInfo :: * -> * where
- type DatatypeName = String
- type ModuleName = String
- type ConstructorName = String
- type FieldName = String
- type Fixity = Int
- data Associativity :: *
Documentation
data DatatypeInfo :: [[*]] -> * where Source #
Metadata for a datatype.
A value of type
contains the information about a datatype
that is not contained in DatatypeInfo
c
. 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.
ADT :: ModuleName -> DatatypeName -> NP ConstructorInfo xss -> DatatypeInfo xss | |
Newtype :: ModuleName -> DatatypeName -> ConstructorInfo '[x] -> DatatypeInfo '['[x]] |
data ConstructorInfo :: [*] -> * where Source #
Metadata for a single constructors.
This is indexed by the product structure of the constructor components.
Constructor :: SListI xs => ConstructorName -> ConstructorInfo xs | |
Infix :: ConstructorName -> Associativity -> Fixity -> ConstructorInfo '[x, y] | |
Record :: SListI xs => ConstructorName -> NP FieldInfo xs -> ConstructorInfo xs |
data FieldInfo :: * -> * where Source #
For records, this functor maps the component to its selector name.
type DatatypeName = String Source #
The name of a datatype.
type ModuleName = String Source #
The name of a module.
type ConstructorName = String Source #
The name of a data constructor.
re-exports
data Associativity :: * #
Datatype to represent the associativity of a constructor
Bounded Associativity | |
Enum Associativity | |
Eq Associativity | |
Data Associativity | |
Ord Associativity | |
Read Associativity | |
Show Associativity | |
Ix Associativity | |
Generic Associativity | |
SingI Associativity LeftAssociative | |
SingI Associativity RightAssociative | |
SingI Associativity NotAssociative | |
SingKind Associativity (KProxy Associativity) | |
type Rep Associativity | |
data Sing Associativity | |
type DemoteRep Associativity (KProxy Associativity) | |