Safe Haskell | None |
---|
- getApp :: Monad m => WhebT g s m g
- getWithApp :: Monad m => (g -> a) -> WhebT g s m a
- getReqState :: Monad m => WhebT g s m s
- putReqState :: Monad m => s -> WhebT g s m ()
- modifyReqState :: Monad m => (s -> s) -> WhebT g s m s
- modifyReqState' :: Monad m => (s -> s) -> WhebT g s m ()
- setHeader :: Monad m => Text -> Text -> WhebT g s m ()
- setRawHeader :: Monad m => Header -> WhebT g s m ()
- html :: Monad m => Text -> WhebHandlerT g s m
- text :: Monad m => Text -> WhebHandlerT g s m
- file :: Monad m => Text -> Text -> WhebHandlerT g s m
- getSetting :: Monad m => Text -> WhebT g s m (Maybe Text)
- getSetting' :: (Monad m, Typeable a) => Text -> WhebT g s m (Maybe a)
- getSettings :: Monad m => WhebT g s m CSettings
- getRouteParams :: Monad m => WhebT g s m RouteParamList
- getRouteParam :: (Typeable a, Monad m) => Text -> WhebT g s m (Maybe a)
- getRoute :: Monad m => Text -> RouteParamList -> WhebT g s m Text
- getRoute' :: Monad m => Text -> RouteParamList -> WhebT g s m (Either UrlBuildError Text)
- getRequest :: Monad m => WhebT g s m Request
- getRequestHeader :: Monad m => Text -> WhebT g s m (Maybe Text)
- getWithRequest :: Monad m => (Request -> a) -> WhebT g s m a
- getQueryParams :: Monad m => WhebT g s m Query
- getPOSTParam :: MonadIO m => Text -> WhebT g s m (Maybe Text)
- getPOSTParams :: MonadIO m => WhebT g s m [(Text, Text)]
- getRawPOST :: MonadIO m => WhebT g s m ([Param], [File ByteString])
- runWhebServer :: Default s => WhebOptions g s IO -> IO ()
- runWhebServerT :: Default s => (m EResponse -> IO EResponse) -> WhebOptions g s m -> IO ()
- debugHandler :: Default s => WhebOptions g s IO -> WhebT g s IO a -> IO (Either WhebError a)
- debugHandlerT :: Default s => WhebOptions g s m -> (m (Either WhebError a) -> IO (Either WhebError a)) -> Request -> WhebT g s m a -> IO (Either WhebError a)
ReaderT and StateT Functionality
ReaderT
getApp :: Monad m => WhebT g s m gSource
Get the g
in WhebT g s m g
. This is a read-only state so only
thread-safe resources such as DB connections should go in here.
getWithApp :: Monad m => (g -> a) -> WhebT g s m aSource
StateT
getReqState :: Monad m => WhebT g s m sSource
Get the s
in WhebT g s m g
. This is a read and writable state
so you can get and put information in your state. Each request gets its own
fresh state generated from Default
putReqState :: Monad m => s -> WhebT g s m ()Source
modifyReqState :: Monad m => (s -> s) -> WhebT g s m sSource
modifyReqState' :: Monad m => (s -> s) -> WhebT g s m ()Source
Responses
setRawHeader :: Monad m => Header -> WhebT g s m ()Source
Set a Strict ByteString header for the response
html :: Monad m => Text -> WhebHandlerT g s mSource
Return simple HTML from Text
text :: Monad m => Text -> WhebHandlerT g s mSource
Return simple Text
file :: Monad m => Text -> Text -> WhebHandlerT g s mSource
Give filepath and content type to serve a file from disk.
Settings
getSetting :: Monad m => Text -> WhebT g s m (Maybe Text)Source
Help prevent monomorphism errors for simple settings.
getSetting' :: (Monad m, Typeable a) => Text -> WhebT g s m (Maybe a)Source
Open up underlying support for polymorphic global settings
getSettings :: Monad m => WhebT g s m CSettingsSource
Get all settings.
Routes
getRouteParams :: Monad m => WhebT g s m RouteParamListSource
Get all route params.
getRouteParam :: (Typeable a, Monad m) => Text -> WhebT g s m (Maybe a)Source
Cast a route param into its type.
getRoute' :: Monad m => Text -> RouteParamList -> WhebT g s m (Either UrlBuildError Text)Source
Generate a route from a name and param list.
Request reading
getRequest :: Monad m => WhebT g s m RequestSource
Access the request
getWithRequest :: Monad m => (Request -> a) -> WhebT g s m aSource
getQueryParams :: Monad m => WhebT g s m QuerySource
Get params from URL (e.g. from '/foo/?q=4')
getPOSTParam :: MonadIO m => Text -> WhebT g s m (Maybe Text)Source
Maybe get one param if it exists.
getRawPOST :: MonadIO m => WhebT g s m ([Param], [File ByteString])Source
Get the raw parsed POST data including files.
Running Wheb
runWhebServer :: Default s => WhebOptions g s IO -> IO ()Source
Convenience wrapper for runWhebServerT
function in IO
runWhebServerT :: Default s => (m EResponse -> IO EResponse) -> WhebOptions g s m -> IO ()Source
Run a server with a function to run your inner Transformer to IO and generated options
debugHandler :: Default s => WhebOptions g s IO -> WhebT g s IO a -> IO (Either WhebError a)Source
Convenience wrapper for debugHandlerT
function in IO