happstack-dlg-0.1.2: Cross-request user interactions for HappstackSource codeContentsIndex
Happstack.Server.Dialogues
Synopsis
data Dlg m a
type Page m = String -> ServerPartT m Response
perform :: Monad m => ServerPartT m a -> Dlg m a
showPage :: Monad m => Page m -> ServerPartT m a -> Dlg m a
data DialogueManager m
makeDialogueManager :: NominalDiffTime -> IO (DialogueManager m)
closeDialogueManager :: DialogueManager m -> IO ()
dialogue :: MonadIO m => DialogueManager m -> Dlg m () -> ServerPartT m Response
Documentation
data Dlg m a Source
A value of a Dlg type represents a dialogue 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 = String -> ServerPartT m ResponseSource
A value of Page type represents a way of rendering a page, given a request URI that should be used for subsequent requests in order to reassociate them with the current dialogue.
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 DialogueManager m Source
A DialogueManager 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 dialogues, and associates each user with their session using cookies.
makeDialogueManager :: NominalDiffTime -> IO (DialogueManager m)Source
Create a new DialogueManager to manage a set of dialogues in the web application. This also spawns the session reaper, which cleans up sessions that haven't been touched for a given time period.
closeDialogueManager :: DialogueManager m -> IO ()Source
Closes a DialogueManager, which will cause it to cease accepting any incoming requests, and also to terminate the session reaper thread.
dialogue :: MonadIO m => DialogueManager m -> Dlg m () -> ServerPartT m ResponseSource
The dialogue function builds a ServerPartT that handles a given dialogue. 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 dialogue.
Produced by Haddock version 2.6.0