Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data TypeInfo a
- fieldNames :: TypeInfo a -> [String]
- fieldTypes :: TypeInfo a -> [SomeTypeRep]
- constructorName :: TypeInfo a -> String
- typeInfo :: forall a. (HasConstructor (Rep a), HasSelectors (Rep a), Generic a) => TypeInfo a
- class HasConstructor (f :: Type -> Type) where
- genericConstrName :: f x -> String
- class HasSelectors rep where
- selectors :: [(String, SomeTypeRep)]
Documentation
A data type holding meta-data about a type.
The Phantom type parameter a
ensures type safety for reflective functions
that use this type to create type instances.
fieldNames :: TypeInfo a -> [String] Source #
fieldTypes :: TypeInfo a -> [SomeTypeRep] Source #
constructorName :: TypeInfo a -> String Source #
typeInfo :: forall a. (HasConstructor (Rep a), HasSelectors (Rep a), Generic a) => TypeInfo a Source #
this function is a smart constructor for TypeInfo objects.
It takes a value of type a
and returns a `TypeInfo a` object.
If the type has no named fields, an error is thrown.
If the type has more than one constructor, an error is thrown.
class HasConstructor (f :: Type -> Type) where Source #
genericConstrName :: f x -> String Source #
Instances
(HasConstructor x, HasConstructor y) => HasConstructor (x :+: y) Source # | |
Defined in Database.GP.TypeInfo genericConstrName :: (x :+: y) x0 -> String Source # | |
Constructor c => HasConstructor (C1 c f) Source # | |
Defined in Database.GP.TypeInfo genericConstrName :: C1 c f x -> String Source # | |
HasConstructor f => HasConstructor (D1 c f) Source # | |
Defined in Database.GP.TypeInfo genericConstrName :: D1 c f x -> String Source # |
class HasSelectors rep where Source #
selectors :: [(String, SomeTypeRep)] Source #
Instances
HasSelectors (U1 :: k -> Type) Source # | |
Defined in Database.GP.TypeInfo selectors :: [(String, SomeTypeRep)] Source # | |
(HasSelectors a, HasSelectors b) => HasSelectors (a :*: b :: k -> Type) Source # | |
Defined in Database.GP.TypeInfo selectors :: [(String, SomeTypeRep)] Source # | |
HasSelectors f => HasSelectors (M1 C x f :: k -> Type) Source # | |
Defined in Database.GP.TypeInfo selectors :: [(String, SomeTypeRep)] Source # | |
HasSelectors f => HasSelectors (M1 D x f :: k -> Type) Source # | |
Defined in Database.GP.TypeInfo selectors :: [(String, SomeTypeRep)] Source # | |
(Selector s, Typeable t) => HasSelectors (M1 S s (K1 R t :: k -> Type) :: k -> Type) Source # | |
Defined in Database.GP.TypeInfo selectors :: [(String, SomeTypeRep)] Source # |