wai-transformers-0.1.0

Copyright(c) 2015 2016 2017 2018 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

Documentation

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

Isomorphic to Kleisli (ContT ResponseReceived m) Request Response

Lift and Run

liftMiddleware Source #

Arguments

:: MonadBaseControl IO m stM 
=> Extractable stM 
=> Middleware

To lift

-> MiddlewareT m 

runApplicationT Source #

Arguments

:: MonadBaseControl IO m stM 
=> Extractable stM 
=> ApplicationT m

To run

-> m Application 

runMiddlewareT Source #

Arguments

:: MonadBaseControl IO m stM 
=> Extractable stM 
=> MiddlewareT m

To run

-> m Middleware 

Monad Morphisms

hoistApplicationT Source #

Arguments

:: Monad m 
=> Monad n 
=> (forall a. m a -> n a)

To

-> (forall a. n a -> m a)

From

-> ApplicationT m 
-> ApplicationT n 

hoistMiddlewareT Source #

Arguments

:: Monad m 
=> Monad n 
=> (forall a. m a -> n a)

To

-> (forall a. n a -> m a)

From

-> MiddlewareT m 
-> MiddlewareT n 

Exception Catching

catchApplicationT Source #

Arguments

:: MonadCatch m 
=> Exception e 
=> ApplicationT m 
-> (e -> ApplicationT m)

Handler

-> ApplicationT m 

catchMiddlewareT Source #

Arguments

:: MonadCatch m 
=> Exception e 
=> MiddlewareT m 
-> (e -> MiddlewareT m)

Handler

-> MiddlewareT m