records-sop-0.1.0.2: Record subtyping and record utilities with generics-sop

Safe HaskellNone
LanguageHaskell2010

Generics.SOP.Record.SubTyping

Synopsis

Documentation

cast :: (IsRecord a ra, IsRecord b rb, IsSubTypeOf ra rb) => a -> b Source #

Cast one record type to another if there is a subtype relationship between them. Currently, only width subtyping is considered, which means that we can forget and reorder fields.

class IsSubTypeOf (r1 :: RecordCode) (r2 :: RecordCode) Source #

Class that checks whether one record code is convertible into another.

Conversion works if the first record contains at least the labels of the second record, and if the types of the corresponding fields match exactly.

Minimal complete definition

castRecord

Instances
IsSubTypeOf r1 ([] :: [(FieldLabel, Type)]) Source # 
Instance details

Defined in Generics.SOP.Record.SubTyping

Methods

castRecord :: Record r1 -> Record []

(IsSubTypeOf r1 r2, IsElemOf s2 a2 r1) => IsSubTypeOf r1 ((,) s2 a2 ': r2) Source # 
Instance details

Defined in Generics.SOP.Record.SubTyping

Methods

castRecord :: Record r1 -> Record ((s2, a2) ': r2)

class IsElemOf (s :: Symbol) (a :: Type) (r :: RecordCode) Source #

Class that checks whether a field of a particular type is contained in a record.

Minimal complete definition

get

Instances
IsElemOf' (SameFieldLabel s1 s2) s1 a1 s2 a2 r => IsElemOf s1 a1 ((,) s2 a2 ': r) Source # 
Instance details

Defined in Generics.SOP.Record.SubTyping

Methods

get :: Record ((s2, a2) ': r) -> a1