Generates an UI Widget from a UI data specification, an initial value and an update form. |
Library for creating web applications from ui descriptions with combinators you can create your own widgets Ideas and parts of documentation from PAKCS WUI library
Author: Christof Kluss
Version: September 2008
renderOf
:: (a,b,c) -> a
|
errorOf
:: (a,b,c) -> b
|
conditionOf
:: (a,b,c) -> c
|
withRendering
:: UISpec a -> ([Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef))] -> Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef))) -> UISpec a
Puts a new rendering function into a UI specification. |
withError
:: UISpec a -> String -> UISpec a
Puts a new error message into a UI specification. |
withConditionIO
:: UISpec a -> (a -> IO Bool) -> UISpec a
Puts a new condition into a UI specification. |
withCondition
:: UISpec a -> (a -> Bool) -> UISpec a
Puts a new condition into a UI specification. |
transformWSpec
:: (a -> b,b -> a) -> UISpec a -> UISpec b
Transforms a UI specification from one type to another. |
adaptWSpec
:: (a -> b) -> UISpec a -> UISpec b
Adapt a UI specification to a new type. |
wInt
:: UISpec Int
A widget for editing integer values. |
wConstant
:: (a -> Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef))) -> UISpec a
A widget for values that are shown but cannot be modified. |
wHidden
:: UISpec a
A hidden widget for a value that is not shown in the UI. |
wStringStyles
:: [StyleClass] -> UISpec String
A widget for editing string values |
wString
:: UISpec String
A widget for editing string values |
wStringSize
:: Int -> UISpec String
A widget for editing string values |
wRequiredString
:: UISpec String
A widget for editing string values that are required to be non-empty. |
wRequiredStringSize
:: Int -> UISpec String
A widget for editing string values that are required to be non-empty. |
errorStyle
:: StyleClass
|
showError
:: ErrorRefs -> Maybe String -> UIEnv -> IO ()
|
renderError
:: Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef)) -> ErrorRefs -> Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef))
|
wPair
:: (Eq a, Eq b) => UISpec a -> UISpec b -> UISpec (a,b)
WUI combinator for pairs. |
wTriple
:: (Eq a, Eq b, Eq c) => UISpec a -> UISpec b -> UISpec c -> UISpec (a,b,c)
WUI combinator for triples. |
w4Tuple
:: (Eq a, Eq b, Eq c, Eq d) => UISpec a -> UISpec b -> UISpec c -> UISpec d -> UISpec (a,b,c,d)
WUI combinator for tuples of arity 4. |
w5Tuple
:: (Eq a, Eq b, Eq c, Eq d, Eq e) => UISpec a -> UISpec b -> UISpec c -> UISpec d -> UISpec e -> UISpec (a,b,c,d,e)
WUI combinator for tuples of arity 5. |
w6Tuple
:: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => UISpec a -> UISpec b -> UISpec c -> UISpec d -> UISpec e -> UISpec f -> UISpec (a,b,c,d,e,f)
WUI combinator for tuples of arity 6. |
w7Tuple
:: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => UISpec a -> UISpec b -> UISpec c -> UISpec d -> UISpec e -> UISpec f -> UISpec g -> UISpec (a,b,c,d,e,f,g)
WUI combinator for tuples of arity 7. |
w8Tuple
:: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => UISpec a -> UISpec b -> UISpec c -> UISpec d -> UISpec e -> UISpec f -> UISpec g -> UISpec h -> UISpec (a,b,c,d,e,f,g,h)
WUI combinator for tuples of arity 8. |
w11Tuple
:: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k) => UISpec a -> UISpec b -> UISpec c -> UISpec d -> UISpec e -> UISpec f -> UISpec g -> UISpec h -> UISpec i -> UISpec j -> UISpec k -> UISpec (a,b,c,d,e,f,g,h,i,j,k)
WUI combinator for tuples of arity 11. |
wCons2
:: (Eq a, Eq b) => (a -> b -> c) -> UISpec a -> UISpec b -> UISpec c
UI combinator for constructors of arity 2. |
wTextArea
:: (Int,Int) -> UISpec String
A widget for editing string values in a text area. |
wList
:: Eq a => UISpec a -> UISpec [a]
|
renderList
:: [Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef))] -> Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef))
|
wMultiCheckSelect
:: Eq a => (a -> [Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef))]) -> [a] -> UISpec [a]
A widget to select a list of values from a given list of values via check boxes. |
newVars
:: [a]
|
wSelect
:: Eq a => (a -> String) -> [a] -> UISpec a
A widget to select a value from a given list of values. |
wSelectInt
:: [Int] -> UISpec Int
A widget to select a value from a given list of integers (provided as the argument). |
wSelectBool
:: String -> String -> UISpec Bool
A widget to select a Boolean value via a selection box. |
renderTuple
:: [Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef))] -> Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef))
standard rendering of tuples as a row: |
tupleError
:: String
|
typedui2ui
:: UISpec a -> a -> (Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef)),UIEnv -> IO (Maybe a),a -> UIEnv -> IO (),(a -> a) -> UIEnv -> IO ())
Generates an UI Widget and a handlers from a UI data specification, an initial value. |
typeduistore2ui
:: UISpec a -> a -> (a -> UIEnv -> IO ()) -> (Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef)),UIEnv -> IO ())
Generates HTML editors and a handler from a WUI data specification, an initial value and an update form. |
runUISpec
:: UISpec a -> a -> (a -> UIEnv -> IO ()) -> IO HtmlForm
|
wRadioSelect
:: Eq a => (a -> [Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef))]) -> [a] -> UISpec a
A widget to select a value from a given list of values via a radio button. |
wuiHandler2button
:: String -> WuiHandler -> Widget a (UIEnv -> IO ()) b
|
wuiInForm
:: UISpec a -> a -> (a -> IO HtmlForm) -> (Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef)) -> WuiHandler -> b) -> IO b
Puts a UI into a HTML form containing "holes" for the UI and the handler. |
wui2html
:: UISpec a -> a -> (a -> IO HtmlForm) -> (Widget CgiRef (UIEnv -> IO ()) (Doc (Ref CgiRef)),UIEnv -> IO ())
Generates an UI Widget and a handler from a UI data specification, an initial value and an update form. |
mainWUI
:: UISpec a -> a -> (a -> IO HtmlForm) -> IO HtmlForm
Generates an UI Widget from a UI data specification, an initial value and an update form. |
resultForm
:: Show a => a -> IO HtmlForm
|
wCons3
:: (Eq a, Eq b, Eq c) => (a -> b -> c -> d) -> UISpec a -> UISpec b -> UISpec c -> UISpec d
|
wCons4
:: (Eq a, Eq b, Eq c, Eq d) => (a -> b -> c -> d -> e) -> UISpec a -> UISpec b -> UISpec c -> UISpec d -> UISpec e
|
wCons5
:: (Eq a, Eq b, Eq c, Eq d, Eq e) => (a -> b -> c -> d -> e -> f) -> UISpec a -> UISpec b -> UISpec c -> UISpec d -> UISpec e -> UISpec f
|
wCons6
:: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => (a -> b -> c -> d -> e -> f -> g) -> UISpec a -> UISpec b -> UISpec c -> UISpec d -> UISpec e -> UISpec f -> UISpec g
|
wCons7
:: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => (a -> b -> c -> d -> e -> f -> g -> h) -> UISpec a -> UISpec b -> UISpec c -> UISpec d -> UISpec e -> UISpec f -> UISpec g -> UISpec h
|
wCons8
:: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => (a -> b -> c -> d -> e -> f -> g -> h -> i) -> UISpec a -> UISpec b -> UISpec c -> UISpec d -> UISpec e -> UISpec f -> UISpec g -> UISpec h -> UISpec i
|
wCons11
:: (Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k) => (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -> l) -> UISpec a -> UISpec b -> UISpec c -> UISpec d -> UISpec e -> UISpec f -> UISpec g -> UISpec h -> UISpec i -> UISpec j -> UISpec k -> UISpec l
|
A rendering is a function that combines the visualization of components of a data structure into some HTML expression.
Type synonym: Rendering = [UIWidget] -> UIWidget
UIParams specify the parameters of an individual UI component type:
Type synonym: UIParams a = (Rendering,String,a -> IO Bool)
The type of UI specifications. The first component are parameters specifying the behavior of this UI type (rendering, error message, and constraints on inputs). The second component is a "show" function returning an UI Widget, a "read" function and a "set" function The "read" function extract the values from the Widget. If the value is not legal, Nothing is returned.
Constructors:
UISpec
:: (UIParams a) -> (UIParams a -> a -> (UIWidget,UIEnv -> IO (Maybe a),a -> UIEnv -> IO ())) -> UISpec a
Constructors:
WHandler
:: (UIEnv -> IO ()) -> WuiHandler
|
|
|
Puts a new rendering function into a UI specification.
|
Puts a new error message into a UI specification.
|
Puts a new condition into a UI specification.
|
Puts a new condition into a UI specification.
|
Transforms a UI specification from one type to another. |
Adapt a UI 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 |
A widget for values that are shown but cannot be modified. The first argument is a mapping of the value into a UI Widget to show this value. |
A hidden widget for a value that is not shown in the UI. Usually, this is used in components of larger structures, e.g., internal identifiers, data base keys. |
A widget for editing string values |
A widget for editing string values |
A widget for editing string values that are required to be non-empty. |
A widget for editing string values that are required to be non-empty. |
|
|
WUI combinator for triples. |
WUI combinator for tuples of arity 4. |
WUI combinator for tuples of arity 5. |
WUI combinator for tuples of arity 6. |
WUI combinator for tuples of arity 7. |
WUI combinator for tuples of arity 8. |
WUI combinator for tuples of arity 11. |
UI combinator for constructors of arity 2. The first argument is the binary constructor. The second and third arguments are the UI specifications for the argument types. |
A widget for editing string values in a text area. The argument specifies the height and width of the text area. |
|
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. |
|
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. |
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. |
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.
|
standard rendering of tuples as a row:
|
|
Generates an UI Widget and a handlers from a UI data specification, an initial value. |
Generates HTML editors and a handler from a WUI data specification, an initial value and an update form. |
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. |
|
Puts a UI into a HTML form containing "holes" for the UI and the handler. |
Generates an UI Widget and a handler from a UI data specification, an initial value and an update form. |
Generates an UI Widget from a UI data specification, an initial value and an update form. |
|
|
|
|
|