generic-data-0.8.3.0: Deriving instances with GHC.Generics and related utilities

Safe HaskellSafe
LanguageHaskell2010

Generic.Data.Internal.Functions

Description

Type-level functions on generic representations.

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.

Synopsis

Documentation

type family NConstructors (r :: k -> Type) :: Nat Source #

Number of constructors of a data type.

Instances
type NConstructors (f :+: g :: k -> Type) Source # 
Instance details

Defined in Generic.Data.Internal.Functions

type NConstructors (M1 C c f :: k -> Type) Source # 
Instance details

Defined in Generic.Data.Internal.Functions

type NConstructors (M1 C c f :: k -> Type) = 1
type NConstructors (M1 D c f :: k -> Type) Source # 
Instance details

Defined in Generic.Data.Internal.Functions

type NConstructors (M1 D c f :: k -> Type) = NConstructors f

nconstructors :: forall r. KnownNat (NConstructors r) => Integer Source #

Number of constructors of a data type.

type family NFields (r :: k -> Type) :: Nat Source #

Arity of a constructor.

Instances
type NFields (f :*: g :: k -> Type) Source # 
Instance details

Defined in Generic.Data.Internal.Functions

type NFields (f :*: g :: k -> Type) = NFields f + NFields g
type NFields (M1 S c f :: k -> Type) Source # 
Instance details

Defined in Generic.Data.Internal.Functions

type NFields (M1 S c f :: k -> Type) = 1
type NFields (M1 C c f :: k -> Type) Source # 
Instance details

Defined in Generic.Data.Internal.Functions

type NFields (M1 C c f :: k -> Type) = NFields f

nfields :: forall r. KnownNat (NFields r) => Integer Source #

Arity of a constructor.