License | BSD |
---|---|
Maintainer | sweirich@cis.upenn.edu |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Basic data structure and class for representation types
- data R a where
- 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)
- data Con r a where
- data Emb l a = Emb {}
- data Fixity
- data DT = DT String (MTup R l)
- data Nil = Nil
- data a :*: l = a :*: l
- data MTup r l where
- class Rep a where
- withRep :: R a -> (Rep a => r) -> r
- rUnitEmb :: Emb Nil ()
- rUnit :: R ()
- rTup2 :: forall a b. (Rep a, Rep b) => R (a, b)
- rPairEmb :: Emb (a :*: (b :*: Nil)) (a, b)
- rList :: forall a. Rep a => R [a]
- rNilEmb :: Emb Nil [a]
- rConsEmb :: Emb (a :*: ([a] :*: Nil)) [a]
Documentation
A value of type R a
is a representation of a type a
.
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) |
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.
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.
Information about a datatype, including its fully qualified name and representation of its type arguments.
A heterogeneous list
A class of representable types
Rep Char Source # | |
Rep Double Source # | |
Rep Float Source # | |
Rep Int Source # | |
Rep Integer Source # | |
Rep Rational Source # | |
Rep () Source # | |
Rep IOError Source # | |
Rep a => Rep [a] Source # | |
Rep a => Rep (IO a) Source # | |
(Rep a, Rep b) => Rep (a -> b) Source # | |
(Rep a, Rep b) => Rep (a, b) Source # | |
(Rep a, Rep b) => Rep ((:~:) * a b) Source # | |