wai-transformers-0.0.6: Simple parameterization of Wai's Application type

Copyright(c) 2015 Athan Clark
LicenseBSD-style
Maintainerathan.clark@gmail.com
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

Network.Wai.Trans

Contents

Description

Simple utilities for embedding a monad transformer stack in an Application or Middleware - with MiddlewareT, your transformer stack is shared across all attached middlewares until run. You can also lift existing Middleware to MiddlewareT, given some extraction function.

Synopsis

WAI

Types

type ApplicationT m = Request -> (Response -> m ResponseReceived) -> m ResponseReceived Source #

Isomorphic to Kleisli (ContT ResponseReceived m) Request Response

Embedding

liftApplication :: MonadIO m => (forall a. m a -> IO a) -> Application -> ApplicationT m Source #

liftMiddleware :: MonadIO m => (forall a. m a -> IO a) -> Middleware -> MiddlewareT m Source #

runApplicationT :: MonadIO m => (forall a. m a -> IO a) -> ApplicationT m -> Application Source #

runMiddlewareT :: MonadIO m => (forall a. m a -> IO a) -> MiddlewareT m -> Middleware Source #

hoistApplicationT :: (Monad m, Monad n) => (forall a. m a -> n a) -> (forall a. n a -> m a) -> ApplicationT m -> ApplicationT n Source #

hoistMiddlewareT :: (Monad m, Monad n) => (forall a. m a -> n a) -> (forall a. n a -> m a) -> MiddlewareT m -> MiddlewareT n Source #

Exception catching

General Purpose

Websockets

websocketsOrT :: MonadIO m => (forall a. m a -> IO a) -> ConnectionOptions -> ServerAppT m -> MiddlewareT m Source #

Respond with the WebSocket server when applicable, as a middleware