packages feed

webcrank-dispatch 0.1 → 0.2

raw patch · 4 files changed

+49/−38 lines, 4 filesdep +hvectdep −bytestringdep ~reroute

Dependencies added: hvect

Dependencies removed: bytestring

Dependency ranges changed: reroute

Files

.travis.yml view
@@ -1,33 +1,45 @@+# From https://github.com/hvr/multi-ghc-travis++# NB: don't set `language: haskell` here++# The following enables several GHC versions to be tested; often it's enough to test only against the last release in a major GHC version. Feel free to omit lines listings versions you don't need/want testing for. env:- - GHCVER=7.6.1- - GHCVER=7.6.2- - GHCVER=7.6.3- - GHCVER=7.8.3- - GHCVER=7.8.4+ - CABALVER=1.18 GHCVER=7.6.3+ - CABALVER=1.18 GHCVER=7.8.3+ - CABALVER=1.22 GHCVER=7.10.1+ - CABALVER=head GHCVER=head   # see section about GHC HEAD snapshots +matrix:+  allow_failures:+   - env: CABALVER=head GHCVER=head++# Note: the distinction between `before_install` and `install` is not important. before_install:- - sudo add-apt-repository -y ppa:hvr/ghc- - sudo apt-get update- - sudo apt-get install cabal-install-1.18 ghc-$GHCVER happy- - export PATH=/opt/ghc/$GHCVER/bin:$PATH+ - travis_retry sudo add-apt-repository -y ppa:hvr/ghc+ - travis_retry sudo apt-get update+ - travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER # see note about happy/alex+ - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH  install:- - cabal-1.18 update- - cabal-1.18 install --only-dependencies --enable-tests --enable-benchmarks+ - cabal --version+ - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"+ - travis_retry cabal update+ - cabal install --only-dependencies --enable-tests --enable-benchmarks  # Here starts the actual work to be performed for the package under test; any command which exits with a non-zero exit code causes the build to fail. script:- - cabal-1.18 configure --enable-tests --enable-benchmarks -v2  # -v2 provides useful information for debugging- - cabal-1.18 build   # this builds all libraries and executables (including tests/benchmarks)- - cabal-1.18 test- - cabal-1.18 check- - cabal-1.18 sdist   # tests that a source-distribution can be generated+ - if [ -f configure.ac ]; then autoreconf -i; fi+ - cabal configure --enable-tests --enable-benchmarks -v2  # -v2 provides useful information for debugging+ - cabal build   # this builds all libraries and executables (including tests/benchmarks)+ - cabal test+ - cabal check+ - cabal sdist   # tests that a source-distribution can be generated  # The following scriptlet checks that the resulting source distribution can be built & installed- - export SRC_TGZ=$(cabal-1.18 info . | awk '{print $2 ".tar.gz";exit}') ;+ - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ;    cd dist/;    if [ -f "$SRC_TGZ" ]; then-      cabal-1.18 install "$SRC_TGZ";+      cabal install --force-reinstalls "$SRC_TGZ";    else       echo "expected '$SRC_TGZ' not found";       exit 1;
README.md view
@@ -1,4 +1,4 @@-[Travis](https://travis-ci.org/webcrank/webcrank-dispatch.hs) [![Build Status](https://travis-ci.org/webcrank/webcrank-dispatch.hs.png)](https://travis-ci.org/webcrank/webcrank-dispatch.hs)+# Webcrank Dispatch [![TravisCI](https://travis-ci.org/webcrank/webcrank-dispatch.hs.svg)](https://travis-ci.org/webcrank/webcrank-dispatch.hs) [![Hackage](https://img.shields.io/hackage/v/webcrank-dispatch.svg?style=flat)](https://hackage.haskell.org/package/webcrank-dispatch) [![Dependencies](https://img.shields.io/hackage-deps/v/webcrank-dispatch.svg?style=flat)](http://packdeps.haskellers.com/feed?needle=webcrank-dispatch)  A type-safe request dispatcher and path renderer. @@ -10,8 +10,8 @@ import Webcrank.Dispatch ``` -# Paths-## Building Paths+## Paths+### Building Paths  The simplest `Path` is `root`, which is equivalent to `/`. @@ -38,7 +38,7 @@  Path parameters can be of any type that have instances for `Typeable` and `PathPiece`. -## Rendering Paths+### Rendering Paths  `Path`s can be rendered using `renderPath` and `params`.@@ -60,7 +60,7 @@  Note in the last example that no encoding is done by @renderPath@. -# Dispatching+## Dispatching  An elementary `Dispatcher` can be built using `==>`. 
src/Webcrank/Dispatch.hs view
@@ -36,7 +36,7 @@  import Control.Monad.Identity import qualified Data.HashMap.Strict as HM-import Data.HVect+import Data.HVect as HV import Data.Maybe import Data.Monoid import Data.Text (Text)@@ -100,10 +100,10 @@   hBuild' :: HVect l -> r  instance (l' ~ ReverseLoop l '[]) => HBuild' l (HVect l') where-  hBuild' l = hVectReverse l+  hBuild' l = HV.reverse l  instance HBuild' (a ': l) r => HBuild' l (a -> r) where-  hBuild' l x = hBuild' (HCons x l)+  hBuild' l x = hBuild' (x :&: l)  -- | An elementary @'Dispatcher'@ can be built using @'==>'@. --@@ -157,7 +157,7 @@   rootPath = SafeRouterPath RR.Empty   defRoute (SafeRouterPath path) action (SafeRouterReg (a, cAll)) =     SafeRouterReg-      ( RR.insertPathMap' path (hVectUncurry $ RR.flipHVectElim action) a+      ( RR.insertPathMap' path (HV.uncurry $ RR.flipHVectElim action) a       , cAll       )   fallbackRoute routeDef (SafeRouterReg (a, cAll)) =@@ -165,8 +165,7 @@   matchRoute (SafeRouterReg (a, cAll)) pathPieces =     let matches = RR.match a pathPieces         matches' =-            if null matches+            if Prelude.null matches             then matches <> fmap (\f -> f pathPieces) cAll             else matches-    in zip (replicate (length matches') HM.empty) matches'-+    in zip (replicate (Prelude.length matches') HM.empty) matches'
webcrank-dispatch.cabal view
@@ -1,5 +1,5 @@-name: webcrank-dispatch-version: 0.1+name:               webcrank-dispatch+version:            0.2 license:            BSD3 license-file:       LICENSE author:             Richard Wallace <rwallace@thewallacepack.net>@@ -9,8 +9,8 @@ category:           Web homepage:           https://github.com/webcrank/webcrank-dispatch.hs bug-reports:        https://github.com/webcrank/webcrank-dispatch.hs/issues-build-type: Simple-cabal-version: >= 1.8+build-type:         Simple+cabal-version:      >= 1.8 description:        A simple request dispatcher.  extra-source-files:@@ -33,13 +33,13 @@    exposed-modules:     Webcrank.Dispatch +  ghc-options:         -Wall+   build-depends:       base                >= 4.6 && < 5-                     , bytestring          >= 0.10                      , mtl                 >= 2.0                      , path-pieces         >= 0.1-                     , reroute             >= 0.1+                     , hvect               >= 0.1+                     , reroute             >= 0.3                      , text                >= 0.11                      , unordered-containers >= 0.2--  ghc-options:         -Wall