generics-sop-0.3.2.0: Generic Programming using True Sums of Products

Safe HaskellNone
LanguageHaskell2010

Generics.SOP.Metadata

Contents

Description

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.

Synopsis

Documentation

type Fixity = Int #

The fixity of an infix constructor.

type FieldName = String #

The name of a field / record selector.

type ConstructorName = String #

The name of a data constructor.

type ModuleName = String #

The name of a module.

type DatatypeName = String #

The name of a datatype.

data FieldInfo :: * -> * where #

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

Constructors

FieldInfo :: FieldName -> FieldInfo a 
Instances
Functor FieldInfo # 
Instance details

Defined in Generics.SOP.Metadata

Methods

fmap :: (a -> b) -> FieldInfo a -> FieldInfo b #

(<$) :: a -> FieldInfo b -> FieldInfo a #

Eq (FieldInfo a) # 
Instance details

Defined in Generics.SOP.Metadata

Methods

(==) :: FieldInfo a -> FieldInfo a -> Bool #

(/=) :: FieldInfo a -> FieldInfo a -> Bool #

Ord (FieldInfo a) # 
Instance details

Defined in Generics.SOP.Metadata

Show (FieldInfo a) # 
Instance details

Defined in Generics.SOP.Metadata

data ConstructorInfo :: [*] -> * where #

Metadata for a single constructors.

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

data DatatypeInfo :: [[*]] -> * 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.

moduleName :: DatatypeInfo xss -> ModuleName #

The module name where a datatype is defined.

Since: generics-sop-0.2.3.0

datatypeName :: DatatypeInfo xss -> DatatypeName #

The name of a datatype (or newtype).

Since: generics-sop-0.2.3.0

constructorInfo :: DatatypeInfo xss -> NP ConstructorInfo xss #

The constructor info for a datatype (or newtype).

Since: generics-sop-0.2.3.0

constructorName :: ConstructorInfo xs -> ConstructorName #

The name of a constructor.

Since: generics-sop-0.2.3.0

fieldName :: FieldInfo a -> FieldName #

The name of a field.

Since: generics-sop-0.2.3.0

re-exports

data Associativity #

Datatype to represent the associativity of a constructor

Instances
Bounded Associativity 
Instance details

Defined in GHC.Generics

Enum Associativity 
Instance details

Defined in GHC.Generics

Eq Associativity 
Instance details

Defined in GHC.Generics

Data Associativity

Since: base-4.9.0.0

Instance details

Defined in Data.Data

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Associativity -> c Associativity #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Associativity #

toConstr :: Associativity -> Constr #

dataTypeOf :: Associativity -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Associativity) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Associativity) #

gmapT :: (forall b. Data b => b -> b) -> Associativity -> Associativity #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Associativity -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Associativity -> r #

gmapQ :: (forall d. Data d => d -> u) -> Associativity -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Associativity -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Associativity -> m Associativity #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Associativity -> m Associativity #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Associativity -> m Associativity #

Ord Associativity 
Instance details

Defined in GHC.Generics

Read Associativity 
Instance details

Defined in GHC.Generics

Show Associativity 
Instance details

Defined in GHC.Generics

Ix Associativity 
Instance details

Defined in GHC.Generics

Generic Associativity 
Instance details

Defined in GHC.Generics

Associated Types

type Rep Associativity :: * -> * #

SingKind Associativity

Since: base-4.0.0.0

Instance details

Defined in GHC.Generics

Associated Types

type DemoteRep Associativity :: *

Methods

fromSing :: Sing a -> DemoteRep Associativity

SingI LeftAssociative

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

sing :: Sing LeftAssociative

SingI RightAssociative

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

sing :: Sing RightAssociative

SingI NotAssociative

Since: base-4.9.0.0

Instance details

Defined in GHC.Generics

Methods

sing :: Sing NotAssociative

type Rep Associativity 
Instance details

Defined in GHC.Generics

type Rep Associativity = D1 (MetaData "Associativity" "GHC.Generics" "base" False) (C1 (MetaCons "LeftAssociative" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "RightAssociative" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "NotAssociative" PrefixI False) (U1 :: * -> *)))
data Sing (a :: Associativity) 
Instance details

Defined in GHC.Generics

type DemoteRep Associativity 
Instance details

Defined in GHC.Generics

type DemoteRep Associativity = Associativity