Safe Haskell | None |
---|---|
Language | Haskell2010 |
- newtype WhebT g s m a = WhebT {
- runWhebT :: ExceptT WhebError (ReaderT (HandlerData g s m) (StateT (InternalState s) m)) a
- newtype InitM g s m a = InitM {
- runInitM :: WriterT (InitOptions g s m) IO a
- class WhebContent a where
- toResponse :: Status -> ResponseHeaders -> a -> Response
- data WhebFile = WhebFile Text
- data HandlerResponse = forall a . WhebContent a => HandlerResponse Status a
- data HandlerData g s m = HandlerData {
- globalCtx :: g
- request :: Request
- postData :: ([Param], [File LBS.ByteString])
- routeParams :: RouteParamList
- globalSettings :: WhebOptions g s m
- data InternalState s = InternalState {
- reqState :: s
- respHeaders :: Map HeaderName ByteString
- curCookies :: CookiesText
- data SettingsValue = forall a . Typeable a => MkVal a
- data WhebError
- = Error500 Text
- | Error404
- | Error403
- | ErrorStatus Status Text
- | RouteParamDoesNotExist
- | URLError Text UrlBuildError
- data InitOptions g s m = InitOptions {
- initRoutes :: [Route g s m]
- initWhebSockets :: [SocketRoute g s m]
- initSites :: [PackedSite g s m]
- initSettings :: CSettings
- initWaiMw :: Middleware
- initWhebMw :: [WhebMiddleware g s m]
- initCleanup :: [IO ()]
- data WhebOptions g s m = MonadIO m => WhebOptions {
- appRoutes :: [Route g s m]
- appWhebSockets :: [SocketRoute g s m]
- appSites :: [PackedSite g s m]
- runTimeSettings :: CSettings
- warpSettings :: Settings
- startingCtx :: g
- startingState :: InternalState s
- waiStack :: Middleware
- whebMiddlewares :: [WhebMiddleware g s m]
- defaultErrorHandler :: WhebError -> WhebHandlerT g s m
- shutdownTVar :: TVar Bool
- activeConnections :: TVar Int
- cleanupActions :: [IO ()]
- type EResponse = Either WhebError Response
- type CSettings = Map Text SettingsValue
- type WhebHandler g s = WhebT g s IO HandlerResponse
- type WhebHandlerT g s m = WhebT g s m HandlerResponse
- type WhebMiddleware g s m = WhebT g s m (Maybe HandlerResponse)
- type WhebSocket g s m = Connection -> WhebT g s m ()
- type MinWheb a = WhebT () () IO a
- type MinHandler = MinWheb HandlerResponse
- type MinOpts = WhebOptions () () IO
- data PackedSite g s m = forall a . PackedSite Text (Site a (WhebHandlerT g s m))
- type RouteParamList = [(Text, ParsedChunk)]
- type MethodMatch = StdMethod -> Bool
- data ParsedChunk = forall a . (Typeable a, Show a) => MkChunk a
- data UrlBuildError
- = NoParam
- | ParamTypeMismatch Text
- | UrlNameNotFound
- data UrlParser = UrlParser {
- parseFunc :: [Text] -> Maybe RouteParamList
- genFunc :: RouteParamList -> Either UrlBuildError Text
- data Route g s m = Route {
- routeName :: Maybe Text
- routeMethod :: MethodMatch
- routeParser :: UrlParser
- routeHandler :: WhebHandlerT g s m
- data SocketRoute g s m = SocketRoute {
- srouteParser :: UrlParser
- srouteHandler :: WhebSocket g s m
- data ChunkType
- data UrlPat
- = Chunk Text
- | Composed [UrlPat]
- | FuncChunk {
- chunkParamName :: Text
- chunkFunc :: Text -> Maybe ParsedChunk
- chunkType :: ChunkType
Documentation
WhebT g s m
- g -> The global confirgured context (Read-only data shared between threads)
- s -> Handler state for each request.
- m -> Monad we are transforming
WhebT | |
|
Writer Monad to build options.
InitM | |
|
class WhebContent a where Source
Converts a type to a WAI Response
toResponse :: Status -> ResponseHeaders -> a -> Response Source
WhebContent Text | |
WhebContent Builder | |
WhebContent WhebFile |
data HandlerResponse Source
forall a . WhebContent a => HandlerResponse Status a |
data HandlerData g s m Source
Our ReaderT
portion of WhebT
uses this.
HandlerData | |
|
data InternalState s Source
Our StateT
portion of WhebT
uses this.
InternalState | |
|
data SettingsValue Source
Error500 Text | |
Error404 | |
Error403 | |
ErrorStatus Status Text | |
RouteParamDoesNotExist | |
URLError Text UrlBuildError |
data InitOptions g s m Source
Monoid to use in InitM's WriterT
InitOptions | |
|
Monoid (InitOptions g s m) |
data WhebOptions g s m Source
The main option datatype for Wheb
MonadIO m => WhebOptions | |
|
type CSettings = Map Text SettingsValue Source
type WhebHandler g s = WhebT g s IO HandlerResponse Source
type WhebHandlerT g s m = WhebT g s m HandlerResponse Source
type WhebMiddleware g s m = WhebT g s m (Maybe HandlerResponse) Source
type WhebSocket g s m = Connection -> WhebT g s m () Source
type MinHandler = MinWheb HandlerResponse Source
type MinOpts = WhebOptions () () IO Source
A minimal type for WhebOptions
Routes
data PackedSite g s m Source
forall a . PackedSite Text (Site a (WhebHandlerT g s m)) |
type RouteParamList = [(Text, ParsedChunk)] Source
type MethodMatch = StdMethod -> Bool Source
A Parser should be able to extract params and regenerate URL from params.
UrlParser | |
|
Route | |
|
data SocketRoute g s m Source
SocketRoute | |
|