wai-transformers (empty) → 0.0.1
raw patch · 3 files changed
+99/−0 lines, 3 filesdep +basedep +composition-extradep +transformers
Dependencies added: base, composition-extra, transformers, wai
Files
- LICENSE +30/−0
- src/Network/Wai/Trans.hs +44/−0
- wai-transformers.cabal +25/−0
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2015, Athan Clark++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Athan Clark nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ src/Network/Wai/Trans.hs view
@@ -0,0 +1,44 @@+{-# LANGUAGE+ FlexibleContexts+ , OverloadedStrings+ #-}++-- |+-- Module : Network.Wai.Trans+-- Copyright : (c) 2015 Athan Clark+-- License : BSD-style+-- Maintainer : athan.clark@gmail.com+-- Stability : experimental+-- Portability : GHC+--+-- 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.+++module Network.Wai.Trans+ ( module X+ , ApplicationT+ , MiddlewareT+ , liftApplication+ , liftMiddleware+ ) where+++import Network.Wai as X++import Data.Function.Syntax+import Control.Monad.IO.Class+++type ApplicationT m = Request -> (Response -> IO ResponseReceived) -> m ResponseReceived+type MiddlewareT m = ApplicationT m -> ApplicationT m+++liftApplication :: MonadIO m => Application -> ApplicationT m+liftApplication app = liftIO .* app++liftMiddleware :: MonadIO m => (ApplicationT m -> Application) -> Middleware -> MiddlewareT m+liftMiddleware runAppT mid app = liftApplication $ mid (runAppT app)+
+ wai-transformers.cabal view
@@ -0,0 +1,25 @@+Name: wai-transformers+Version: 0.0.1+Author: Athan Clark <athan.clark@gmail.com>+Maintainer: Athan Clark <athan.clark@gmail.com>+License: BSD3+License-File: LICENSE+Synopsis: Simple parameterization of Wai's Application type+-- Description:+Cabal-Version: >= 1.10+Build-Type: Simple+Category: Web++Library+ Default-Language: Haskell2010+ HS-Source-Dirs: src+ GHC-Options: -Wall+ Exposed-Modules: Network.Wai.Trans+ Build-Depends: base >= 4.6 && < 5+ , composition-extra >= 2.0.0+ , wai+ , transformers++Source-Repository head+ Type: git+ Location: https://github.com/athanclark/wai-transformers.git