haskus-utils-types-1.5: Haskus types utility modules

Safe HaskellNone
LanguageHaskell2010

Haskus.Utils.Types.Generics

Contents

Description

Generics

Synopsis

Documentation

Fields

data Field (name :: Symbol) (t :: *) Source #

Named field

type family FieldType f where ... Source #

Equations

FieldType (Field name t) = t 

type family LookupField (fs :: [*]) (s :: Symbol) where ... Source #

Equations

LookupField (Field name t ': fs) name = Field name t 
LookupField (Field name t ': fs) s = LookupField fs s 
LookupField '[] name = TypeError (Text "Cannot find field with name: " :<>: ShowType name) 

type family LookupFieldType fs s where ... Source #

Equations

LookupFieldType fs s = FieldType (LookupField fs s) 

Data type fields

type family ExtractFields (a :: *) where ... Source #

Extract fields of a data type: - require selector symbols - only support data type with a single constructor

Equations

ExtractFields a = ExtractFields' (Rep a) 

type family ExtractFieldTypes (a :: *) where ... Source #

Extract types of the fields of a data type - only support data type with a single constructor

Equations

ExtractFieldTypes a = ExtractFieldTypes' (Rep a)