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

Modulerebase-1.21.2Haskell2010

Rebase.Data.Type.Equality

  • 2 types
  • 3 classes
  • 7 values
  • Packagerebase-1.21.2
  • Exports13
  • LanguageHaskell2010
  • LicenceMIT
  • SourceTypes.hs
classclass a ~# b => (~~) (a :: k0) (b :: k1)
#

Lifted, heterogeneous equality. By lifted, we mean that it can be bogus (deferred type error). By heterogeneous, the two types a and b might have different kinds. Because ~~ can appear unexpectedly in error messages to users who do not care about the difference between heterogeneous equality ~~ and homogeneous equality ~, this is printed as ~ unless -fprint-equality-relations is set.

In 0.7.0, the fixity was set to infix 4 to match the fixity of :~~:.

classclass a ~ b => (~) (a :: k) (b :: k)
#

Lifted, homogeneous equality. By lifted, we mean that it can be bogus (deferred type error). By homogeneous, the two types a and b must have the same kinds.

familytype family (==) (a :: k) (b :: k) :: Bool where
#

A type family to compute Boolean equality.

Equations

datadata (:~:) (a :: k) (b :: k) where
#

Propositional equality. If a :~: b is inhabited by some terminating value, then the type a is the same as the type b. To use this equality in practice, pattern-match on the a :~: b to get out the Refl constructor; in the body of the pattern-match, the compiler knows that a ~ b.

Constructors

Instances15Category, Groupoid, Semigroupoid, TestCoercion, TestEquality, NFData2, …
  • Category (:~:)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.Category
  • Groupoid (:~:)Defined in semigroupoids-6.0.1 · Data.Groupoid
  • Semigroupoid (:~:)Defined in semigroupoids-6.0.1 · Data.Semigroupoid
  • TestCoercion ((:~:) a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Coercion
  • TestEquality ((:~:) a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Equality
  • NFData2 (:~:)Defined in deepseq-1.5.0.0 · Control.DeepSeq
  • NFData1 ((:~:) a)Defined in deepseq-1.5.0.0 · Control.DeepSeq
  • a ~ b => Bounded (a :~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Equality
  • a ~ b => Enum (a :~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Equality
  • Eq (a :~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Equality
  • (a ~ b, Data a) => Data (a :~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Data
  • Ord (a :~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Equality
  • a ~ b => Read (a :~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Equality
  • Show (a :~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Equality
  • NFData (a :~: b)Defined in deepseq-1.5.0.0 · Control.DeepSeq
datadata (:~~:) (a :: k1) (b :: k2) where
#

Kind heterogeneous propositional equality. Like :~:, a :~~: b is inhabited by a terminating value if and only if a is the same type as b.

Constructors

Instances15Category, Groupoid, Semigroupoid, TestCoercion, TestEquality, NFData2, …
  • Category (:~~:)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.Category
  • Groupoid (:~~:)Defined in semigroupoids-6.0.1 · Data.Groupoid
  • Semigroupoid (:~~:)Defined in semigroupoids-6.0.1 · Data.Semigroupoid
  • TestCoercion ((:~~:) a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Coercion
  • TestEquality ((:~~:) a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Equality
  • NFData2 (:~~:)Defined in deepseq-1.5.0.0 · Control.DeepSeq
  • NFData1 ((:~~:) a)Defined in deepseq-1.5.0.0 · Control.DeepSeq
  • a ~~ b => Bounded (a :~~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Equality
  • a ~~ b => Enum (a :~~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Equality
  • Eq (a :~~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Equality
  • (Typeable i, Typeable j, Typeable a, Typeable b, a ~~ b) => Data (a :~~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Data
  • Ord (a :~~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Equality
  • a ~~ b => Read (a :~~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Equality
  • Show (a :~~: b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Type.Equality
  • NFData (a :~~: b)Defined in deepseq-1.5.0.0 · Control.DeepSeq
valueapply :: f :~: g -> a :~: b -> f a :~: g b
#

Apply one equality to another, respectively

valueouter :: f a :~: g b -> f :~: g
#

Extract equality of type constructors from an equality of applied types

valueinner :: f a :~: g b -> a :~: b
#

Extract equality of the arguments from an equality of applied types

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

This class contains types where you can learn the equality of two types from information contained in terms.

The result should be Just Refl if and only if the types applied to f are equal:

testEquality (x :: f a) (y :: f b) = Just Refl ⟺ a = b

Typically, only singleton types should inhabit this class. In that case type argument equality coincides with term equality:

testEquality (x :: f a) (y :: f b) = Just Refl ⟺ a = b ⟺ x = y
isJust (testEquality x y) = x == y

Singleton types are not required, however, and so the latter two would-be laws are not in fact valid in general.

Methods

Instances7TestEquality, …
valuecastWith :: a :~: b -> a -> b
#

Type-safe cast, using propositional equality

valuegcastWith :: a :~: b -> (a ~ b => r) -> r
#

Generalized form of type-safe cast using propositional equality

valuesym :: a :~: b -> b :~: a
#

Symmetry of equality