Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- cast :: (IsRecord a ra, IsRecord b rb, IsSubTypeOf ra rb) => a -> b
- class IsSubTypeOf (r1 :: RecordCode) (r2 :: RecordCode)
- class IsElemOf (s :: Symbol) (a :: Type) (r :: RecordCode)
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.
castRecord
Instances
IsSubTypeOf r1 ([] :: [(FieldLabel, Type)]) Source # | |
Defined in Generics.SOP.Record.SubTyping castRecord :: Record r1 -> Record [] | |
(IsSubTypeOf r1 r2, IsElemOf s2 a2 r1) => IsSubTypeOf r1 ((,) s2 a2 ': r2) Source # | |
Defined in Generics.SOP.Record.SubTyping castRecord :: Record r1 -> Record ((s2, a2) ': r2) |