coercion-extras-0.1.0.0: Extra utilities for manipulating nominal and representational coercions

Safe HaskellNone
LanguageHaskell2010

Data.Type.Role.Representational

Synopsis

Documentation

class (forall a b. Coercible a b => Coercible (f a) (f b)) => Representational (f :: k -> l) Source #

A constraint witnessing that the next argument of the type constructor of the f type has representational (or phantom) type role.

For example Either and Either a both automatically become instances of this class.

Instances
(forall (a :: k) (b :: k). Coercible a b => Coercible (f a) (f b)) => Representational (f :: k -> l) Source # 
Instance details

Defined in Data.Type.Role.Representational

data Representation (f :: k -> l) where Source #

A datatype witness of the representational type role.

applyRepresentational :: Representation f -> Coercion f g -> Coercion a b -> Coercion (f a) (g b) Source #

Apply a coercion of a representable datatype to a coercion of its argument.

class (forall a b. Coercible (f a) (f b) => a ~ b) => NonRepresentational (f :: k -> l) Source #

A constraint witnessing that the next argument of the type constructor of the f type has a non-representational (nominal) type role.

For example Map automatically becomes an instance of this class.

Instances
(forall (a :: k) (b :: k). Coercible (f a) (f b) => a ~ b) => NonRepresentational (f :: k -> l) Source # 
Instance details

Defined in Data.Type.Role.Representational

data NonRepresentation (f :: k -> l) where Source #

A datatype witness of the non-representational type role.

innerNonRepresentational :: NonRepresentation f -> Coercion (f a) (f b) -> a :~: b Source #

Extract equality from coercibility of types in a non-representable position.