frame-0.1: A simple web framework.

Frame.Types

Description

Defines a homogenous collection of field types to interface typeless HTTP and HTML with the application and with HaskellDB

Synopsis

Documentation

type FieldName = StringSource

Label for a specific field

data WrapperType Source

Heterogeneous type wrapper

Constructors

WrapString (Maybe Int) String

String wrapper

WrapInt Int

Int wrappr

WrapBool Bool

Bool wrapper

WrapError FieldType String

Type error (specific case of error)

WrapEmpty FieldType

Empty type

type Fields = Map FieldName WrapperTypeSource

Collection of heterogenous fields associated by FieldName

showFieldSource

Arguments

:: FieldName

Field name to look up

-> Fields

Fields to look in

-> String

String representation of field to return

Casts the FieldName in fields to string

purgeSource

Arguments

:: DBInfo 
-> Fields

Fields to purge

-> Fields

Purged fields

Purge non mandatory empty fields

class Wrappable a whereSource

Methods

wrapSource

Arguments

:: DBInfo

The database to check for the type

-> FieldName

Field name that represents this value

-> a

The value in question

-> WrapperType

The wrapped value

Function to wrap a value associated with a given FieldName

unwrapSource

Arguments

:: WrapperType

The wrapped type

-> a

The originally typed value

Function to unwrap a WrapperType to its original type

wrapInt :: String -> WrapperTypeSource

Wrap a String representation of an Int

wrapBool :: String -> WrapperTypeSource

Wrap a String representation of a Bool

wrapErrorSource

Arguments

:: WrapperType

The wrapped type to check

-> String

Error message

Returns an error message if there has been a wrapping error

maybeUnwrapSource

Arguments

:: Maybe WrapperType

The potential wrapped type

-> WrapperType

Definitely a wrapped type (though perhaps an empty one)

A potential WrapperType is WrapEmpty if Nothing

fromList'Source

Arguments

:: DBInfo

Database to use for wrapping info

-> [(FieldName, String)]

List of pairs associating a field name to some String representation of a value

-> Map FieldName WrapperType

The map associating field names to wrapped types

Special version of fromList that also wraps fields as it goes