wai-transformers-0.0.4: 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

Types

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

Isomorphic to Kleisli (ContT ResponseReceived m) Request Response

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

Exception catching

catchApplicationT :: (MonadCatch m, Exception e) => ApplicationT m -> (e -> ApplicationT m) -> ApplicationT m Source

catchMiddlewareT :: (MonadIO m, MonadCatch m, Exception e) => MiddlewareT m -> (e -> MiddlewareT m) -> MiddlewareT m Source