WashNGo-2.12.0.1: WASH is a family of EDSLs for programming Web applications in Haskell.

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 Data.Typeable class of GHC provides an encoding with similar goals.

Synopsis

Documentation

data TySpec Source

A type specification consists of a type representation TyRep and a list of type declarations.

Constructors

TS TyRep [TyDecl] 

data TyRep Source

A type representation is built from base types, type variables, tuples, and references to data-defined types.

data TyDecl Source

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] 

data ConRep Source

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] 

class Types a whereSource

Methods

ty :: a -> TySpecSource

Instances

Types Bool 
Types Char 
Types Double 
Types Float 
Types Int 
Types Integer 
Types () 
Types a => Types [a] 
Types a => Types (Maybe a) 
(Types a, Types b) => Types (Either a b) 
(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) 

class TID a whereSource

Methods

tid :: a -> ShowSSource

Instances