packages feed

network-wai-router (empty) → 0.1.0.2

raw patch · 4 files changed

+68/−0 lines, 4 filesdep +basedep +waisetup-changed

Dependencies added: base, wai

Files

+ LICENSE view
@@ -0,0 +1,20 @@+Copyright (c) 2014 George Rogers++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be included+in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ Network/Wai/Router.hs view
@@ -0,0 +1,21 @@+module Network.Wai.Router where+import Control.Monad+import Network.Wai+import Control.Applicative++type Router = Request -> IO (Maybe Response)++runRouter :: Application -> Router -> Application+runRouter d r req = do+    maybe <$> (d req) <*> pure id <*> r req+    ++route :: [Router] -> Router+route rs req = do+    msum <$> mapM ($req) rs++respond :: Response -> IO (Maybe Response)+respond = return . return++pass :: IO (Maybe Response)+pass = return Nothing
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ network-wai-router.cabal view
@@ -0,0 +1,25 @@+-- Initial network-wai-router.cabal generated by cabal init.  For further +-- documentation, see http://haskell.org/cabal/users-guide/++name:                network-wai-router+version:             0.1.0.2+synopsis:            A routing library for wai+-- description:         +license:             MIT+license-file:        LICENSE+author:              George Rogers+maintainer:          grogers385@gmail.com+-- copyright:           +category:            Web+build-type:          Simple+-- extra-source-files:  +cabal-version:       >=1.10++library+  exposed-modules:     Network.Wai.Router+  -- other-modules:       +  -- other-extensions:    +  build-depends:       base >=4.6 && <4.7, wai >=2.1 && <2.2+  -- hs-source-dirs:      +  default-language:    Haskell2010+  ghc-options:         -Wall -O2