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

Modulegeneric-data-1.1.0.2Haskell2010

Generic.Data

Generic combinators to derive type class instances.

Orphans

The Data.Generic.Orphans module should be imported to derive the following classes using this library:

Minor discrepancies

Here are documented some corner cases of deriving, both by GHC and generic-data. They are all minor and unlikely to cause problems in practice.

Empty types
  • Some of the derived methods are lazy, which might result in errors being silenced, though unlikely.

  • The only generic-data implementation which differs from GHC stock instances is gfoldMap.

Class method

GHC stock

generic-data

Comment

(==)

lazy

lazy

True

compare

lazy

lazy

EQ

fmap

strict

strict

must be bottom anyway

foldMap

lazy

strict

mempty

if lazy

foldr

lazy

lazy

returns accumulator

traverse

strict

strict

sequenceA

strict

strict

Single-constructor single-field types

data types with one constructor and one field are extremely rare. newtype is almost always more appropriate (for which there is no issue).

That said, for data types both strict and lazy, all generic-data implementations are lazy (they don't even force the constructor), whereas GHC stock implementations, when they exist, are strict.

Functor composition

Fields of functors involving the composition of two or more functors f (g (h a)) result in some overhead using GHC.Generics.Generic1.

This is due to a particular encoding choice of GHC.Generics, where composition are nested to the right instead of to the left. f (g (h _)) is represented by the functor f :.: (g :.: Rec1 h), so one must use fmap on f to convert that back to f (g (h _)). A better choice would have been to encode it as (Rec1 f :.: g) :.: h, because that is coercible back to f (g (h _)).

  • 16 types
  • 13 classes
  • 60 values

Newtypes for Deriving Via

4 declarations
newtypenewtype Generically a
#

A datatype whose instances are defined generically, using the Generic representation. Generically1 is a higher-kinded version of Generically that uses Generic1.

Generic instances can be derived via Generically A using -XDerivingVia.

{-# LANGUAGE DeriveGeneric      #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DerivingVia        #-}

import GHC.Generics (Generic)

data V4 a = V4 a a a a
  deriving stock Generic

  deriving (Semigroup, Monoid)
  via Generically (V4 a)

This corresponds to Semigroup and Monoid instances defined by pointwise lifting:

instance Semigroup a => Semigroup (V4 a) where
  (<>) :: V4 a -> V4 a -> V4 a
  V4 a1 b1 c1 d1 <> V4 a2 b2 c2 d2 =
    V4 (a1 <> a2) (b1 <> b2) (c1 <> c2) (d1 <> d2)

instance Monoid a => Monoid (V4 a) where
  mempty :: V4 a
  mempty = V4 mempty mempty mempty mempty

Historically this required modifying the type class to include generic method definitions (-XDefaultSignatures) and deriving it with the anyclass strategy (-XDeriveAnyClass). Having a /via type/ like Generically decouples the instance from the type class.

Constructors

Instances11Bounded, Enum, Eq, Ord, Read, Show, …
newtypenewtype GenericProduct a
#

Product type with generic instances of Semigroup and Monoid.

This is similar to Generic.Data.Generically in most cases, but GenericProduct also works for types T with deriving via GenericProduct U, where U is a generic product type coercible to, but distinct from T. In particular, U may not have an instance of Semigroup, which Generic.Data.Generically requires.

Example
Example3 expressions
import Data.Monoid (Sum(..))data Point a = Point a a deriving Generic:{  newtype Vector a = Vector (Point a)    deriving (Semigroup, Monoid)      via GenericProduct (Point (Sum a)):}

If it were via Generic.Data.Generically (Point (Sum a)) instead, then Vector's mappend (the Monoid method) would be defined as Point's (<>) (the Semigroup method), which might not exist, or might not be equivalent to Vector's generic Semigroup instance, which would be unlawful.

Constructors

Instances4Generic, Semigroup, Monoid, Rep
newtypenewtype FiniteEnumeration a
#

Type with Enum instance derived via Generic with FiniteEnum option. This allows deriving Enum for types whose constructors have fields.

Some caution is advised; see details in FiniteEnum.

Example
Example1 expression
:{data Booool = Booool Bool Bool  deriving Generic  deriving (Enum, Bounded) via (FiniteEnumeration Booool):}

Constructors

Instances4Bounded, Enum, Generic, Rep
newtypenewtype Generically1 (f :: k -> Type) (a :: k) where
#

A type whose instances are defined generically, using the Generic1 representation. Generically1 is a higher-kinded version of Generically that uses Generic.

Generic instances can be derived for type constructors via Generically1 F using -XDerivingVia.

{-# LANGUAGE DeriveGeneric      #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DerivingVia        #-}

import GHC.Generics (Generic)

data V4 a = V4 a a a a
  deriving stock (Functor, Generic1)

  deriving Applicative
  via Generically1 V4

This corresponds to Applicative instances defined by pointwise lifting:

instance Applicative V4 where
  pure :: a -> V4 a
  pure a = V4 a a a a

  liftA2 :: (a -> b -> c) -> (V4 a -> V4 b -> V4 c)
  liftA2 (·) (V4 a1 b1 c1 d1) (V4 a2 b2 c2 d2) =
    V4 (a1 · a2) (b1 · b2) (c1 · c2) (d1 · d2)

Historically this required modifying the type class to include generic method definitions (-XDefaultSignatures) and deriving it with the anyclass strategy (-XDeriveAnyClass). Having a /via type/ like Generically1 decouples the instance from the type class.

Constructors

Instances17Generic1, Functor, Applicative, Foldable, Traversable, Alternative, …

Regular classes

0 declarations

Default implementations for classes indexed by types (kind Type).

Semigroup

Monoid

Eq

Can also be derived by GHC as part of the standard.

Ord

Can also be derived by GHC as part of the standard.

Read

Can also be derived by GHC as part of the standard.

Show

Can also be derived by GHC as part of the standard.

Enum

classclass GEnum opts (f :: Type -> Type) where
#

Generic representation of Enum types.

The opts parameter is a type-level option to select different implementations.

Instances5GEnum

StandardEnum option

Can also be derived by GHC as part of the standard.

FiniteEnum option

datadata FiniteEnum
#

Extends the StandardEnum option for GEnum to allow all constructors to have arbitrary many fields. Each field type must be an instance of both Enum and Bounded. Avoid fields of types Int and Word.

Details

Two restrictions require the user's attention:

  • The Enum instances of the field types need to start enumerating from 0. In particular, Int is an unfit field type, because the enumeration of the negative values starts before 0.

  • There can only be up to maxBound :: Int values (because the implementation represents the cardinality explicitly as an Int). This restriction makes Word an invalid field type as well. Notably, it is insufficient for each individual field types to stay below this limit. Instead it applies to the generic type as a whole.

Elements are numbered by toEnum, from 0 up to (cardinality - 1). The resulting ordering matches the generic Ord instance defined by Generic.Data.gcompare. The values from different constructors are enumerated sequentially.

data Example = C0 Bool Bool | C1 Bool
  deriving (Eq, Ord, Show, Generic)

cardinality = 6  -- 2    * 2    + 2
                 -- Bool * Bool | Bool

enumeration =
    [ C0 False False
    , C0 False  True
    , C0  True False
    , C0  True  True
    , C1 False
    , C1 True
    ]

enumeration == map gtoFiniteEnum [0 .. 5]
[0 .. 5] == map gfromFiniteEnum enumeration
Instances2GEnum

Bounded

Can also be derived by GHC as part of the standard.

classclass GBounded (f :: Type -> Type) where
#

Generic representation of Bounded types.

Instances5GBounded

Ix

Can also be derived by GHC as part of the standard.

classclass GIx (f :: Type -> Type) where
#

Generic representation of Ix types.

Instances5GIx
  • GIx U1Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Enum
  • Ix c => GIx (K1 i c)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Enum
  • (GEnum StandardEnum f, GEnum StandardEnum g) => GIx (f :+: g)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Enum
  • (GIx f, GIx g) => GIx (f :*: g)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Enum
  • GIx f => GIx (M1 i c f)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Enum
valuegunsafeIndex :: (Generic a, GIx (Rep a)) => (a, a) -> a -> Int
#

Generic unsafeIndex.

Details

The functions unsafeIndex and unsafeRangeSize belong to Ix but are internal to GHC and hence not exported from the module Data.Ix. However they are exported from the module GHC.Arr. See grange for how to define an instance of Ix such that it does not depend on the stability of GHCs internal API. Unfortunately this results in additional (unnecessary) bound checks. With the danger of having no stability guarantees for GHC's internal API one can alternatively define an instance of Ix as

import GHC.Arr
instance Ix MyType where
  range = grange
  unsafeIndex = gunsafeIndex
  inRange = ginRange

Higher-kinded classes

0 declarations

Default implementations for classes indexed by type constructors (kind Type -> Type).

Functor

Can also be derived by GHC (DeriveFunctor extension).

Foldable

Can also be derived by GHC (DeriveFoldable extension).

Traversable

Can also be derived by GHC (DeriveTraversable extension).

Applicative

Alternative

Eq1

Ord1

Read1

Show1

Fields wrappers for deriving

3 declarations
newtypenewtype Id1 (f :: Type -> Type) a
#

A newtype whose instances for simple classes (Eq, Ord, Read, Show) use higher-kinded class instances for f (Eq1, Ord1, Read1, Show1).

Constructors

Instances8Eq1, Ord1, Read1, Show1, Eq, Ord, …
  • Eq1 f => Eq1 (Id1 f)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers
  • Ord1 f => Ord1 (Id1 f)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers
  • Read1 f => Read1 (Id1 f)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers
  • Show1 f => Show1 (Id1 f)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers
  • (Eq1 f, Eq a) => Eq (Id1 f a)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers
  • (Ord1 f, Ord a) => Ord (Id1 f a)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers
  • (Read1 f, Read a) => Read (Id1 f a)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers
  • (Show1 f, Show a) => Show (Id1 f a)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers
newtypenewtype Opaque a
#

A newtype with trivial instances, that considers every value equivalent to every other one, and shows as just "_".

Constructors

Instances6Eq1, Ord1, Show1, Eq, Ord, Show
  • Eq1 OpaqueDefined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers

    All equal.

  • Ord1 OpaqueDefined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers

    All equal.

  • Show1 OpaqueDefined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers

    Shown as "_".

  • Eq (Opaque a)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers

    All equal.

  • Ord (Opaque a)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers

    All equal.

  • Show (Opaque a)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers

    Shown as "_".

newtypenewtype Opaque1 (f :: Type -> Type) a
#

A higher-kinded version of Opaque.

Constructors

Instances6Eq1, Ord1, Show1, Eq, Ord, Show
  • Eq1 (Opaque1 f)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers

    All equal.

  • Ord1 (Opaque1 f)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers

    All equal.

  • Show1 (Opaque1 f)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers

    Shown as "_".

  • Eq (Opaque1 f a)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers

    All equal.

  • Ord (Opaque1 f a)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers

    All equal.

  • Show (Opaque1 f a)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Resolvers

    Shown as "_".

Newtype

4 declarations

Generic pack/unpack.

typetype Old a = GOld (Rep a)
#

The type wrapped by a newtype.

newtype Foo = Foo { bar :: Bar } deriving Generic
-- Old Foo ~ Bar

Generic coercions

2 declarations

Accessing metadata

0 declarations

Using TypeApplications.

Datatype

valuegmoduleName :: (Generic a, GDatatype (Rep a)) => String
#

Name of the module where the first type constructor is defined.

Example1 expression
gmoduleName @(ZipList Int)"Control.Applicative"
valuegisNewtype :: (Generic a, GDatatype (Rep a)) => Bool
#

True if the first type constructor is a newtype.

Example2 expressions
gisNewtype @[Int]FalsegisNewtype @(ZipList Int)True
classclass GDatatype (f :: k) where
#

Generic representations that contain datatype metadata.

Instances1GDatatype

Constructor

valuegconName :: Constructors a => a -> String
#

Name of the first constructor in a value.

Example1 expression
gconName (Just 0)"Just"
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
valuegconIndex :: Constructors a => a -> Int
#

Index of a constructor.

Example2 expressions
gconIndex Nothing0gconIndex (Just "test")1
classclass GConstructors (r :: k -> Type) where
#

Generic representations that contain constructor metadata.

Instances4GConstructors

Constructor tags

newtypenewtype ConId (a :: k)
#

An opaque identifier for a constructor.

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

Using type families

The Generic class

2 declarations

Reexported from GHC.Generics.

classclass Generic a where
#

Representable types of kind *. This class is derivable in GHC with the DeriveGeneric flag on.

A Generic instance must satisfy the following laws:

from . to ≡ Prelude.id
to . from ≡ Prelude.id
Instances103Generic, …
  • Generic ForeignSrcLangDefined in ghc-boot-th-9.10.3 · GHC.ForeignSrcLang.Type
  • Generic ExtensionDefined in ghc-boot-th-9.10.3 · GHC.LanguageExtensions.Type
  • Generic VoidDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic ByteOrderDefined in ghc-internal-9.1003.0 · GHC.Internal.ByteOrder
  • Generic ClosureTypeDefined in ghc-internal-9.1003.0 · GHC.Internal.ClosureTypes
  • Generic AllDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.Internal
  • Generic AnyDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.Internal
  • Generic VersionDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Version
  • Generic FingerprintDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic AssociativityDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic DecidedStrictnessDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic FixityDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic SourceStrictnessDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic SourceUnpackednessDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic ExitCodeDefined in ghc-internal-9.1003.0 · GHC.Internal.IO.Exception
  • Generic CCFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.Flags
  • Generic ConcFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.Flags
  • Generic DebugFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.Flags
  • Generic DoCostCentresDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.Flags
  • Generic DoHeapProfileDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.Flags
  • Generic DoTraceDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.Flags
  • Generic GCFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.Flags
  • Generic GiveGCStatsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.Flags
  • Generic HpcFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.Flags
  • Generic MiscFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.Flags
  • Generic ParFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.Flags
  • Generic ProfFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.Flags
  • Generic RTSFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.Flags
  • Generic TickyFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.Flags
  • Generic TraceFlagsDefined in ghc-internal-9.1003.0 · GHC.Internal.RTS.Flags
  • Generic SrcLocDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic GCDetailsDefined in ghc-internal-9.1003.0 · GHC.Internal.Stats
  • Generic RTSStatsDefined in ghc-internal-9.1003.0 · GHC.Internal.Stats
  • Generic GeneralCategoryDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic BoolDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic OrderingDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic ()Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (Complex a)Defined in base-4.20.2.0 · Data.Complex
  • Generic (First a)Defined in base-4.20.2.0 · Data.Semigroup
  • Generic (Last a)Defined in base-4.20.2.0 · Data.Semigroup
  • Generic (Max a)Defined in base-4.20.2.0 · Data.Semigroup
  • Generic (Min a)Defined in base-4.20.2.0 · Data.Semigroup
  • Generic (WrappedMonoid m)Defined in base-4.20.2.0 · Data.Semigroup
  • Generic (NonEmpty a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (Identity a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.Identity
  • Generic (First a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Monoid
  • Generic (Last a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Monoid
  • Generic (Down a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (Dual a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.Internal
  • Generic (Endo a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.Internal
  • Generic (Product a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.Internal
  • Generic (Sum a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.Internal
  • Generic (ZipList a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Functor.ZipList
  • Generic (Par1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (Maybe a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic [a]Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic a => Generic (FiniteEnumeration a)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Generically
  • Generic a => Generic (GenericProduct a)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Generically
  • Generic a => Generic (Generically a)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Generically · orphan

    This is a hack to implicitly wrap/unwrap in the instances of Generically.

  • Generic (WrappedMonad m a)Defined in base-4.20.2.0 · Control.Applicative
  • Generic (Arg a b)Defined in base-4.20.2.0 · Data.Semigroup
  • Generic (Either a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (Proxy t)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (U1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (V1 p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (a, b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • (Functor r, Contravariant r) => Generic (Data r p)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Data
  • (Generic a, Coercible (GSurgery s (Rep a)) (Rep a)) => Generic (Surgery' s a)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Microsurgery
  • Generic (WrappedArrow a b c)Defined in base-4.20.2.0 · Control.Applicative
  • Generic (Kleisli m a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.Arrow
  • Generic (Const a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.Const
  • Generic (Ap f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Monoid
  • Generic (Alt f a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.Internal
  • Generic (Rec1 f p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (URec Char p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (URec Double p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (URec Float p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (URec Int p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (URec Word p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (URec (Ptr ()) p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (a, b, c)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (f a) => Generic (Generically1 f a)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Generically · orphan

    This is a hack to implicitly wrap/unwrap in the instances of Generically1.

  • Generic (Product f g a)Defined in base-4.20.2.0 · Data.Functor.Product
  • Generic (Sum f g a)Defined in base-4.20.2.0 · Data.Functor.Sum
  • Generic (K1 i c p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic ((:*:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic ((:+:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (a, b, c, d)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (Compose f g a)Defined in base-4.20.2.0 · Data.Functor.Compose
  • Generic (M1 i c f p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic ((:.:) f g p)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (a, b, c, d, e)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (a, b, c, d, e, f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (a, b, c, d, e, f, g)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (a, b, c, d, e, f, g, h)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (a, b, c, d, e, f, g, h, i)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (a, b, c, d, e, f, g, h, i, j)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (a, b, c, d, e, f, g, h, i, j, k)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (a, b, c, d, e, f, g, h, i, j, k, l)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (a, b, c, d, e, f, g, h, i, j, k, l, m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
classclass Generic1 (f :: k -> Type) where
#

Representable types of kind * -> * (or kind k -> *, when PolyKinds is enabled). This class is derivable in GHC with the DeriveGeneric flag on.

A Generic1 instance must satisfy the following laws:

from1 . to1 ≡ Prelude.id
to1 . from1 ≡ Prelude.id
Instances61Generic1, …
  • Generic1 ComplexDefined in base-4.20.2.0 · Data.Complex
  • Generic1 FirstDefined in base-4.20.2.0 · Data.Semigroup
  • Generic1 LastDefined in base-4.20.2.0 · Data.Semigroup
  • Generic1 MaxDefined in base-4.20.2.0 · Data.Semigroup
  • Generic1 MinDefined in base-4.20.2.0 · Data.Semigroup
  • Generic1 WrappedMonoidDefined in base-4.20.2.0 · Data.Semigroup
  • Generic1 NonEmptyDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 IdentityDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.Identity
  • Generic1 FirstDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Monoid
  • Generic1 LastDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Monoid
  • Generic1 DownDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 DualDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.Internal
  • Generic1 ProductDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.Internal
  • Generic1 SumDefined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.Internal
  • Generic1 ZipListDefined in ghc-internal-9.1003.0 · GHC.Internal.Functor.ZipList
  • Generic1 Par1Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 MaybeDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 SoloDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 []Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 ProxyDefined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 U1Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 V1Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (WrappedMonad m)Defined in base-4.20.2.0 · Control.Applicative
  • Generic1 (Arg a)Defined in base-4.20.2.0 · Data.Semigroup
  • Generic1 (Data r)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Data
  • Generic1 (Either a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (Tuple2 a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (WrappedArrow a b)Defined in base-4.20.2.0 · Control.Applicative
  • Generic1 (Kleisli m a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Control.Arrow
  • Generic1 (Const a)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Functor.Const
  • Generic1 (Ap f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Monoid
  • Generic1 (Alt f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Data.Semigroup.Internal
  • Generic1 (Rec1 f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (URec Char)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (URec Double)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (URec Float)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (URec Int)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (URec Word)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (URec (Ptr ()))Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (Tuple3 a b)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 f => Generic1 (Generically1 f)Defined in generic-data-1.1.0.2 · Generic.Data.Internal.Generically · orphan

    This is a hack to implicitly wrap/unwrap in the instances of Generically1.

  • Generic1 (Product f g)Defined in base-4.20.2.0 · Data.Functor.Product
  • Generic1 (Sum f g)Defined in base-4.20.2.0 · Data.Functor.Sum
  • Generic1 (K1 i c)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (Tuple4 a b c)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (f :*: g)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (f :+: g)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Functor f => Generic1 (Compose f g)Defined in base-4.20.2.0 · Data.Functor.Compose
  • Functor f => Generic1 (f :.: g)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (M1 i c f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (Tuple5 a b c d)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (Tuple6 a b c d e)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (Tuple7 a b c d e f)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (Tuple8 a b c d e f g)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (Tuple9 a b c d e f g h)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (Tuple10 a b c d e f g h i)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (Tuple11 a b c d e f g h i j)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (Tuple12 a b c d e f g h i j k)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (Tuple13 a b c d e f g h i j k l)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (Tuple14 a b c d e f g h i j k l m)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics
  • Generic1 (Tuple15 a b c d e f g h i j k l m n)Defined in ghc-internal-9.1003.0 · GHC.Internal.Generics