WashNGo-2.12.0.1: WASH is a family of EDSLs for programming Web applications in Haskell.Source codeContentsIndex
WASH.CGI.BaseCombinators
Synopsis
io :: (Read a, Show a) => IO a -> CGI a
feedback :: (CGIMonad cgi, Read a, Show a) => (a -> cgi a) -> a -> cgi a
callWithCurrentHistory :: (CGIMonad cgi, Read a, Show a) => ((a -> cgi ()) -> a -> cgi ()) -> a -> cgi ()
once :: (CGIMonad cgi, Read a, Show a) => cgi a -> cgi a
forever :: CGIMonad cgi => cgi () -> cgi ()
onceAndThen :: (CGIMonad cgi, Read a, Show a) => a -> cgi a -> cgi a
unsafe_io :: IO a -> CGI a
ask :: CGIMonad cgi => WithHTML x cgi a -> cgi ()
askResumptive :: CGIMonad cgi => WithHTML x cgi a -> cgi ()
askContinuously :: CGIMonad cgi => WithHTML x cgi a -> cgi ()
askOffline :: CGIMonad cgi => 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
tell :: (CGIMonad cgi, CGIOutput a) => a -> cgi ()
tellContinuously :: (CGIMonad cgi, CGIOutput a) => a -> cgi ()
rawTellContinuously :: CGIOutput a => a -> CGIAction ()
htell :: CGIMonad cgi => WithHTML x IO () -> cgi a
tellError :: String -> Element -> CGIAction a
reportError :: String -> WithHTML x IO () -> CGIState -> IO (a, CGIState)
backLink :: Monad m => HTMLCons x y m ()
hlink :: Monad m => URL -> HTMLCons x y m ()
frameTranslator :: CGIMonad cgi => ([String] -> cgi ()) -> [String] -> cgi ()
docTranslator :: [FreeForm] -> ([String] -> CGI ()) -> [String] -> CGI ()
lastTranslator :: [String] -> CGI ()
subVar :: String
Documentation
io :: (Read a, Show a) => IO a -> CGI aSource
Safe embedding of an IO action into the CGI monad. Intentionally not parameterized ver its monad to avoid its use inside of transactions.
feedback :: (CGIMonad cgi, Read a, Show a) => (a -> cgi a) -> a -> cgi aSource

Runs a CGI state transformer forever. Its specification is just

 feedback f x = f x >>= feedback f

However, feedback is more efficient because it avoids the buildup of long interaction logs by cutting back every time just before f is invoked. Unfortunately, it's useless due to typing restrictions.

callWithCurrentHistory :: (CGIMonad cgi, Read a, Show a) => ((a -> cgi ()) -> a -> cgi ()) -> a -> cgi ()Source

Control operator for the CGI monad. Its specification is

 callWithCurrentHistory (\backto x -> action x >>= backto) x
 ==
 action x >>= callWithCurrentHistory (\backto x -> action x >>= backto)

However, callWithCurrentHistory is more efficient because it avoids the buildup of long interaction logs by cutting back every time just before action gets executed.

once :: (CGIMonad cgi, Read a, Show a) => cgi a -> cgi aSource
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 :: CGIMonad cgi => cgi () -> cgi ()Source
Repeats a CGI action without saving its state so that the size of the interaction log remains constant.
onceAndThen :: (CGIMonad cgi, Read a, Show a) => a -> cgi a -> cgi aSource
Unsafe variant of once: returns the computed value only the first time and returns a default value in all later invocations. [deprecated]
unsafe_io :: IO a -> CGI aSource
Directly lifts the IO monad into the CGI monad. This is generally unsafe and should be avoided. Use io instead.
ask :: CGIMonad cgi => WithHTML x cgi a -> cgi ()Source
Takes a monadic value that constructs a HTML page and delivers this page to the browser. This page may contain forms and input widgets.
askResumptive :: CGIMonad cgi => WithHTML x cgi a -> cgi ()Source
Implementation of ask for the pure logged variant.
askContinuously :: CGIMonad cgi => WithHTML x cgi a -> cgi ()Source
Experimental implementation of continuous version.
askOffline :: CGIMonad cgi => WithHTML x cgi a -> (Element -> IO ()) -> cgi ()Source
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 ()Source

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 ()Source

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 ()Source
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 () -> CGIProgramSource
Transform a CGI action into a servlet suitable for running from Marlow's web server.
makeServletWithHook :: ([String] -> CGI ()) -> CGI () -> CGIProgramSource
Like makeServlet with additional CGI generator as in runWithHook.
tell :: (CGIMonad cgi, CGIOutput a) => a -> cgi ()Source
Terminates script by sending its argument to the browser.
tellContinuously :: (CGIMonad cgi, CGIOutput a) => a -> cgi ()Source
(experimental: continuous version) send argument to the browser.
rawTellContinuously :: CGIOutput a => a -> CGIAction ()Source
htell :: CGIMonad cgi => WithHTML x IO () -> cgi aSource
Terminate script by sending a HTML page constructed by monadic argument.
tellError :: String -> Element -> CGIAction aSource
reportError :: String -> WithHTML x IO () -> CGIState -> IO (a, CGIState)Source
backLink :: Monad m => HTMLCons x y m ()Source
Link to previous page in browser's history. Uses JavaScript.
hlink :: Monad m => URL -> HTMLCons x y m ()Source
Plain Hyperlink from an URL string.
frameTranslator :: CGIMonad cgi => ([String] -> cgi ()) -> [String] -> cgi ()Source
docTranslator :: [FreeForm] -> ([String] -> CGI ()) -> [String] -> CGI ()Source
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 ()Source
Terminates a sequence of translators.
subVar :: StringSource
Internal: name for the submission variable and form field
Produced by Haddock version 2.6.1