emgm-0.4: Extensible and Modular Generics for the Masses

Portabilitynon-portable
Stabilityexperimental
Maintainergenerics@haskell.org

Generics.EMGM.Functions.Meta

Contents

Description

Summary: Functions for extracting meta-information about the representation.

Synopsis

Embedding-Projection Pair

class HasEP a b | a -> b whereSource

A class to reveal the embedding-projection pair for a given datatype and its isomorphic representation type.

Methods

epOf :: a -> EP a bSource

The parameter is never evaluated, so undefined is acceptable.

Instances

HasEP Bool BoolS 
HasEP () Tuple0S 
HasEP [a] (ListS a) 
Integral a => HasEP (Ratio a) (RatioS a) 
HasEP (Maybe a) (MaybeS a) 
HasEP (Either a b) (EitherS a b) 
HasEP (a, b) (Tuple2S a b) 
HasEP (a, b, c) (Tuple3S a b c) 
HasEP (a, b, c, d) (Tuple4S a b c d) 
HasEP (a, b, c, d, e) (Tuple5S a b c d e) 
HasEP (a, b, c, d, e, f) (Tuple6S a b c d e f) 
HasEP (a, b, c, d, e, f, h) (Tuple7S a b c d e f h) 

Constructor Description

newtype Con a Source

The type of a generic function that takes one value and returns an optional constructor description.

Constructors

Con 

Fields

selConstructor :: a -> Maybe ConDescr
 

Instances

conDescr :: Rep Con a => a -> Maybe ConDescrSource

Returns a constructor description if the value is not a primitive. The argument is not evaluated and may be undefined.

Label Descriptions

newtype Lbls a Source

The type of a generic function that takes a boolean to limit recursion and a value and returns a list of label descriptions for that constructor.

Constructors

Lbls 

Fields

selLabels :: Bool -> a -> [LblDescr]
 

Instances

lblDescrs :: Rep Lbls a => a -> [LblDescr]Source

Returns a list of descriptions for all labels in the head constructor. Does not recurse into the children. The argument is not evaluated and may be undefined.