Copyright | (c) Universiteit Utrecht 2010-2011, University of Oxford 2012 |
---|---|
License | (c) Universiteit Utrecht 2010-2011, University of Oxford 2012 |
Maintainer | libraries@haskell.org |
Stability | internal |
Portability | non-portable |
Safe Haskell | Trustworthy |
Support for generic programming with a sum-of-products view. For more information, please visit the HaskellWiki page (http://www.haskell.org/haskellwiki/GHC.Generics) or use the generic-deriving package on Hackage: http://hackage.haskell.org/package/generic-deriving.
- data V1 p
- data U1 p = U1
- newtype Par1 p = Par1 {
- unPar1 :: p
- newtype Rec1 f p = Rec1 {
- unRec1 :: f p
- newtype K1 i c p = K1 {
- unK1 :: c
- newtype M1 i c f p = M1 {
- unM1 :: f p
- data (f :+: g) p
- data (f :*: g) p = (f p) :*: (g p)
- newtype (f :.: g) p = Comp1 {
- unComp1 :: f (g p)
- type Rec0 = K1 R
- type Par0 = K1 P
- data R
- data P
- type D1 = M1 D
- type C1 = M1 C
- type S1 = M1 S
- data D
- data C
- data S
- class Datatype d where
- datatypeName :: t d (f :: * -> *) a -> [Char]
- moduleName :: t d (f :: * -> *) a -> [Char]
- isNewtype :: t d (f :: * -> *) a -> Bool
- class Constructor c where
- class Selector s where
- data NoSelector
- data Fixity
- = Prefix
- | Infix Associativity Int
- data Associativity
- data Arity
- prec :: Fixity -> Int
- class Generic a where
- class Generic1 f where
Generic representation types
Unit: used for constructors without arguments
Used for marking occurrences of the parameter
Recursive calls of kind * -> *
Constants, additional parameters and recursion of kind *
Meta-information (constructor names, etc.)
Sums: encode choice between constructors
Products: encode multiple arguments to constructors
(f p) :*: (g p) |
Composition of functors
Synonyms for convenience
Deprecated: Par0 is no longer used; use Rec0 instead
Type synonym for encoding parameters (other than the last)
Deprecated: P is no longer used; use R instead
Tag for K1: parameters (other than the last)
Meta-information
Class for datatypes that represent datatypes
datatypeName :: t d (f :: * -> *) a -> [Char]Source
The name of the datatype (unqualified)
moduleName :: t d (f :: * -> *) a -> [Char]Source
The fully-qualified name of the module where the type is declared
isNewtype :: t d (f :: * -> *) a -> BoolSource
Marks if the datatype is actually a newtype
class Constructor c whereSource
Class for datatypes that represent data constructors
Class for datatypes that represent records
Datatype to represent the fixity of a constructor. An infix
| declaration directly corresponds to an application of Infix
.
data Associativity Source
Datatype to represent the associativity of a constructor
Datatype to represent the arity of a tuple.
Generic type classes
Representable types of kind *. This class is derivable in GHC with the DeriveGeneric flag on.
Convert from the datatype to its representation
Convert from the representation to the datatype
Generic Bool | |
Generic Char | |
Generic Double | |
Generic Float | |
Generic Int | |
Generic Ordering | |
Generic () | |
Generic Associativity | |
Generic Fixity | |
Generic Arity | |
Generic [a] | |
Generic (U1 p) | |
Generic (Par1 p) | |
Generic (Maybe a) | |
Generic (Either a b) | |
Generic (Rec1 f p) | |
Generic (a, b) | |
Generic (Proxy * t) | |
Generic (K1 i c p) | |
Generic (:+: f g p) | |
Generic (:*: f g p) | |
Generic (:.: f g p) | |
Generic (a, b, c) | |
Generic (M1 i c f p) | |
Generic (a, b, c, d) | |
Generic (a, b, c, d, e) | |
Generic (a, b, c, d, e, f) | |
Generic (a, b, c, d, e, f, g) |