RepLib-0.5.3.5: Generic programming library with representation types

LicenseBSD
Maintainersweirich@cis.upenn.edu
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Generics.RepLib.R

Description

Basic data structure and class for representation types

Synopsis

Documentation

data R a where Source

A value of type R a is a representation of a type a.

Constructors

Int :: R Int 
Char :: R Char 
Integer :: R Integer 
Float :: R Float 
Double :: R Double 
Rational :: R Rational 
IOError :: R IOError 
IO :: Rep a => R a -> R (IO a) 
Arrow :: (Rep a, Rep b) => R a -> R b -> R (a -> b) 
Data :: DT -> [Con R a] -> R a 
Abstract :: DT -> R a 
Equal :: (Rep a, Rep b) => R a -> R b -> R (a :~: b) 

Instances

TestEquality * R 
Eq (R a) 
Ord (R a) 
Show (R a) 
Show (MTup R l) 

data Con r a where Source

Representation of a data constructor includes an embedding between the datatype and a list of other types as well as the representation of that list of other types.

Constructors

Con :: Emb l a -> MTup r l -> Con r a 

data Emb l a Source

An embedding between a list of types l and a datatype a, based on a particular data constructor. The to function is a wrapper for the constructor, the from function pattern matches on the constructor.

Constructors

Emb 

Fields

to :: l -> a
 
from :: a -> Maybe l
 
labels :: Maybe [String]
 
name :: String
 
fixity :: Fixity
 

data Fixity Source

Constructors

Nonfix 
Infix 

Fields

prec :: Int
 
Infixl 

Fields

prec :: Int
 
Infixr 

Fields

prec :: Int
 

data DT Source

Information about a datatype, including its fully qualified name and representation of its type arguments.

Constructors

forall l . DT String (MTup R l) 

Instances

data Nil Source

An empty list of types

Constructors

Nil 

data a :*: l infixr 7 Source

Cons for a list of types

Constructors

a :*: l infixr 7 

data MTup r l where Source

A heterogeneous list

Constructors

MNil :: MTup r Nil 
(:+:) :: Rep a => r a -> MTup r l -> MTup r (a :*: l) infixr 7 

Instances

Show (MTup R l) 

class Rep a where Source

A class of representable types

Methods

rep :: R a Source

Instances

Rep Bool 
Rep Char 
Rep Double 
Rep Float 
Rep Int 
Rep Integer 
Rep Ordering 
Rep Rational 
Rep () 
Rep IOError 
Rep a => Rep [a] 
Rep a => Rep (IO a) 
Rep a0 => Rep (Maybe a) 
Rep a0 => Rep (Set a) 
(Rep a, Rep b) => Rep (a -> b) 
(Rep a0, Rep b0) => Rep (Either a b) 
(Rep a, Rep b) => Rep (a, b) 
(Rep k0, Rep a0) => Rep (Map k a) 
(Rep a0, Rep b0, Rep c0) => Rep (a, b, c) 
(Rep a, Rep b) => Rep ((:~:) * a b) 
(Rep a0, Rep b0, Rep c0, Rep d0) => Rep (a, b, c, d) 
(Rep a0, Rep b0, Rep c0, Rep d0, Rep e0) => Rep (a, b, c, d, e) 
(Rep a0, Rep b0, Rep c0, Rep d0, Rep e0, Rep f0) => Rep (a, b, c, d, e, f) 
(Rep a0, Rep b0, Rep c0, Rep d0, Rep e0, Rep f0, Rep g0) => Rep (a, b, c, d, e, f, g) 

rUnit :: R () Source

rTup2 :: forall a b. (Rep a, Rep b) => R (a, b) Source

rPairEmb :: Emb (a :*: (b :*: Nil)) (a, b) Source

rList :: forall a. Rep a => R [a] Source

rConsEmb :: Emb (a :*: ([a] :*: Nil)) [a] Source