Wheb-0.3.0.0: The frictionless WAI Framework

Safe HaskellNone
LanguageHaskell2010

Web.Wheb.Types

Contents

Synopsis

Documentation

newtype WhebT g s m a Source

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

Constructors

WhebT 

Fields

runWhebT :: ExceptT WhebError (ReaderT (HandlerData g s m) (StateT (InternalState s) m)) a
 

Instances

Monad m => MonadError WhebError (WhebT g s m) 
MonadTrans (WhebT g s) 
Monad m => Monad (WhebT g s m) 
Functor m => Functor (WhebT g s m) 
(Monad m, Functor m) => Applicative (WhebT g s m) 
MonadIO m => MonadIO (WhebT g s m) 

newtype InitM g s m a Source

Writer Monad to build options.

Constructors

InitM 

Fields

runInitM :: WriterT (InitOptions g s m) IO a
 

Instances

Monad (InitM g s m) 
Functor (InitM g s m) 
Applicative (InitM g s m) 
MonadIO (InitM g s m) 

class WhebContent a where Source

Converts a type to a WAI Response

Methods

toResponse :: Status -> ResponseHeaders -> a -> Response Source

Instances

data WhebFile Source

A Wheb response that represents a file.

Constructors

WhebFile Text 

data HandlerResponse Source

Constructors

forall a . WhebContent a => HandlerResponse Status a 

data HandlerData g s m Source

Our ReaderT portion of WhebT uses this.

Constructors

HandlerData 

Fields

globalCtx :: g
 
request :: Request
 
postData :: ([Param], [File LBS.ByteString])
 
routeParams :: RouteParamList
 
globalSettings :: WhebOptions g s m
 

data InternalState s Source

Our StateT portion of WhebT uses this.

Constructors

InternalState 

Fields

reqState :: s
 
respHeaders :: Map HeaderName ByteString
 
curCookies :: CookiesText
 

data SettingsValue Source

Constructors

forall a . Typeable a => MkVal a 

data WhebError Source

Instances

Show WhebError 
Monad m => MonadError WhebError (WhebT g s m) 

data InitOptions g s m Source

Monoid to use in InitM's WriterT

Constructors

InitOptions 

Fields

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 ()]
 

Instances

data WhebOptions g s m Source

The main option datatype for Wheb

Constructors

MonadIO m => WhebOptions 

Fields

appRoutes :: [Route g s m]
 
appWhebSockets :: [SocketRoute g s m]
 
appSites :: [PackedSite g s m]
 
runTimeSettings :: CSettings
 
warpSettings :: Settings
 
startingCtx :: g

Global ctx shared between requests

startingState :: InternalState s

Handler state given each request

waiStack :: Middleware
 
whebMiddlewares :: [WhebMiddleware g s m]
 
defaultErrorHandler :: WhebError -> WhebHandlerT g s m
 
shutdownTVar :: TVar Bool
 
activeConnections :: TVar Int
 
cleanupActions :: [IO ()]
 

type WhebSocket g s m = Connection -> WhebT g s m () Source

type MinWheb a = WhebT () () IO a Source

A minimal type for WhebT

type MinOpts = WhebOptions () () IO Source

A minimal type for WhebOptions

Routes

data PackedSite g s m Source

Constructors

forall a . PackedSite Text (Site a (WhebHandlerT g s m)) 

type MethodMatch = StdMethod -> Bool Source

data ParsedChunk Source

Constructors

forall a . (Typeable a, Show a) => MkChunk a 

Instances

data UrlParser Source

A Parser should be able to extract params and regenerate URL from params.

Constructors

UrlParser 

data Route g s m Source

data SocketRoute g s m Source

Constructors

SocketRoute 

data ChunkType Source

Constructors

IntChunk 
TextChunk 

Instances

data UrlPat Source

Constructors

Chunk Text 
Composed [UrlPat] 
FuncChunk