| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Data.Type.Coercion.Related
Description
Related type to witness that two types a and b shares the same runtime representation,
but nothing about whether a can be safely coerced to or from b.
Unlike Coercion or Sub, having a value of Related a b does not allow to
touch values of a or b.
This module is used alonside Newtype.Union and Newtype.Intersection
to define union and intersection types of two Related types.
Synopsis
- data Related (a :: k) (b :: k)
- related :: Coercible a b => Related a b
- subIsRelated :: Sub (Sub a b) (Related a b)
- coercionIsRelated :: Sub (Coercion a b) (Related a b)
- symRelated :: Related a b -> Related b a
- undirected :: Sub a b -> (Coercible a b => Related x y) -> Related x y
- informRelation :: Related a b -> (Coercible a b => Related x y) -> Related x y
Documentation
data Related (a :: k) (b :: k) Source #
Related a b witnesses a and b shares the same runtime representation,
but nothing about whether a can be safely coerced to or from b.
You can make Related witnesses by using combinators in this module, or the methods of
the instance: Category Relatedid and (..)
Instances
| Category (Related :: k -> k -> Type) Source # | |
| Coercible a b => Bounded (Related a b) Source # | |
| Coercible a b => Enum (Related a b) Source # | |
Defined in Data.Type.Coercion.Related.Internal Methods succ :: Related a b -> Related a b # pred :: Related a b -> Related a b # toEnum :: Int -> Related a b # fromEnum :: Related a b -> Int # enumFrom :: Related a b -> [Related a b] # enumFromThen :: Related a b -> Related a b -> [Related a b] # enumFromTo :: Related a b -> Related a b -> [Related a b] # enumFromThenTo :: Related a b -> Related a b -> Related a b -> [Related a b] # | |
| Coercible a b => Read (Related a b) Source # | |
| Show (Related a b) Source # | |
| Eq (Related a b) Source # | |
| Ord (Related a b) Source # | |
Defined in Data.Type.Coercion.Related.Internal | |
symRelated :: Related a b -> Related b a Source #
Related is a symmetric relation.
undirected :: Sub a b -> (Coercible a b => Related x y) -> Related x y Source #
A direct consequence of informRelation and subIsRelated.