Symmetry of representational equality
Modulebase-compat-batteries-0.14.1Haskell2010
Data.Type.Coercion.Compat
- 1 type
- 1 class
- 5 values
- Packagebase-compat-batteries-0.14.1
- Exports7
- LanguageHaskell2010
- LicenceMIT
- SourceCoercion.hs
Transitivity of representational equality
Type-safe cast, using representational equality
Generalized form of type-safe cast using representational equality
Convert propositional (nominal) equality to representational equality
Representational equality. If Coercion a b is inhabited by some terminating
value, then the type a has the same underlying representation as the type b.
To use this equality in practice, pattern-match on the Coercion a b to get out
the Coercible a b instance, and then use coerce to apply it.
Instances9Category, TestCoercion, Bounded, Enum, Eq, Data, …
Category CoercionDefined in ghc-internal-9.1003.0 · GHC.Internal.Control.CategoryTestCoercion (Coercion a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.CoercionCoercible a b => Bounded (Coercion a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.CoercionCoercible a b => Enum (Coercion a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.CoercionEq (Coercion a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Coercion(Coercible a b, Data a, Data b) => Data (Coercion a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.DataOrd (Coercion a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.CoercionCoercible a b => Read (Coercion a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.CoercionShow (Coercion a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Coercion
This class contains types where you can learn the equality of two types from information contained in terms. Typically, only singleton types should inhabit this class.
Methods
testCoercion :: f a -> f b -> Maybe (Coercion a b)Conditionally prove the representational equality of
aandb.
Instances6TestCoercion
TestCoercion SCharDefined in ghc-internal-9.1003.0 · GHC.Internal.TypeLitsTestCoercion SSymbolDefined in ghc-internal-9.1003.0 · GHC.Internal.TypeLitsTestCoercion SNatDefined in ghc-internal-9.1003.0 · GHC.Internal.TypeNatsTestCoercion (Coercion a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.CoercionTestCoercion ((:~:) a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.CoercionTestCoercion ((:~~:) a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Coercion