|
|
|
|
|
| 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 types
|
|
| data Controller s r a |
| Controller itself
| Instances | |
|
|
| 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 a | Controller
| | -> s | Configuration for controller
| | -> IO (Maybe a) | | | Evaluate controller with given configuration
|
|
|
| Produced by Haddock version 2.4.2 |