HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulesingletons-3.0.3Haskell2010

Data.Singletons.Decide

Defines the class SDecide, allowing for decidable equality over singletons.

  • 4 types
  • 1 class
  • 2 values
  • Packagesingletons-3.0.3
  • Exports7
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceDecide.hs

The SDecide class

1 declaration
classclass SDecide k where
#

Members of the SDecide "kind" class support decidable equality. Instances of this class are generated alongside singleton definitions for datatypes that derive an Eq instance.

Methods

  • (%~) :: Sing a -> Sing b -> Decision (a :~: b)infix 4

    Compute a proof or disproof of equality, given two singletons.

Supporting definitions

6 declarations
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

Instances10Category, TestCoercion, TestEquality, Bounded, Enum, Eq, …
  • Category (:~:)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.Category
  • 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
  • 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
datadata Void
#

Uninhabited data type

Instances10Eq, Data, Ord, Read, Show, Ix, …
  • Eq VoidDefined in ghc-internal-9.1003.0 · GHC.Internal.Base
  • Data VoidDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Data
  • Ord VoidDefined in ghc-internal-9.1003.0 · GHC.Internal.Base
  • Read VoidDefined in ghc-internal-9.1003.0 · GHC.Internal.Read

    Reading a Void value is always a parse error, considering Void as a data type with no constructors.

  • Show VoidDefined in ghc-internal-9.1003.0 · GHC.Internal.Show
  • Ix VoidDefined in ghc-internal-9.1003.0 · GHC.Internal.Ix
  • Generic VoidDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Semigroup VoidDefined in ghc-internal-9.1003.0 · GHC.Internal.Base
  • Exception VoidDefined in ghc-internal-9.1003.0 · GHC.Internal.Exception.Type
  • type Rep Void = D1 ('MetaData "Void" "GHC.Internal.Base" "ghc-internal" 'False) V1Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
typetype Refuted a = a -> Void
#

Because we can never create a value of type Void, a function that type-checks at a -> Void shows that objects of type a can never exist. Thus, we say that a is Refuted

Orphan instances

2 instances