Module HTML.WUI

A library to support the type-oriented construction of Web User Interfaces (WUIs).

The ideas behind the application and implementation of WUIs are described in a paper that is available via this web page.

Author: Michael Hanus

Version: December 2020

Summary of exported operations:

wuiHandler2button :: String -> WuiHandler -> HtmlExp  Non-deterministic 
Transform a WUI handler into a submit button with a given label string.
withRendering :: WuiSpec a -> ([HtmlExp] -> HtmlExp) -> WuiSpec a  Deterministic 
Puts a new rendering function into a WUI specification.
withError :: WuiSpec a -> String -> WuiSpec a  Deterministic 
Puts a new error message into a WUI specification.
withCondition :: WuiSpec a -> (a -> Bool) -> WuiSpec a  Deterministic 
Puts a new condition into a WUI specification.
transformWSpec :: (a -> b,b -> a) -> WuiSpec a -> WuiSpec b  Deterministic 
Transforms a WUI specification from one type to another.
adaptWSpec :: (Data a, Data b) => (a -> b) -> WuiSpec a -> WuiSpec b  Non-deterministic 
Adapt a WUI specification to a new type.
wHidden :: (Read a, Show a) => WuiSpec a  Deterministic 
A hidden widget for a value that is not shown in the WUI.
wConstant :: (Read a, Show a) => (a -> HtmlExp) -> WuiSpec a  Deterministic 
A widget for values that are shown but cannot be modified.
wInt :: WuiSpec Int  Non-deterministic 
A widget for editing integer values.
wString :: WuiSpec String  Non-deterministic 
A widget for editing string values.
wStringSize :: Int -> WuiSpec String  Non-deterministic 
A widget for editing string values with a size attribute.
wRequiredString :: WuiSpec String  Non-deterministic 
A widget for editing string values that are required to be non-empty.
wRequiredStringSize :: Int -> WuiSpec String  Non-deterministic 
A widget with a size attribute for editing string values that are required to be non-empty.
wTextArea :: (Int,Int) -> WuiSpec String  Non-deterministic 
A widget for editing string values in a text area.
wSelect :: Eq a => (a -> String) -> [a] -> WuiSpec a  Non-deterministic 
A widget to select a value from a given list of values.
wSelectInt :: [Int] -> WuiSpec Int  Non-deterministic 
A widget to select a value from a given list of integers (provided as the argument).
wSelectBool :: String -> String -> WuiSpec Bool  Non-deterministic 
A widget to select a Boolean value via a selection box.
wCheckBool :: [HtmlExp] -> WuiSpec Bool  Non-deterministic 
A widget to select a Boolean value via a check box.
wMultiCheckSelect :: Eq a => (a -> [HtmlExp]) -> [a] -> WuiSpec [a]  Non-deterministic 
A widget to select a list of values from a given list of values via check boxes.
wRadioSelect :: Eq a => (a -> [HtmlExp]) -> [a] -> WuiSpec a  Non-deterministic 
A widget to select a value from a given list of values via a radio button.
wRadioBool :: [HtmlExp] -> [HtmlExp] -> WuiSpec Bool  Non-deterministic 
A widget to select a Boolean value via a radio button.
wPair :: (Data a, Data b) => WuiSpec a -> WuiSpec b -> WuiSpec (a,b)  Deterministic 
WUI combinator for pairs.
wCons2 :: (Data a, Data b, Data c) => (a -> b -> c) -> WuiSpec a -> WuiSpec b -> WuiSpec c  Non-deterministic 
WUI combinator for constructors of arity 2.
wTriple :: (Data a, Data b, Data c) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec (a,b,c)  Deterministic 
WUI combinator for triples.
wCons3 :: (Data a, Data b, Data c, Data d) => (a -> b -> c -> d) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d  Non-deterministic 
WUI combinator for constructors of arity 3.
w4Tuple :: (Data a, Data b, Data c, Data d) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec (a,b,c,d)  Deterministic 
WUI combinator for tuples of arity 4.
wCons4 :: (Data a, Data b, Data c, Data d, Data e) => (a -> b -> c -> d -> e) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e  Non-deterministic 
WUI combinator for constructors of arity 4.
w5Tuple :: (Data a, Data b, Data c, Data d, Data e) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec (a,b,c,d,e)  Deterministic 
WUI combinator for tuples of arity 5.
wCons5 :: (Data a, Data b, Data c, Data d, Data e, Data f) => (a -> b -> c -> d -> e -> f) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f  Non-deterministic 
WUI combinator for constructors of arity 5.
w6Tuple :: (Data a, Data b, Data c, Data d, Data e, Data f) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec (a,b,c,d,e,f)  Deterministic 
WUI combinator for tuples of arity 6.
wCons6 :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g) => (a -> b -> c -> d -> e -> f -> g) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g  Non-deterministic 
WUI combinator for constructors of arity 6.
w7Tuple :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec (a,b,c,d,e,f,g)  Deterministic 
WUI combinator for tuples of arity 7.
wCons7 :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h) => (a -> b -> c -> d -> e -> f -> g -> h) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h  Non-deterministic 
WUI combinator for constructors of arity 7.
w8Tuple :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec (a,b,c,d,e,f,g,h)  Deterministic 
WUI combinator for tuples of arity 8.
wCons8 :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i) => (a -> b -> c -> d -> e -> f -> g -> h -> i) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i  Non-deterministic 
WUI combinator for constructors of arity 8.
w9Tuple :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec (a,b,c,d,e,f,g,h,i)  Deterministic 
WUI combinator for tuples of arity 9.
wCons9 :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j  Non-deterministic 
WUI combinator for constructors of arity 9.
w10Tuple :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec (a,b,c,d,e,f,g,h,i,j)  Deterministic 
WUI combinator for tuples of arity 10.
wCons10 :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec k  Non-deterministic 
WUI combinator for constructors of arity 10.
w11Tuple :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec k -> WuiSpec (a,b,c,d,e,f,g,h,i,j,k)  Deterministic 
WUI combinator for tuples of arity 11.
wCons11 :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec k -> WuiSpec l  Non-deterministic 
WUI combinator for constructors of arity 11.
w12Tuple :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec k -> WuiSpec l -> WuiSpec (a,b,c,d,e,f,g,h,i,j,k,l)  Deterministic 
WUI combinator for tuples of arity 12.
wCons12 :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec k -> WuiSpec l -> WuiSpec m  Non-deterministic 
WUI combinator for constructors of arity 12.
w13Tuple :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec k -> WuiSpec l -> WuiSpec m -> WuiSpec (a,b,c,d,e,f,g,h,i,j,k,l,m)  Deterministic 
WUI combinator for tuples of arity 13.
wCons13 :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec k -> WuiSpec l -> WuiSpec m -> WuiSpec n  Non-deterministic 
WUI combinator for constructors of arity 13.
w14Tuple :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec k -> WuiSpec l -> WuiSpec m -> WuiSpec n -> WuiSpec (a,b,c,d,e,f,g,h,i,j,k,l,m,n)  Deterministic 
WUI combinator for tuples of arity 14.
wCons14 :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec k -> WuiSpec l -> WuiSpec m -> WuiSpec n -> WuiSpec o  Non-deterministic 
WUI combinator for constructors of arity 14.
wJoinTuple :: (Data a, Data b) => WuiSpec a -> WuiSpec b -> WuiSpec (a,b)  Deterministic 
WUI combinator to combine two tuples into a joint tuple.
wList :: Eq a => WuiSpec a -> WuiSpec [a]  Deterministic 
WUI combinator for list structures where the list elements are vertically aligned in a table.
wListWithHeadings :: Eq a => [String] -> WuiSpec a -> WuiSpec [a]  Deterministic 
Add headings to a standard WUI for list structures:
wHList :: Eq a => WuiSpec a -> WuiSpec [a]  Deterministic 
WUI combinator for list structures where the list elements are horizontally aligned in a table.
wMatrix :: Eq a => WuiSpec a -> WuiSpec [[a]]  Deterministic 
WUI for matrices, i.e., list of list of elements visualized as a matrix.
wMaybe :: Eq a => WuiSpec Bool -> WuiSpec a -> a -> WuiSpec (Maybe a)  Deterministic 
WUI for Maybe values.
wCheckMaybe :: Eq a => WuiSpec a -> [HtmlExp] -> a -> WuiSpec (Maybe a)  Non-deterministic 
A WUI for Maybe values where a check box is used to select Just.
wRadioMaybe :: Eq a => WuiSpec a -> [HtmlExp] -> [HtmlExp] -> a -> WuiSpec (Maybe a)  Non-deterministic 
A WUI for Maybe values where radio buttons are used to switch between Nothing and Just.
wEither :: (Eq a, Eq b) => WuiSpec a -> WuiSpec b -> WuiSpec (Either a b)  Deterministic 
WUI for union types.
wTree :: Eq a => WuiSpec a -> WuiSpec (WTree a)  Deterministic 
WUI for tree types.
renderTuple :: [HtmlExp] -> HtmlExp  Deterministic 
Standard rendering of tuples as a table with a single row.
renderTaggedTuple :: [String] -> [HtmlExp] -> HtmlExp  Deterministic 
Standard rendering of tuples with a tag for each element.
renderList :: [HtmlExp] -> HtmlExp  Deterministic 
Standard rendering of lists as a table with a row for each item: Thus, the elements are vertically aligned.
setWuiStore :: Global (SessionStore (Bool,Maybe a)) -> a -> IO ()  Deterministic 
Sets the initial data which are edited in a WUI form in the session store.
setParWuiStore :: Global (SessionStore (a,(Bool,Maybe b))) -> a -> b -> IO ()  Deterministic 
Sets the initial data which are edited in a parameterized WUI form in the session store.
wui2FormDef :: String -> Global (SessionStore (Bool,Maybe a)) -> WuiSpec a -> (a -> IO [BaseHtml]) -> (HtmlExp -> ((HtmlRef -> String) -> IO [BaseHtml]) -> [HtmlExp]) -> HtmlFormDef (Bool,Maybe a)  Non-deterministic 
Generates an HTML form definition from a string (the qualified name of the top-level operation corresponding to this form), a session data store containing the data to be edited, a WUI specification, an action to store the updated data and returning an HTML answer, an operation to render the WUI (e.g., wuiSimpleRenderer), and which is used when input errors must be corrected, from the HTML WUI expression and submit handler.
pwui2FormDef :: String -> Global (SessionStore (a,(Bool,Maybe b))) -> (a -> WuiSpec b) -> (a -> b -> IO [BaseHtml]) -> (a -> HtmlExp -> ((HtmlRef -> String) -> IO [BaseHtml]) -> [HtmlExp]) -> HtmlFormDef (a,(Bool,Maybe b))  Non-deterministic 
Generates an HTML form definition similarly to wui2FormDef but with some additional data on which the further arguments depend.
wuiSimpleRenderer :: HtmlExp -> ((HtmlRef -> String) -> IO [BaseHtml]) -> [HtmlExp]  Non-deterministic 
A standard rendering for WUI forms.

Exported datatypes:


Rendering

A rendering is a function that combines the visualization of components of a data structure into some HTML expression.

Type synonym: Rendering = [HtmlExp] -> HtmlExp


WuiHandler

A handler for a WUI is an event handler for HTML forms possibly with some specific code attached (for future extensions).

Constructors:


WuiSpec

The type of WUI specifications. The first component are parameters specifying the behavior of this WUI type (rendering, error message, and constraints on inputs). The second component is a "show" function returning an HTML expression for the edit fields and a WUI state containing the HtmlRefs to extract the values from the edit fields. If the second component of the show function is True, then the WUI condition is not checked for the data, otherwise the data is rendered with an error message if the WUI condition does not hold for the data. The third component is a predicate to check the correctness of the current data (with all its subcomponents). The fourth component is "read" function to extract the values from the edit fields for a given cgi environment.

Constructors:


WTree

A simple tree structure to demonstrate the construction of WUIs for tree types.

Constructors:

  • WLeaf :: a -> WTree a
  • WNode :: [WTree a] -> WTree a

WuiStore

The type of data actually stored in a WUI store. If the first component is True, the current data is not immediately checked for correctness (usually, if it is the first edit call). The second component is Nothing if the data is not yet set.

Type synonym: WuiStore a = (Bool,Maybe a)


Exported operations:

wuiHandler2button :: String -> WuiHandler -> HtmlExp  Non-deterministic 

Transform a WUI handler into a submit button with a given label string.

withRendering :: WuiSpec a -> ([HtmlExp] -> HtmlExp) -> WuiSpec a  Deterministic 

Puts a new rendering function into a WUI specification.

Further infos:
  • defined as left-associative infix operator with precedence 0
  • solution complete, i.e., able to compute all solutions

withError :: WuiSpec a -> String -> WuiSpec a  Deterministic 

Puts a new error message into a WUI specification.

Further infos:
  • defined as left-associative infix operator with precedence 0
  • solution complete, i.e., able to compute all solutions

withCondition :: WuiSpec a -> (a -> Bool) -> WuiSpec a  Deterministic 

Puts a new condition into a WUI specification.

Further infos:
  • defined as left-associative infix operator with precedence 0
  • solution complete, i.e., able to compute all solutions

transformWSpec :: (a -> b,b -> a) -> WuiSpec a -> WuiSpec b  Deterministic 

Transforms a WUI specification from one type to another.

adaptWSpec :: (Data a, Data b) => (a -> b) -> WuiSpec a -> WuiSpec b  Non-deterministic 

Adapt a WUI specification to a new type. For this purpose, the first argument must be a transformation mapping values from the old type to the new type. This function must be bijective and operationally invertible (i.e., the inverse must be computable by narrowing). Otherwise, use codetransformWSpec/code!

wHidden :: (Read a, Show a) => WuiSpec a  Deterministic 

A hidden widget for a value that is not shown in the WUI. Usually, this is used in components of larger structures, e.g., internal identifiers, data base keys.

wConstant :: (Read a, Show a) => (a -> HtmlExp) -> WuiSpec a  Deterministic 

A widget for values that are shown but cannot be modified. The first argument is a mapping of the value into a HTML expression to show this value.

wInt :: WuiSpec Int  Non-deterministic 

A widget for editing integer values.

wString :: WuiSpec String  Non-deterministic 

A widget for editing string values.

wStringSize :: Int -> WuiSpec String  Non-deterministic 

A widget for editing string values with a size attribute.

wRequiredString :: WuiSpec String  Non-deterministic 

A widget for editing string values that are required to be non-empty.

wRequiredStringSize :: Int -> WuiSpec String  Non-deterministic 

A widget with a size attribute for editing string values that are required to be non-empty.

wTextArea :: (Int,Int) -> WuiSpec String  Non-deterministic 

A widget for editing string values in a text area. The argument specifies the height and width of the text area.

wSelect :: Eq a => (a -> String) -> [a] -> WuiSpec a  Non-deterministic 

A widget to select a value from a given list of values. The current value should be contained in the value list and is preselected. The first argument is a mapping from values into strings to be shown in the selection widget.

wSelectInt :: [Int] -> WuiSpec Int  Non-deterministic 

A widget to select a value from a given list of integers (provided as the argument). The current value should be contained in the value list and is preselected.

wSelectBool :: String -> String -> WuiSpec Bool  Non-deterministic 

A widget to select a Boolean value via a selection box. The arguments are the strings that are shown for the values True and False in the selection box, respectively.

Example call:
(wSelectBool true false)
Parameters:
  • true : string for selection of True
  • false : string for selection of False
Returns:
a WUI specification for a Boolean selection widget

wCheckBool :: [HtmlExp] -> WuiSpec Bool  Non-deterministic 

A widget to select a Boolean value via a check box. The first argument are HTML expressions that are shown after the check box. The result is True if the box is checked.

wMultiCheckSelect :: Eq a => (a -> [HtmlExp]) -> [a] -> WuiSpec [a]  Non-deterministic 

A widget to select a list of values from a given list of values via check boxes. The current values should be contained in the value list and are preselected. The first argument is a mapping from values into HTML expressions that are shown for each item after the check box.

wRadioSelect :: Eq a => (a -> [HtmlExp]) -> [a] -> WuiSpec a  Non-deterministic 

A widget to select a value from a given list of values via a radio button. The current value should be contained in the value list and is preselected. The first argument is a mapping from values into HTML expressions that are shown for each item after the radio button.

wRadioBool :: [HtmlExp] -> [HtmlExp] -> WuiSpec Bool  Non-deterministic 

A widget to select a Boolean value via a radio button. The arguments are the lists of HTML expressions that are shown after the True and False radio buttons, respectively.

Example call:
(wRadioBool true false)
Parameters:
  • true : HTML expressions for True radio button
  • false : HTML expressions for False radio button
Returns:
a WUI specification for a Boolean selection widget

wPair :: (Data a, Data b) => WuiSpec a -> WuiSpec b -> WuiSpec (a,b)  Deterministic 

WUI combinator for pairs.

wCons2 :: (Data a, Data b, Data c) => (a -> b -> c) -> WuiSpec a -> WuiSpec b -> WuiSpec c  Non-deterministic 

WUI combinator for constructors of arity 2. The first argument is the binary constructor. The second and third arguments are the WUI specifications for the argument types.

wTriple :: (Data a, Data b, Data c) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec (a,b,c)  Deterministic 

WUI combinator for triples.

wCons3 :: (Data a, Data b, Data c, Data d) => (a -> b -> c -> d) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d  Non-deterministic 

WUI combinator for constructors of arity 3. The first argument is the ternary constructor. The further arguments are the WUI specifications for the argument types.

w4Tuple :: (Data a, Data b, Data c, Data d) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec (a,b,c,d)  Deterministic 

WUI combinator for tuples of arity 4.

wCons4 :: (Data a, Data b, Data c, Data d, Data e) => (a -> b -> c -> d -> e) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e  Non-deterministic 

WUI combinator for constructors of arity 4. The first argument is the ternary constructor. The further arguments are the WUI specifications for the argument types.

w5Tuple :: (Data a, Data b, Data c, Data d, Data e) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec (a,b,c,d,e)  Deterministic 

WUI combinator for tuples of arity 5.

wCons5 :: (Data a, Data b, Data c, Data d, Data e, Data f) => (a -> b -> c -> d -> e -> f) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f  Non-deterministic 

WUI combinator for constructors of arity 5. The first argument is the ternary constructor. The further arguments are the WUI specifications for the argument types.

w6Tuple :: (Data a, Data b, Data c, Data d, Data e, Data f) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec (a,b,c,d,e,f)  Deterministic 

WUI combinator for tuples of arity 6.

wCons6 :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g) => (a -> b -> c -> d -> e -> f -> g) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g  Non-deterministic 

WUI combinator for constructors of arity 6. The first argument is the ternary constructor. The further arguments are the WUI specifications for the argument types.

w7Tuple :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec (a,b,c,d,e,f,g)  Deterministic 

WUI combinator for tuples of arity 7.

wCons7 :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h) => (a -> b -> c -> d -> e -> f -> g -> h) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h  Non-deterministic 

WUI combinator for constructors of arity 7. The first argument is the ternary constructor. The further arguments are the WUI specifications for the argument types.

w8Tuple :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec (a,b,c,d,e,f,g,h)  Deterministic 

WUI combinator for tuples of arity 8.

wCons8 :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i) => (a -> b -> c -> d -> e -> f -> g -> h -> i) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i  Non-deterministic 

WUI combinator for constructors of arity 8. The first argument is the ternary constructor. The further arguments are the WUI specifications for the argument types.

w9Tuple :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec (a,b,c,d,e,f,g,h,i)  Deterministic 

WUI combinator for tuples of arity 9.

wCons9 :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j  Non-deterministic 

WUI combinator for constructors of arity 9. The first argument is the ternary constructor. The further arguments are the WUI specifications for the argument types.

w10Tuple :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec (a,b,c,d,e,f,g,h,i,j)  Deterministic 

WUI combinator for tuples of arity 10.

wCons10 :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec k  Non-deterministic 

WUI combinator for constructors of arity 10. The first argument is the ternary constructor. The further arguments are the WUI specifications for the argument types.

w11Tuple :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec k -> WuiSpec (a,b,c,d,e,f,g,h,i,j,k)  Deterministic 

WUI combinator for tuples of arity 11.

wCons11 :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec k -> WuiSpec l  Non-deterministic 

WUI combinator for constructors of arity 11. The first argument is the ternary constructor. The further arguments are the WUI specifications for the argument types.

w12Tuple :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec k -> WuiSpec l -> WuiSpec (a,b,c,d,e,f,g,h,i,j,k,l)  Deterministic 

WUI combinator for tuples of arity 12.

wCons12 :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec k -> WuiSpec l -> WuiSpec m  Non-deterministic 

WUI combinator for constructors of arity 12. The first argument is the ternary constructor. The further arguments are the WUI specifications for the argument types.

w13Tuple :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec k -> WuiSpec l -> WuiSpec m -> WuiSpec (a,b,c,d,e,f,g,h,i,j,k,l,m)  Deterministic 

WUI combinator for tuples of arity 13.

wCons13 :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec k -> WuiSpec l -> WuiSpec m -> WuiSpec n  Non-deterministic 

WUI combinator for constructors of arity 13. The first argument is the ternary constructor. The further arguments are the WUI specifications for the argument types.

w14Tuple :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n) => WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec k -> WuiSpec l -> WuiSpec m -> WuiSpec n -> WuiSpec (a,b,c,d,e,f,g,h,i,j,k,l,m,n)  Deterministic 

WUI combinator for tuples of arity 14.

wCons14 :: (Data a, Data b, Data c, Data d, Data e, Data f, Data g, Data h, Data i, Data j, Data k, Data l, Data m, Data n, Data o) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l -> m -> n -> o) -> WuiSpec a -> WuiSpec b -> WuiSpec c -> WuiSpec d -> WuiSpec e -> WuiSpec f -> WuiSpec g -> WuiSpec h -> WuiSpec i -> WuiSpec j -> WuiSpec k -> WuiSpec l -> WuiSpec m -> WuiSpec n -> WuiSpec o  Non-deterministic 

WUI combinator for constructors of arity 14. The first argument is the ternary constructor. The further arguments are the WUI specifications for the argument types.

wJoinTuple :: (Data a, Data b) => WuiSpec a -> WuiSpec b -> WuiSpec (a,b)  Deterministic 

WUI combinator to combine two tuples into a joint tuple. It is similar to wPair but renders both components as a single tuple provided that the components are already rendered as tuples, i.e., by the rendering function coderenderTuple/code. This combinator is useful to define combinators for large tuples.

wList :: Eq a => WuiSpec a -> WuiSpec [a]  Deterministic 

WUI combinator for list structures where the list elements are vertically aligned in a table.

wListWithHeadings :: Eq a => [String] -> WuiSpec a -> WuiSpec [a]  Deterministic 

Add headings to a standard WUI for list structures:

wHList :: Eq a => WuiSpec a -> WuiSpec [a]  Deterministic 

WUI combinator for list structures where the list elements are horizontally aligned in a table.

wMatrix :: Eq a => WuiSpec a -> WuiSpec [[a]]  Deterministic 

WUI for matrices, i.e., list of list of elements visualized as a matrix.

wMaybe :: Eq a => WuiSpec Bool -> WuiSpec a -> a -> WuiSpec (Maybe a)  Deterministic 

WUI for Maybe values. It is constructed from a WUI for Booleans and a WUI for the potential values. Nothing corresponds to a selection of False in the Boolean WUI. The value WUI is shown after the Boolean WUI.

Example call:
(wMaybe wspecb wspeca def)
Parameters:
  • wspecb : a WUI specification for Boolean values
  • wspeca : a WUI specification for the type of potential values
  • def : a default value that is used if the current value is Nothing

wCheckMaybe :: Eq a => WuiSpec a -> [HtmlExp] -> a -> WuiSpec (Maybe a)  Non-deterministic 

A WUI for Maybe values where a check box is used to select Just. The value WUI is shown after the check box.

Example call:
(wCheckMaybe wspec hexps def)
Parameters:
  • wspec : a WUI specification for the type of potential values
  • hexps : a list of HTML expressions shown after the check box
  • def : a default value if the current value is Nothing

wRadioMaybe :: Eq a => WuiSpec a -> [HtmlExp] -> [HtmlExp] -> a -> WuiSpec (Maybe a)  Non-deterministic 

A WUI for Maybe values where radio buttons are used to switch between Nothing and Just. The value WUI is shown after the radio button WUI.

Example call:
(wRadioMaybe wspec hexps hexps def)
Parameters:
  • wspec : a WUI specification for the type of potential values
  • hexps : a list of HTML expressions shown after the Nothing button
  • hexps : a list of HTML expressions shown after the Just button
  • def : a default value if the current value is Nothing

wEither :: (Eq a, Eq b) => WuiSpec a -> WuiSpec b -> WuiSpec (Either a b)  Deterministic 

WUI for union types. Here we provide only the implementation for Either types since other types with more alternatives can be easily reduced to this case.

wTree :: Eq a => WuiSpec a -> WuiSpec (WTree a)  Deterministic 

WUI for tree types. The rendering specifies the rendering of inner nodes. Leaves are shown with their default rendering.

renderTuple :: [HtmlExp] -> HtmlExp  Deterministic 

Standard rendering of tuples as a table with a single row. Thus, the elements are horizontally aligned.

renderTaggedTuple :: [String] -> [HtmlExp] -> HtmlExp  Deterministic 

Standard rendering of tuples with a tag for each element. Thus, each is preceded by a tag, that is set in bold, and all elements are vertically aligned.

renderList :: [HtmlExp] -> HtmlExp  Deterministic 

Standard rendering of lists as a table with a row for each item: Thus, the elements are vertically aligned.

setWuiStore :: Global (SessionStore (Bool,Maybe a)) -> a -> IO ()  Deterministic 

Sets the initial data which are edited in a WUI form in the session store.

setParWuiStore :: Global (SessionStore (a,(Bool,Maybe b))) -> a -> b -> IO ()  Deterministic 

Sets the initial data which are edited in a parameterized WUI form in the session store.

wui2FormDef :: String -> Global (SessionStore (Bool,Maybe a)) -> WuiSpec a -> (a -> IO [BaseHtml]) -> (HtmlExp -> ((HtmlRef -> String) -> IO [BaseHtml]) -> [HtmlExp]) -> HtmlFormDef (Bool,Maybe a)  Non-deterministic 

Generates an HTML form definition from a string (the qualified name of the top-level operation corresponding to this form), a session data store containing the data to be edited, a WUI specification, an action to store the updated data and returning an HTML answer, an operation to render the WUI (e.g., wuiSimpleRenderer), and which is used when input errors must be corrected, from the HTML WUI expression and submit handler.

pwui2FormDef :: String -> Global (SessionStore (a,(Bool,Maybe b))) -> (a -> WuiSpec b) -> (a -> b -> IO [BaseHtml]) -> (a -> HtmlExp -> ((HtmlRef -> String) -> IO [BaseHtml]) -> [HtmlExp]) -> HtmlFormDef (a,(Bool,Maybe b))  Non-deterministic 

Generates an HTML form definition similarly to wui2FormDef but with some additional data on which the further arguments depend.

wuiSimpleRenderer :: HtmlExp -> ((HtmlRef -> String) -> IO [BaseHtml]) -> [HtmlExp]  Non-deterministic 

A standard rendering for WUI forms. The arguments are the HTML expression representing the WUI fields and the handler for the "submit" button.