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

Safe HaskellNone
LanguageHaskell2010

Data.Type.Role.Phantom

Synopsis

Documentation

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

A constraint witnessing that the next argument of the type constructor of the f type has phantom type role.

For example Proxy atomatically becomes an instance of this class.

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

Defined in Data.Type.Role.Phantom

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

A datatype witness of the phantom type role.

Constructors

Phantomicity :: Phantom f => Phantomicity f 

applyPhantom :: Phantomicity f -> Coercion f g -> Coercion (f a) (g b) Source #

Saturate a coercion of a phantom datatype.

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

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

For example Map and Maybe automatically become instances of this class.

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

Defined in Data.Type.Role.Phantom

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

A datatype witness of the non-phantom type role.

innerNonPhantom :: NonPhantomicity f -> Coercion (f a) (f b) -> Coercion a b Source #

Extract coercion from coercibility of types in a non-phantom position.