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

Modulesome-1.0.6Haskell2010

Data.GADT.Show

  • 1 type
  • 2 classes
  • 8 values
  • Packagesome-1.0.6
  • Exports11
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceInternal.hs

Showing

4 declarations
classclass GShow (t :: k -> Type) where
#

Show-like class for 1-type-parameter GADTs. GShow t => ... is equivalent to something like (forall a. Show (t a)) => .... The easiest way to create instances would probably be to write (or derive) an instance Show (T a), and then simply say:

instance GShow t where gshowsPrec = defaultGshowsPrec

Methods

Instances11GShow, …
  • GShow SCharDefined in some-1.0.6 · Data.GADT.Internal
  • GShow SSymbolDefined in some-1.0.6 · Data.GADT.Internal
  • GShow SNatDefined in some-1.0.6 · Data.GADT.Internal
  • GShow TypeRepDefined in some-1.0.6 · Data.GADT.Internal
  • GShow (GOrdering a)Defined in some-1.0.6 · Data.GADT.Internal
  • GShow ((:~:) a)Defined in some-1.0.6 · Data.GADT.Internal
  • GShow ((:~~:) a)Defined in some-1.0.6 · Data.GADT.Internal
  • (GShow a, GShow b) => GShow (Product a b)Defined in some-1.0.6 · Data.GADT.Internal
    Example1 expression
    gshow (Pair Refl Refl :: Product ((:~:) Int) ((:~:) Int) Int)"Pair Refl Refl"
  • (GShow a, GShow b) => GShow (Sum a b)Defined in some-1.0.6 · Data.GADT.Internal
    Example1 expression
    gshow (InL Refl :: Sum ((:~:) Int) ((:~:) Bool) Int)"InL Refl"
  • (GShow a, GShow b) => GShow (a :*: b)Defined in some-1.0.6 · Data.GADT.Internal
    Example1 expression
    gshow (Pair Refl Refl :: Product ((:~:) Int) ((:~:) Int) Int)"Refl :*: Refl"
  • (GShow a, GShow b) => GShow (a :+: b)Defined in some-1.0.6 · Data.GADT.Internal
    Example1 expression
    gshow (L1 Refl :: ((:~:) Int :+: (:~:) Bool) Int)"L1 Refl"

Reading

7 declarations
classclass GRead (t :: k -> Type) where
#

Read-like class for 1-type-parameter GADTs. Unlike GShow, this one cannot be mechanically derived from a Read instance because greadsPrec must choose the phantom type based on the String being parsed.

Methods

Instances5GRead
  • GRead (GOrdering a)Defined in some-1.0.6 · Data.GADT.Internal
  • GRead ((:~:) a)Defined in some-1.0.6 · Data.GADT.Internal
  • (GRead a, GRead b) => GRead (Sum a b)Defined in some-1.0.6 · Data.GADT.Internal
  • (GRead a, GRead b) => GRead (a :+: b)Defined in some-1.0.6 · Data.GADT.Internal
  • k1 ~ k2 => GRead ((:~~:) a)Defined in some-1.0.6 · Data.GADT.Internal
typetype GReadS (t :: k -> Type) = String -> [(Some t, String)]
#

GReadS t is equivalent to ReadS (forall b. (forall a. t a -> b) -> b), which is in turn equivalent to ReadS (Exists t) (with data Exists t where Exists :: t a -> Exists t)

valuegreadMaybe :: GRead t => String -> (forall (a :: k). t a -> b) -> Maybe b
#
Example1 expression
greadMaybe "InL Refl" mkSome :: Maybe (Some (Sum ((:~:) Int) ((:~:) Bool)))Just (mkSome (InL Refl))
Example1 expression
greadMaybe "L1 Refl" mkSome :: Maybe (Some ((:~:) Int :+: (:~:) Bool))Just (mkSome (L1 Refl))
Example1 expression
greadMaybe "garbage" mkSome :: Maybe (Some ((:~:) Int))Nothing