generic-persistence-0.2.0.0: Database persistence using generics
Safe HaskellSafe-Inferred
LanguageGHC2021

Database.GP.TypeInfo

Synopsis

Documentation

data TypeInfo a Source #

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 (See module RecordtypeReflection).

Instances

Instances details
Show (TypeInfo a) Source # 
Instance details

Defined in Database.GP.TypeInfo

Methods

showsPrec :: Int -> TypeInfo a -> ShowS #

show :: TypeInfo a -> String #

showList :: [TypeInfo a] -> ShowS #

typeName :: TypeInfo a -> String Source #

This function returns the (unqualified) type name of a from a `TypeInfo a` object.

typeInfo :: Data a => 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.

typeInfoFromContext :: forall a. Data a => TypeInfo a Source #

This function creates a TypeInfo object from the context of a function call. The Phantom Type parameter a is used to convince the compiler that the `TypeInfo a` object really describes type a. See also https://stackoverflow.com/questions/75171829/how-to-obtain-a-data-data-constr-etc-from-a-type-representation