Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data TypeInfo a
- $sel:fieldNames:TypeInfo :: TypeInfo a -> [String]
- $sel:fieldTypes:TypeInfo :: TypeInfo a -> [SomeTypeRep]
- $sel:constructorName:TypeInfo :: 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.
$sel:fieldNames:TypeInfo :: TypeInfo a -> [String] Source #
$sel:fieldTypes:TypeInfo :: TypeInfo a -> [SomeTypeRep] 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
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 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 # |