HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulebase-4.20.2.0Haskell2010

Data.Type.Coercion

Definition of representational equality (Coercion).

  • 1 type
  • 1 class
  • 5 values
  • Packagebase-4.20.2.0
  • Exports7
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceCoercion.hs
datadata Coercion (a :: k) (b :: k) where
#

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.

Constructors

Instances9Category, TestCoercion, Bounded, Enum, Eq, Data, …
  • Category CoercionDefined in ghc-internal-9.1003.0 · GHC.Internal.Control.Category
  • TestCoercion (Coercion a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Coercion
  • Coercible a b => Bounded (Coercion a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Coercion
  • Coercible a b => Enum (Coercion a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Coercion
  • Eq (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.Data
  • Ord (Coercion a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Coercion
  • Coercible a b => Read (Coercion a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Coercion
  • Show (Coercion a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Coercion
valuerepr :: a :~: b -> Coercion a b
#

Convert propositional (nominal) equality to representational equality

classclass TestCoercion (f :: k -> Type) where
#

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

Instances6TestCoercion