Portability | non-portable |
---|---|
Stability | experimental |
Maintainer | generics@haskell.org |
This module is the base of the multirec library. It defines the view of a family of datatypes: All the datatypes of the family are represented as indexed functors that are built up from the structure types defined in this module. Furthermore, in order to use the library for a family, conversion functions have to be defined between the original datatypes and their representation. The type class that holds these conversion functions are also defined here.
- data I xi r ix = I {
- unI :: r xi
- data K a r ix = K {
- unK :: a
- data U r ix = U
- data (f :+: g) r ix
- data (f :*: g) r ix = (f r ix) :*: (g r ix)
- data f :>: ix where
- unTag :: (f :>: ix) r ix -> f r ix
- data (f :.: g) r ix = D (f (g r ix))
- data C c f r ix where
- unC :: C c f r ix -> f r ix
- module Generics.MultiRec.Constructor
- newtype I0 a = I0 {
- unI0 :: a
- newtype K0 a b = K0 {
- unK0 :: a
- type family PF phi :: (* -> *) -> * -> *
- class El phi ix where
- proof :: phi ix
- class Fam phi where
- index :: El phi ix => phi ix
- module Generics.MultiRec.TEq
- class EqS phi where
Structure types
Represents recursive positions. The first argument indicates which type to recurse on.
El phi xi => HFunctor phi (I xi) | |
El phi xi => HEq phi (I xi) | |
El phi xi => HShow phi (I xi) | |
El phi xi => HReadPrec phi (I xi) | |
(Constructor c, HReadPrec phi (I xi)) => HReadPrec phi (C c (I xi)) | |
ConNames (I a) | |
Fold (I xi) | |
Fold (I xi) | |
CountAtoms (I xi) | |
Functor f => Fold (:.: f (I xi)) | |
Fold g => Fold (:*: (I xi) g) | |
Fold g => Fold (:*: (I xi) g) |
Represents constant types that do not belong to the family.
HFunctor phi (K x) | |
Eq a => HEq phi (K a) | For constant types, we make use of the standard equality function. |
Show a => HShow phi (K a) | For constant types, we make use of the standard show function. |
Read a => HReadPrec phi (K a) | |
(Constructor c, HReadPrec phi (K a)) => HReadPrec phi (C c (K a)) | |
ConNames (K x) | |
Fold (K a) | |
Fold (K a) | |
CountAtoms (K a) | |
Fold g => Fold (:*: (K a) g) | |
Fold g => Fold (:*: (K a) g) |
Represents constructors without fields.
Represents sums (choices between constructors).
(HFunctor phi f, HFunctor phi g) => HFunctor phi (:+: f g) | |
(HEq phi f, HEq phi g) => HEq phi (:+: f g) | |
(HShow phi f, HShow phi g) => HShow phi (:+: f g) | |
(HReadPrec phi f, HReadPrec phi g) => HReadPrec phi (:+: f g) | |
(ConNames f, ConNames g) => ConNames (:+: f g) | |
(Fold f, Fold g) => Fold (:+: f g) | |
(Fold f, Fold g) => Fold (:+: f g) |
Represents products (sequences of fields of a constructor).
(f r ix) :*: (g r ix) |
(HFunctor phi f, HFunctor phi g) => HFunctor phi (:*: f g) | |
(HEq phi f, HEq phi g) => HEq phi (:*: f g) | |
(HShow phi f, HShow phi g) => HShow phi (:*: f g) | |
(Constructor c, CountAtoms (:*: f g), HReadPrec phi f, HReadPrec phi g) => HReadPrec phi (C c (:*: f g)) | |
(HReadPrec phi f, HReadPrec phi g) => HReadPrec phi (:*: f g) | |
ConNames (:*: f g) | |
Fold g => Fold (:*: (K a) g) | |
Fold g => Fold (:*: (I xi) g) | |
Fold g => Fold (:*: (K a) g) | |
Fold g => Fold (:*: (I xi) g) | |
(CountAtoms f, CountAtoms g) => CountAtoms (:*: f g) |
Is used to indicate the type that a particular constructor injects to.
Represents composition with functors of kind * -> *.
D (f (g r ix)) |
(Traversable f, HFunctor phi g) => HFunctor phi (:.: f g) | |
(Eq1 f, HEq phi g) => HEq phi (:.: f g) | |
(Show1 f, Traversable f, HShow phi g) => HShow phi (:.: f g) | |
(Constructor c, HReadPrec phi (:.: f g)) => HReadPrec phi (C c (:.: f g)) | |
(Read1 f, HReadPrec phi g) => HReadPrec phi (:.: f g) | |
ConNames (:.: f g) | |
Functor f => Fold (:.: f (I xi)) |
Represents constructors.
(Constructor c, HFunctor phi f) => HFunctor phi (C c f) | |
(Constructor c, HEq phi f) => HEq phi (C c f) | |
(Constructor c, HShow phi f) => HShow phi (C c f) | |
(Constructor c, CountAtoms (:*: f g), HReadPrec phi f, HReadPrec phi g) => HReadPrec phi (C c (:*: f g)) | |
(Constructor c, HReadPrec phi (:.: f g)) => HReadPrec phi (C c (:.: f g)) | |
(Constructor c, HReadPrec phi (K a)) => HReadPrec phi (C c (K a)) | |
(Constructor c, HReadPrec phi (I xi)) => HReadPrec phi (C c (I xi)) | |
Constructor c => HReadPrec phi (C c U) | |
Constructor c => ConNames (C c f) | |
Fold f => Fold (C c f) | |
Fold f => Fold (C c f) |
Constructor information
Unlifted variants
Indexed families
type family PF phi :: (* -> *) -> * -> *Source
Type family describing the pattern functor of a family.
Class that contains the shallow conversion functions for a family.
Equality for indexed families
module Generics.MultiRec.TEq