ContentsIndex
Framework.Controller
Contents
Data types
Controller-monad specific functions
Description

Controller is a monad, superset of IO. All application controllers are executed in this monad. Controller type has three type parameters. First is type of configuration for controller (usually it will be ActionConfig or StaticConfig). Second and third are types of possible results of controller.

There are three possible ways to combine Controller actions. First, you can execute actions one by one, just as in IO monad. Secondly, if you decide that you already have a result, you can return that result with returnNow function -- all subsequent computations will not be executed. Third, you can at any moment reject all the computation (in application controller, this will mean `I do not want process this URL!').

Synopsis
data Controller s r a
type AController a = Controller ActionConfig HttpResponse a
type HttpController = Controller ActionConfig HttpResponse HttpResponse
type StaticController = Controller StaticConfig HttpResponse HttpResponse
type ContextProcessor = Controller ActionConfig Context Context
type RequestExcHandler = HttpRequest -> Int -> String -> Controller StaticConfig HttpResponse ()
type ControllerExcHandler = HttpRequest -> Int -> String -> AController ()
MonadIO
returnNow :: r -> Controller s r a
reject :: Controller s r a
concatC :: [Controller b [a] [a]] -> Controller b r [a]
changeR :: Controller s r a -> Controller s q a
changeS :: (s -> s1) -> Controller s1 r a -> Controller s r a
assertC :: Bool -> Controller s r ()
evalController :: Controller s a a -> s -> IO (Maybe a)
Data types
data Controller s r a
Controller itself
show/hide Instances
MonadReader s (Controller s r)
MonadState s (Controller s r)
Monad (Controller s r)
MonadIO (Controller s r)
type AController a = Controller ActionConfig HttpResponse a
Most common type of controllers
type HttpController = Controller ActionConfig HttpResponse HttpResponse
Type of application-level controllers
type StaticController = Controller StaticConfig HttpResponse HttpResponse
Type of application-level controllers, that use StaticConfig
type ContextProcessor = Controller ActionConfig Context Context
type RequestExcHandler = HttpRequest -> Int -> String -> Controller StaticConfig HttpResponse ()
type ControllerExcHandler = HttpRequest -> Int -> String -> AController ()
Controller-monad specific functions
MonadIO
returnNow :: r -> Controller s r a
Return given value and do not evaluate following computations
reject :: Controller s r a
Reject this computation
concatC
::
=> [Controller b [a] [a]]List of controllers
-> Controller b r [a]
Run all controllers in list in given environment, and concatenate results
changeR :: Controller s r a -> Controller s q a
Run a controller, but reject if it returns RightNow t.
changeS :: (s -> s1) -> Controller s1 r a -> Controller s r a
Run a controller in changed environment
assertC :: Bool -> Controller s r ()
Assert that condition is satisfied. Otherwise, reject URL.
evalController
::
=> Controller s a aController
-> sConfiguration for controller
-> IO (Maybe a)
Evaluate controller with given configuration
Produced by Haddock version 2.4.2