reified-records-0.2.0.0: Reify records to Maps and back again

Safe HaskellSafe

Data.Generics.Record.Subtype

Synopsis

Documentation

data a :<: b Source

A witness for a subtyping relation between two records so that a <: b

genSubtype :: forall a b. (Data a, Data b) => RecordT a -> RecordT b -> Maybe (a :<: b)Source

Returns a witness for a subtyping relation for a and b by traversing the fields of a and b and pairing each field of a with the first one of the same type in b.

isSubtype :: forall a b. (Data a, Data b) => RecordT a -> RecordT b -> BoolSource

Returns true if a <: b according to the algorithm for genSubtype

upcast :: forall a b. (Data a, Data b) => (a :<: b) -> a -> bSource

Upcast a type according to a subtyping witness.