HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulegeneric-data-1.1.0.2Haskell2010

Generic.Data.Internal.Meta

Type metadata accessors

Type names, constructor names...

Warning

This is an internal module: it is not subject to any versioning policy, breaking changes can happen at any time.

If something here seems useful, please report it or create a pull request to export it from an external module.

Contents
  1. Constructor information on generic representations
  2. Find a constructor tag by name
  3. Check that a type is not empty
  4. Type families
Synopsis
Example3 expressions
:set -XDataKinds -XTypeApplicationsimport Control.Applicative (ZipList)import Data.Monoid (Sum(..))
valuegconFixity :: Constructors a => a -> Fixity

The fixity of the first constructor.

Example3 expressions
import GHC.Generics ((:*:)(..))gconFixity (Just 0)PrefixgconFixity ([] :*: id)Infix RightAssociative 6
valuegconIsRecord :: Constructors a => a -> Bool

True if the constructor is a record.

Example2 expressions
gconIsRecord (Just 0)FalsegconIsRecord (Sum 0)   -- Note:  newtype Sum a = Sum { getSum :: a }True
newtypenewtype ConId (a :: k)

An opaque identifier for a constructor.

Constructors

Instances3Eq, Ord, Show
  • Eq (ConId a)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Meta
  • Ord (ConId a)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Meta
  • Show (ConId a)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Meta
valueconIdNamed :: ConIdNamed s a => ConId a

Get a ConId by name.

Example2 expressions
conIdNamed @"Nothing" :: ConId (Maybe Int)ConId 0conIdNamed @"Just"    :: ConId (Maybe Int)ConId 1

Constructor information on generic representations

newtypenewtype GConId (r :: k)
#

Constructors

Instances2Eq, Ord
  • Eq (GConId r)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Meta
  • Ord (GConId r)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Meta
classclass GConstructors (r :: k -> Type) where

Generic representations that contain constructor metadata.

Methods

Instances4GConstructors

Find a constructor tag by name

Check that a type is not empty

classclass NonEmptyType_ fname a => NonEmptyType (fname :: Symbol) a

Constraint that a generic type a is not empty. Producing an error message otherwise.

The Symbol parameter fname is used only for error messages.

It is implied by the simpler constraint IsEmptyType a ~ 'False

Instances1NonEmptyType
typetype NonEmptyType_ (fname :: Symbol) a = ErrorIfEmpty fname a (IsEmptyType a) ~ '()

Internal definition of NonEmptyType. It is implied by the simpler constraint IsEmptyType a ~ 'False.

Example2 expressions
:set -XTypeFamilies:{conIdMin' :: (Constructors a, IsEmptyType a ~ 'False) => ConId aconIdMin' = conIdMin:}
Example1 expression
:{conIdMax' :: (Constructors a, IsEmptyType a ~ 'False) => ConId aconIdMax' = conIdMax:}

Type families

familytype family UnM1 (f :: k -> Type) :: k -> Type

Remove an M1 type constructor.

Instances1UnM1
  • type UnM1 (M1 i c f) = fDefined in generic-data-1.1.0.2 · Generic.Data.Internal.Meta