Generalized form of type-safe cast using representational equality
Modulebase-compat-0.14.1Haskell2010
Data.Type.Coercion.Compat
- 1 type
- 1 class
- 6 values
- Packagebase-compat-0.14.1
- Exports8
- LanguageHaskell2010
- LicenceMIT
- SourceCoercion.hs
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
Type-safe cast, using representational equality
Convert propositional (nominal) equality to representational equality
Symmetry of representational equality
Transitivity of representational equality
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
Generalized form of type-safe cast using representational equality