generic-data-0.1.0.0: Utilities for GHC.Generics

Safe HaskellSafe
LanguageHaskell2010

Generic.Data.Internal.Functions

Description

Type level functions on generic representations.

Synopsis

Documentation

type family Map (s :: TyFun a b -> Type) (r :: k -> Type) :: k -> Type Source #

Apply a type function on every field of a type.

Instances

type Map a b k s (V1 k) Source # 
type Map a b k s (V1 k) = V1 k
type Map a b k s (U1 k) Source # 
type Map a b k s (U1 k) = U1 k
type Map a b k s ((:*:) k f g) Source # 
type Map a b k s ((:*:) k f g) = (:*:) k (Map a b k s f) (Map a b k s g)
type Map a b k s ((:+:) k f g) Source # 
type Map a b k s ((:+:) k f g) = (:+:) k (Map a b k s f) (Map a b k s g)
type Map a b k s (M1 k i c f) Source # 
type Map a b k s (M1 k i c f) = M1 k i c (Map a b k s f)
type Map * * k s (K1 k i c) Source # 
type Map * * k s (K1 k i c) = K1 k i ((@@) * * s c)

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

Number of constructors of a data type.

Instances

type NConstructors k ((:+:) k f g) Source # 
type NConstructors k ((:+:) k f g) = (+) (NConstructors k f) (NConstructors k g)
type NConstructors k (M1 k C c f) Source # 
type NConstructors k (M1 k C c f) = 1
type NConstructors k (M1 k D c f) Source # 
type NConstructors k (M1 k D c f) = NConstructors k f

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

Arity of a constructor.

Instances

type NFields k ((:*:) k f g) Source # 
type NFields k ((:*:) k f g) = (+) (NFields k f) (NFields k g)
type NFields k (M1 k S c f) Source # 
type NFields k (M1 k S c f) = 1
type NFields k (M1 k C c f) Source # 
type NFields k (M1 k C c f) = NFields k f

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