Safe Haskell | None |
---|---|

Language | Haskell2010 |

## Synopsis

- class (forall a b. Coercible a b => Coercible (f a) (f b)) => Representational (f :: k -> l)
- data Representation (f :: k -> l) where
- Representation :: Representational f => Representation f

- applyRepresentational :: Representation f -> Coercion f g -> Coercion a b -> Coercion (f a) (g b)
- class (forall a b. Coercible (f a) (f b) => a ~ b) => NonRepresentational (f :: k -> l)
- data NonRepresentation (f :: k -> l) where
- innerNonRepresentational :: NonRepresentation f -> Coercion (f a) (f b) -> a :~: b

# 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 # | |

Defined in Data.Type.Role.Representational |

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

A datatype witness of the representational type role.

Representation :: Representational f => Representation f |

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 # | |

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.