wai-responsible (empty) → 0.0.0.0
raw patch · 4 files changed
+115/−0 lines, 4 filesdep +basedep +bytestringdep +http-typessetup-changed
Dependencies added: base, bytestring, http-types, wai
Files
- LICENSE +30/−0
- Setup.hs +2/−0
- src/Network/Wai/Responsible.hs +49/−0
- wai-responsible.cabal +34/−0
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2014, Peter Harpending++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 Peter Harpending 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.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ src/Network/Wai/Responsible.hs view
@@ -0,0 +1,49 @@+-- |+-- Module : Network.Wai.Responsible+-- Description : Typeclass for respons+-- Copyright : 2014, Peter Harpending.+-- License : BSD3+-- Maintainer : Peter Harpending <pharpend2@gmail.com>+-- Stability : experimental+-- Portability : archlinux+--++module Network.Wai.Responsible where++import qualified Data.ByteString as Bs+import qualified Data.ByteString.Lazy as Bl+import Network.Wai+import Network.HTTP.Types++-- |Things that generate a response+class Responsible a where+ respond :: a -> Request -> Response++-- |Things that generate a response, but need IO to do so+class Irresponsible a where+ respondIO :: a -> Request -> IO Response++-- |Given a content type, such as @"text/html"@, and a 'Bl.Bytestring'+-- response, send a response with status 200.+respond200 :: Bs.ByteString -> Bl.ByteString -> Response+respond200 contentType = responseLBS status200 [(hContentType, contentType)]++-- |Given a content type, such as @"text/html"@, and a 'Bl.Bytestring'+-- response, send a response with status 403.+respond403 :: Bs.ByteString -> Bl.ByteString -> Response+respond403 contentType = responseLBS status403 [(hContentType, contentType)]++-- |Given a content type, such as @"text/html"@, and a 'Bl.Bytestring'+-- response, send a response with status 404.+respond404 :: Bs.ByteString -> Bl.ByteString -> Response+respond404 contentType = responseLBS status404 [(hContentType, contentType)]++-- |Given a content type, such as @"text/html"@, and a 'Bl.Bytestring'+-- response, send a response with status 405.+respond405 :: Bs.ByteString -> Bl.ByteString -> Response+respond405 contentType = responseLBS status405 [(hContentType, contentType)]++-- |Error pages, +data ErrorPage = Status403+ | Status404+ | Status405
+ wai-responsible.cabal view
@@ -0,0 +1,34 @@+-- Initial wai-responsible.cabal generated by cabal init. For further +-- documentation, see http://haskell.org/cabal/users-guide/++name: wai-responsible+version: 0.0.0.0+synopsis: Response interface for WAI.+description: Simple interface for things that generate a WAI response.+homepage: https://github.com/pharpend/wai-responsible+license: BSD3+license-file: LICENSE+author: Peter Harpending+maintainer: Peter Harpending <pharpend2@gmail.com>+copyright: 2014, Peter Harpending.+category: Network+build-type: Simple+-- extra-source-files: +cabal-version: >=1.10++library+ -- other-modules: + -- other-extensions: + build-depends:+ base >=4.7 && <4.8+ , http-types >=0.8 && <0.9+ , bytestring >=0.10 && <0.11+ , wai >=3.0 && <3.1+ hs-source-dirs: src/+ default-language: Haskell2010+ exposed-modules: + Network.Wai.Responsible++source-repository head+ type: git+ location: https://github.com/pharpend/wai-responsible.git