| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Newtype.Intersection
Synopsis
- module Data.Type.Coercion.Related
- data IsIntersection x y z = IsIntersection {}
- withIntersection :: Related x y -> (forall xy. IsIntersection x y xy -> r) -> r
- unique :: IsIntersection x y z -> IsIntersection x y z' -> Coercion z z'
- lesser :: Sub x y -> IsIntersection x y x
- idemp :: IsIntersection x x x
- commutative :: IsIntersection x y z -> IsIntersection y x z
- associative :: IsIntersection x y xy -> IsIntersection xy z xy'z -> IsIntersection y z yz -> IsIntersection x yz x'yz -> Coercion xy'z x'yz
Documentation
module Data.Type.Coercion.Related
data IsIntersection x y z Source #
IsIntersection x y z witnesses the fact:
- All
x, y, zshare the same runtime representation zis an intersection type ofxandy. In other words, the following three holds:Subz xSub z y
- For any type
ssatisfying both of(Sub s x, Sub s y),Sub s z.
withIntersection :: Related x y -> (forall xy. IsIntersection x y xy -> r) -> r Source #
For a pair of Related types x and y, make some (existentially quantified)
type xy where xy is an intersection type of x, y.
unique :: IsIntersection x y z -> IsIntersection x y z' -> Coercion z z' Source #
Two intersection types z,z' of the same pair of types x,y may be different,
but they are equivalent in terms of coercibility.
lesser :: Sub x y -> IsIntersection x y x Source #
When Sub x y, x itself is an intersection type of x, y.
idemp :: IsIntersection x x x Source #
Intersection is idempotent.
Note: combining idemp and unique, IsIntersection x x z -> Coercible x z holds.
commutative :: IsIntersection x y z -> IsIntersection y x z Source #
Intersection is commutative.
Note: combining commutative and unique, IsIntersection x x z -> Coercible x z holds.
associative :: IsIntersection x y xy -> IsIntersection xy z xy'z -> IsIntersection y z yz -> IsIntersection x yz x'yz -> Coercion xy'z x'yz Source #
Intersection is associative.