| Copyright | (c) digitally induced GmbH 2020 |
|---|---|
| Safe Haskell | None |
| Language | GHC2021 |
IHP.Controller.Context
Contents
Description
Re-exports from ihp-context and adds IHP-specific HasField instances for accessing the WAI Request and FrameworkConfig.
Synopsis
- data ControllerContext
- = ControllerContext {
- customFieldsRef :: IORef TMap
- | FrozenControllerContext {
- customFields :: TMap
- = ControllerContext {
- newControllerContext :: (?request :: Request) => IO ControllerContext
- freeze :: ControllerContext -> IO ControllerContext
- unfreeze :: ControllerContext -> IO ControllerContext
- putContext :: (?context :: ControllerContext, Typeable value) => value -> IO ()
- fromContext :: (?context :: ControllerContext, Typeable value) => IO value
- maybeFromContext :: (?context :: ControllerContext, Typeable value) => IO (Maybe value)
- fromFrozenContext :: (?context :: ControllerContext, Typeable value) => value
- maybeFromFrozenContext :: (?context :: ControllerContext, Typeable value) => Maybe value
- newtype ActionType = ActionType TypeRep
Documentation
data ControllerContext #
Constructors
| ControllerContext | |
Fields
| |
| FrozenControllerContext | |
Fields
| |
Instances
| HasField "frameworkConfig" ControllerContext FrameworkConfig Source # | Access frameworkConfig via the request vault |
Defined in IHP.Controller.Context Methods | |
| HasField "logger" ControllerContext Logger Source # | |
Defined in IHP.Controller.Context Methods getField :: ControllerContext -> Logger # | |
| HasField "request" ControllerContext Request Source # | Access request from the TMap This allows |
Defined in IHP.Controller.Context Methods getField :: ControllerContext -> Request # | |
newControllerContext :: (?request :: Request) => IO ControllerContext Source #
Creates a new controller context with the WAI Request stored in the TMap
This version stores the Request in the TMap so it can be retrieved via the HasField instance.
putContext :: (?context :: ControllerContext, Typeable value) => value -> IO () #
fromContext :: (?context :: ControllerContext, Typeable value) => IO value #
maybeFromContext :: (?context :: ControllerContext, Typeable value) => IO (Maybe value) #
fromFrozenContext :: (?context :: ControllerContext, Typeable value) => value #
maybeFromFrozenContext :: (?context :: ControllerContext, Typeable value) => Maybe value #
newtype ActionType Source #
Used to track the current action type
Constructors
| ActionType TypeRep |
Instances
| HasField "actionType" Request ActionType Source # | |
Defined in IHP.ActionType Methods getField :: Request -> ActionType # | |
Orphan instances
| HasField "frameworkConfig" ControllerContext FrameworkConfig Source # | Access frameworkConfig via the request vault |
Methods | |
| HasField "logger" ControllerContext Logger Source # | |
Methods getField :: ControllerContext -> Logger # | |
| HasField "request" ControllerContext Request Source # | Access request from the TMap This allows |
Methods getField :: ControllerContext -> Request # | |