WashNGo-2.12: WASH is a family of embedded domain specific languages (EDSL) for programming Web applications in Haskell.ContentsIndex
WASH.CGI.Types
Description

The Types module aims at providing a representation for (first-order) monomorphic Haskell types. Two type representations are equal if and only if the represented types have identical definitions. Thus a type representation consists of a type term and the smallest list of all (data or newtype) definitions needed either in the type term or in another definition. The list of definitions is sorted to make representations unique.

The main use of type representations is to provide a type index for storing Haskell values externally and for reading them back into a running program without sacrificing type safety. Just reading them back with the Read class is not sufficient because

  • Read does not distinguish between Int and Integer, Float and Doubley
  • Read cannot avoid accidental matches of constructor names

Meanwhile, the Typeable class of GHC provides an encoding with similar goals.

Synopsis
data TySpec = TS TyRep [TyDecl]
data TyRep
= TRBase String
| TRVar String
| TRTuple [TyRep]
| TRData String [TyRep]
data TyDecl = TD String [String] [ConRep]
data ConRep = CR String (Maybe [String]) [TyRep]
class Types a where
ty :: a -> TySpec
listDef :: TyDecl
maybeDef :: TyDecl
eitherDef :: TyDecl
merge :: [TyDecl] -> [TyDecl] -> [TyDecl]
merges :: [[TyDecl]] -> [TyDecl]
class TID a where
tid :: a -> ShowS
Documentation
data TySpec
A type specification consists of a type representation TyRep and a list of type declarations.
Constructors
TS TyRep [TyDecl]
show/hide Instances
data TyRep
A type representation is built from base types, type variables, tuples, and references to data-defined types.
Constructors
TRBase String
TRVar String
TRTuple [TyRep]
TRData String [TyRep]
show/hide Instances
data TyDecl
A data declaration consists of the name of the data type, a list of type variables, and a list of constructor representations.
Constructors
TD String [String] [ConRep]
show/hide Instances
data ConRep
A constructor is represented by its name, a list of field names (if defined using record notation), and the list of its argument types
Constructors
CR String (Maybe [String]) [TyRep]
show/hide Instances
class Types a where
Methods
ty :: a -> TySpec
show/hide Instances
Types Bool
Types Char
Types Double
Types Float
Types Int
Types Integer
Types ()
(Types a, Types b) => Types (a, b)
(Types a, Types b, Types c) => Types (a, b, c)
(Types a, Types b, Types c, Types d) => Types (a, b, c, d)
(Types a, Types b, Types c, Types d, Types e) => Types (a, b, c, d, e)
Types a => Types (Maybe a)
Types a => Types [a]
(Types a, Types b) => Types (Either a b)
listDef :: TyDecl
maybeDef :: TyDecl
eitherDef :: TyDecl
merge :: [TyDecl] -> [TyDecl] -> [TyDecl]
merges :: [[TyDecl]] -> [TyDecl]
class TID a where
Methods
tid :: a -> ShowS
show/hide Instances
Produced by Haddock version 0.8