happstack-dlg-0.1: Cross-request user interactions for HappstackSource codeContentsIndex
Happstack.Server.Dialogs
Synopsis
data Dlg m a
type Page m = Int -> ServerPartT m Response
perform :: Monad m => ServerPartT m a -> Dlg m a
showPage :: Monad m => Page m -> ServerPartT m a -> Dlg m a
data DialogManager m
makeDialogManager :: NominalDiffTime -> IO (DialogManager m)
closeDialogManager :: DialogManager m -> IO ()
dialog :: MonadIO m => DialogManager m -> Dlg m () -> ServerPartT m Response
Documentation
data Dlg m a Source
A value of a Dlg type represents a dialog between the user and the application, after which the application builds a value of type a. The trivial case is that the value is already known. Alternatively, it may be that there is some action to be performed, or else that the user needs to be asked or told something.
show/hide Instances
type Page m = Int -> ServerPartT m ResponseSource
A value of Page type represents a way of rendering a page, given a unique ID that should be included in responses in order to reassociate the response with the current dialog.
perform :: Monad m => ServerPartT m a -> Dlg m aSource
showPage :: Monad m => Page m -> ServerPartT m a -> Dlg m aSource
Converts methods for rendering and parsing the result of a page into a Dlg step.
data DialogManager m Source
A DialogManager is responsible for maintaining the state for Dlg sequences for all users. To do this, it keeps for each user a session object encapsulating their dialogs, and associates each user with a dialog using cookies.
makeDialogManager :: NominalDiffTime -> IO (DialogManager m)Source
Create a new DialogManager to manage a set of dialogs in the web application. This also spawns the session reaper, which cleans up sessions that haven't been touched for a given time period.
closeDialogManager :: DialogManager m -> IO ()Source
Closes a DialogManager, which will cause it to cease accepting any incoming requests, and also to terminate the session reaper thread.
dialog :: MonadIO m => DialogManager m -> Dlg m () -> ServerPartT m ResponseSource
The dialog function builds a ServerPartT that handles a given dialog. In general, it can be combined in normal ways with guards and such, so long as changes in the request parameters won't cause it to be missed when future requests are made in the same dialog.
Produced by Haddock version 2.6.1