|
|
|
|
|
|
Synopsis |
|
io :: (Read a, Show a) => IO a -> CGI a | | once :: (Read a, Show a) => CGI a -> CGI a | | forever :: CGI () -> CGI () | | onceAndThen :: (Read a, Show a) => a -> CGI a -> CGI a | | unsafe_io :: IO a -> CGI a | | ask :: WithHTML x CGI a -> CGI () | | askOffline :: WithHTML x CGI a -> (Element -> IO ()) -> CGI () | | run :: CGI () -> IO () | | runWithOptions :: CGIOptions -> CGI () -> IO () | | runWithHook :: CGIOptions -> ([String] -> CGI ()) -> CGI () -> IO () | | makeServlet :: CGI () -> CGIProgram | | makeServletWithHook :: ([String] -> CGI ()) -> CGI () -> CGIProgram | | makeRef :: Monad m => String -> WithHTML x m () -> CGI (WithHTML y m ()) | | makePopupRef :: String -> String -> HTMLCons x y CGI () | | makeA :: String -> String -> HTMLField x y () | | data VALID = VALID | | data INVALID = INVALID | | data InputField a x = InputField {} | | concatFields :: (Reason c, Read c) => InputField c INVALID -> InputField Text INVALID -> InputField c INVALID | | concatFieldsWith :: (Reason c, Read c) => (String -> [String] -> String) -> InputField c INVALID -> [InputField Text INVALID] -> InputField c INVALID | | feither :: (a -> b) -> (c -> d) -> Either a c -> Either b d | | propagate :: Either [err] a -> Either [err] b -> Either [err] (a, b) | | data ValidationError = ValidationError {} | | | | textual :: InputType -> Bool | | type HTMLField x y a = WithHTML x CGI () -> WithHTML y CGI a | | resetField :: HTMLField x y (InputField () INVALID) | | submitField :: CGI () -> HTMLField x y () | | defaultSubmitField :: CGI () -> HTMLField x y () | | activeInputField :: (Reason a, Read a) => (a -> CGI ()) -> HTMLField x y () | | activateI :: (a -> CGI ()) -> HTMLField x y (InputField a INVALID) -> HTMLField x y () | | inputField :: (Reason a, Read a) => HTMLField x y (InputField a INVALID) | | maybeRead :: Read a => String -> Maybe a | | textInputField :: HTMLField x y (InputField String INVALID) | | checkedTextInputField :: (Maybe String -> Maybe String) -> HTMLField x y (InputField String INVALID) | | passwordInputField :: (Reason a, Read a) => HTMLField x y (InputField a INVALID) | | checkboxInputField :: HTMLField x y (InputField Bool INVALID) | | fileInputField :: HTMLField x y (InputField FileReference INVALID) | | checkedFileInputField :: (Maybe FileReference -> Maybe FileReference) -> HTMLField x y (InputField FileReference INVALID) | | genericField :: Reason a => InputType -> (Maybe String -> Maybe a) -> HTMLField x y (InputField a INVALID) | | internalSubmitLink :: Bool -> Either [ValidationError] (CGI ()) -> HTMLCons x y CGI () | | imageField :: Image -> HTMLField x y (InputField (Int, Int) INVALID) | | data RadioGroup a x = RadioGroup {} | | radioGroup :: Read a => WithHTML x CGI (RadioGroup a INVALID) | | radioButton :: Show a => RadioGroup a INVALID -> a -> HTMLField x y () | | radioError :: RadioGroup a INVALID -> WithHTML x CGI () | | makeButton :: HTMLField x y (InputField Bool INVALID) | | makeForm :: WithHTML x CGI a -> WithHTML y CGI () | | makeTextarea :: String -> HTMLField x y (InputField String INVALID) | | selectMultiple :: Eq a => (a -> String) -> [a] -> [a] -> (Int, Int) -> HTMLField x y (InputField [a] INVALID) | | selectSingle :: Eq a => (a -> String) -> Maybe a -> [a] -> HTMLField x y (InputField a INVALID) | | selectBounded :: (Enum a, Bounded a, Read a, Show a, Eq a) => Maybe a -> HTMLField x y (InputField a INVALID) | | fieldSIZE :: Monad m => Int -> WithHTML x m () | | fieldMAXLENGTH :: Monad m => Int -> WithHTML x m () | | fieldVALUE :: (Monad m, Show a) => a -> WithHTML x m () | | tell :: CGIOutput a => a -> CGI () | | htell :: WithHTML x IO () -> CGI a | | data Image = Image {} | | internalImage :: FreeForm -> String -> WithHTML x CGI Image | | dataImage :: FreeForm -> String -> WithHTML x CGI Image | | jsImage :: FreeForm -> String -> WithHTML x CGI Image | | externalImage :: URL -> String -> WithHTML x CGI Image | | makeImg :: Image -> HTMLField x y () | | frameTranslator :: ([String] -> CGI ()) -> [String] -> CGI () | | docTranslator :: [FreeForm] -> ([String] -> CGI ()) -> [String] -> CGI () | | lastTranslator :: [String] -> CGI () | | reportError :: String -> WithHTML x IO () -> CGIState -> IO (a, CGIState) | | backLink :: Monad m => HTMLCons x y m () | | hlink :: Monad m => URL -> HTMLCons x y m () | | popuplink :: Monad m => String -> URL -> HTMLCons x y m () | | restart :: CGI () | | standardQuery :: String -> WithHTML x CGI a -> CGI () | | tellError :: String -> Element -> CGI a |
|
|
Documentation |
|
io :: (Read a, Show a) => IO a -> CGI a |
Safe embedding of an IO action into the CGI monad. |
|
once :: (Read a, Show a) => CGI a -> CGI a |
Brackets a CGI action so that only its result is visible. Improves
efficiency by not executing the bracketed action after it has been performed
once. Use this for avoiding the inefficient buildup of long interaction logs. |
|
forever :: CGI () -> CGI () |
Repeats a CGI action without saving its state so that the size of the
interaction log remains constant. |
|
onceAndThen :: (Read a, Show a) => a -> CGI a -> CGI a |
Unsafe variant of once: returns the computed value only the first time
and returns a default value in all later invocations. |
|
unsafe_io :: IO a -> CGI a |
Directly lifts the IO monad into the CGI monad. This is generally unsafe
and should be avoided. Use io instead. |
|
ask :: WithHTML x CGI a -> CGI () |
Takes a monadic value that constructs a HTML page and delivers this
page to the browser. This page may contain forms and input widgets. |
|
askOffline :: WithHTML x CGI a -> (Element -> IO ()) -> CGI () |
Like ask, but passes the constructed HTML page to the elementAction
parameter. This function may send the page via Email or store it into a
file. Anyone loading this page in a browser can resume the interaction. |
|
run :: CGI () -> IO () |
Turns a CGI action into an IO action. Used to turn the main CGI action
into the main function of the program. Typical use:
main = run mainCGI |
|
runWithOptions :: CGIOptions -> CGI () -> IO () |
Turns a CGI action into an IO action. Used to turn the main CGI action
into the main function of the program. Takes additional low-level
options. Typical use:
main = runWithOptions [] mainCGI |
|
runWithHook :: CGIOptions -> ([String] -> CGI ()) -> CGI () -> IO () |
Variant of run where an additional argument cgigen specifies an action
taken when the script is invoked with a non-empty query string as in
script-name?query-string |
|
makeServlet :: CGI () -> CGIProgram |
Transform a CGI action into a servlet suitable for running from Marlow's web
server. |
|
makeServletWithHook :: ([String] -> CGI ()) -> CGI () -> CGIProgram |
Like makeServlet with additional CGI generator as in runWithHook. |
|
makeRef |
:: Monad m | | => String | internal name of entity | -> WithHTML x m () | body of the reference | -> CGI (WithHTML y m ()) | | Create a hyperlink to internal entity. |
|
|
makePopupRef |
:: String | name of popup window | -> String | internal name of entity | -> HTMLCons x y CGI () | | Create a popup hyperlink to internal entity. |
|
|
makeA :: String -> String -> HTMLField x y () |
Create hyperlink to internal entity /path?name. |
|
data VALID |
|
|
data INVALID |
|
|
data InputField a x |
Constructors | InputField | | ifName :: String | | ifToken :: CGIFieldName | | ifFty :: String | | ifString :: (Maybe String) | | ifValue :: (Maybe a) | | ifRaw :: CGIParameters | | ifBound :: Bool | |
|
| Instances | |
|
|
concatFields :: (Reason c, Read c) => InputField c INVALID -> InputField Text INVALID -> InputField c INVALID |
create a virtual input field from the concatenation of two input fields |
|
concatFieldsWith :: (Reason c, Read c) => (String -> [String] -> String) -> InputField c INVALID -> [InputField Text INVALID] -> InputField c INVALID |
Create a virtual input field from the result of applying a function to two
input fields. Parsing is applied to the result of the function call. |
|
feither :: (a -> b) -> (c -> d) -> Either a c -> Either b d |
|
propagate :: Either [err] a -> Either [err] b -> Either [err] (a, b) |
|
data ValidationError |
Constructors | ValidationError | | veName :: String | | veToken :: CGIFieldName | | veString :: (Maybe String) | |
|
|
|
|
data InputType |
Constructors | TEXT | | PASSWORD | | CHECKBOX | | RADIO | | SUBMIT | | RESET | | FILE | | HIDDEN | | IMAGE | | BUTTON | |
| Instances | |
|
|
textual :: InputType -> Bool |
|
type HTMLField x y a = WithHTML x CGI () -> WithHTML y CGI a |
Every input widget maps the content generator for the widget (which may
produce HTML elements or attributes) to the content generator of the widget. |
|
resetField :: HTMLField x y (InputField () INVALID) |
Creates a reset button that clears all fields of a form. |
|
submitField :: CGI () -> HTMLField x y () |
Creates a submit button. Unsafe. Internal use only. |
|
defaultSubmitField :: CGI () -> HTMLField x y () |
|
activeInputField |
:: (Reason a, Read a) | | => (a -> CGI ()) | Function that maps input data to a CGI action. | -> HTMLField x y () | | Creates an input field that submits the field to the browser when data is
entered into this field. |
|
|
activateI :: (a -> CGI ()) -> HTMLField x y (InputField a INVALID) -> HTMLField x y () |
Attach a CGI action to the value returned by the input field. Activation
means that data is submitted as soon as it is entered. |
|
inputField :: (Reason a, Read a) => HTMLField x y (InputField a INVALID) |
Create a textual input field. Return type can be *anything* in class Reason
and Read. |
|
maybeRead :: Read a => String -> Maybe a |
|
textInputField :: HTMLField x y (InputField String INVALID) |
Create a textual input field that returns the string entered. (Avoids having
to put quotes around a string.) |
|
checkedTextInputField :: (Maybe String -> Maybe String) -> HTMLField x y (InputField String INVALID) |
Creates a textual input field that takes a custom validation function. |
|
passwordInputField :: (Reason a, Read a) => HTMLField x y (InputField a INVALID) |
Like inputField but the characters are not echoed on the screen. |
|
checkboxInputField :: HTMLField x y (InputField Bool INVALID) |
Creates a checkbox. Returns True if box was checked. |
|
fileInputField :: HTMLField x y (InputField FileReference INVALID) |
Creates a file input field. Returns a temporary FileReference. The
fileReferenceName of the result is *not* guaranteed to be persistent. The
application is responsible for filing it away at a safe place. |
|
checkedFileInputField :: (Maybe FileReference -> Maybe FileReference) -> HTMLField x y (InputField FileReference INVALID) |
Creates a file input field. Like fileInputField but has an additional
parameter for additional validation of the input. |
|
genericField :: Reason a => InputType -> (Maybe String -> Maybe a) -> HTMLField x y (InputField a INVALID) |
|
internalSubmitLink :: Bool -> Either [ValidationError] (CGI ()) -> HTMLCons x y CGI () |
generates a hyperlink that submits the current form. |
|
imageField :: Image -> HTMLField x y (InputField (Int, Int) INVALID) |
Create an input field from an image. Returns (x,y)
position clicked in the image. |
|
data RadioGroup a x |
Constructors | RadioGroup | | radioName :: String | | radioToken :: CGIFieldName | | radioString :: (Maybe String) | | radioValue :: (Maybe a) | | radioBound :: Bool | |
|
| Instances | |
|
|
radioGroup :: Read a => WithHTML x CGI (RadioGroup a INVALID) |
Create a handle for a new radio group. This handle is invisible on the screen! |
|
radioButton :: Show a => RadioGroup a INVALID -> a -> HTMLField x y () |
Create a new radio button and attach it to an existing RadioGroup. |
|
radioError :: RadioGroup a INVALID -> WithHTML x CGI () |
Create and place the error indicator for an existing RadioGroup. Becomes
visible only if no button of a radio group is pressed. |
|
makeButton :: HTMLField x y (InputField Bool INVALID) |
Create a single button. |
|
makeForm :: WithHTML x CGI a -> WithHTML y CGI () |
Wraps an HTML form around its arguments. All standard attributes are
computed and need not be supplied explicitly. |
|
makeTextarea :: String -> HTMLField x y (InputField String INVALID) |
Create a text area with a preset string. |
|
selectMultiple |
:: Eq a | | => (a -> String) | function to display values of type a | -> [a] | list of preselected entries | -> [a] | list of all possible entries | -> (Int, Int) | (min, max) number of fields that must be selected | -> HTMLField x y (InputField [a] INVALID) | | Create a selection box where multiple entries can be selected. |
|
|
selectSingle |
:: Eq a | | => (a -> String) | function to display values of type a | -> Maybe a | optional preselected value | -> [a] | list of all possible values | -> HTMLField x y (InputField a INVALID) | | Create a selection box where exactly one entry can be selected. |
|
|
selectBounded :: (Enum a, Bounded a, Read a, Show a, Eq a) => Maybe a -> HTMLField x y (InputField a INVALID) |
Selection box for elements of a Bounded type. Argument is the optional
preselected value. |
|
fieldSIZE :: Monad m => Int -> WithHTML x m () |
Create a SIZE attribute from an Int. |
|
fieldMAXLENGTH :: Monad m => Int -> WithHTML x m () |
Create a MAXLENGTH attribute from an Int. |
|
fieldVALUE :: (Monad m, Show a) => a -> WithHTML x m () |
Create a VALUE attribute from any Showable. |
|
tell :: CGIOutput a => a -> CGI () |
Terminates script by sending its argument to the browser. |
|
htell :: WithHTML x IO () -> CGI a |
Terminate script by sending a HTML page constructed by monadic argument. |
|
data Image |
Constructors | Image | | imageSRC :: URL | | imageALT :: String | |
|
|
|
|
internalImage |
|
|
dataImage |
:: FreeForm | the raw image | -> String | alternative text | -> WithHTML x CGI Image | | Reference to internal image via data URL (small images, only). |
|
|
jsImage |
:: FreeForm | the raw image | -> String | alternative text | -> WithHTML x CGI Image | | Reference to internal image via javascript URL (does not seem to work). |
|
|
externalImage |
|
|
makeImg :: Image -> HTMLField x y () |
Create an inline image. |
|
frameTranslator :: ([String] -> CGI ()) -> [String] -> CGI () |
|
docTranslator :: [FreeForm] -> ([String] -> CGI ()) -> [String] -> CGI () |
A translator is a function [String] -> CGI (). It takes the query string
of the URL (of type [String]) and translates it into a CGI
action. docTranslator docs next
takes a list of FreeForm documents and a next translator. It tries to
select a document by its ffName and falls through to the
next translator if no document matches. |
|
lastTranslator :: [String] -> CGI () |
Terminates a sequence of translators. |
|
reportError :: String -> WithHTML x IO () -> CGIState -> IO (a, CGIState) |
|
backLink :: Monad m => HTMLCons x y m () |
Link to previous page in browser's history. Uses JavaScript. |
|
hlink :: Monad m => URL -> HTMLCons x y m () |
Plain Hyperlink from an URL string. |
|
popuplink :: Monad m => String -> URL -> HTMLCons x y m () |
Hyperlink that creates a named popup window from an URL string. |
|
restart :: CGI () |
restart application. |
|
standardQuery :: String -> WithHTML x CGI a -> CGI () |
Convenient workhorse. Takes the title of a page and a monadic HTML value for
the contents of the page. Wraps the contents in a form so that input fields
and buttons may be used inside. |
|
tellError :: String -> Element -> CGI a |
|
Produced by Haddock version 0.6 |