coercible-subtypes-0.2.0.0: Coercible but only in one direction
Safe HaskellNone
LanguageHaskell2010

Newtype.Intersection

Synopsis

Documentation

data IsIntersection x y z Source #

IsIntersection x y z witnesses the fact:

  • All x, y, z share the same runtime representation
  • z is an intersection type of x and y. In other words, the following three holds:

    • Sub z x
    • Sub z y
    • For any type s satisfying both of (Sub s x, Sub s y), Sub s z.

Constructors

IsIntersection 

Fields

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.