reroute 0.4.0.0 → 0.4.0.1
raw patch · 2 files changed
+21/−37 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- benchmarks/Benchmarks.hs +5/−22
- reroute.cabal +16/−15
benchmarks/Benchmarks.hs view
@@ -2,7 +2,7 @@ module Main where -import Web.Routing.TextRouting+import Web.Routing.Combinators import Web.Routing.SafeRouting import Criterion.Main@@ -10,25 +10,13 @@ import Data.List (permutations, foldl') import System.Random (mkStdGen, randomRs) import Data.Maybe (listToMaybe, fromMaybe)-import Data.Monoid (Monoid (..)) --buildRoutingTree :: [([T.Text], a)] -> RoutingTree a-buildRoutingTree =- foldl' (\t (route, val) -> addToRoutingTree (joinSegs route) val t)- emptyRoutingTree- where joinSegs = T.intercalate "/"--lookupRoutingTreeM :: [[T.Text]] -> RoutingTree Int -> Int-lookupRoutingTreeM routes tree =- foldl' (\z route -> maybe z snd (listToMaybe $ matchRoute' route tree)) 0 routes--buildPath :: [T.Text] -> Path '[]-buildPath = static . T.unpack . T.intercalate "/"+buildPath :: [T.Text] -> PathInternal '[]+buildPath = toInternalPath . static . T.unpack . T.intercalate "/" buildPathMap :: [([T.Text], a)] -> PathMap a buildPathMap =- foldl' (\t (route, val) -> insertPathMap' (buildPath route) (const val) t) mempty+ foldl' (\t (route, val) -> insertPathMap' (buildPath route) (const val) t) emptyPathMap lookupPathMapM :: [[T.Text]] -> PathMap Int -> Int lookupPathMapM rs m =@@ -36,11 +24,7 @@ benchmarks :: [Benchmark] benchmarks =- [ env setupTextMap $ \ ~(routingTree, routes') ->- bgroup "TextRouting"- [ bench "static-lookup" $ whnf (lookupRoutingTreeM routes') routingTree- ]- , env setupSafeMap $ \ ~(safeMap, routes') ->+ [ env setupSafeMap $ \ ~(safeMap, routes') -> bgroup "SafeRouting" [ bench "static-lookup" $ whnf (lookupPathMapM routes') safeMap ]@@ -51,7 +35,6 @@ num = 10 routes = rndRoutes strlen seglen num routesList = zip routes [1..]- setupTextMap = return (buildRoutingTree routesList, routes) setupSafeMap = return (buildPathMap routesList, routes) main :: IO ()
reroute.cabal view
@@ -1,5 +1,5 @@ name: reroute-version: 0.4.0.0+version: 0.4.0.1 synopsis: abstract implementation of typed and untyped web routing description: abstraction over how urls with/without parameters are mapped to their corresponding handlers homepage: http://github.com/agrafix/Spock@@ -17,10 +17,10 @@ library exposed-modules:- Data.PolyMap,- Web.Routing.Router,- Web.Routing.SafeRouting,- Web.Routing.Combinators+ Data.PolyMap,+ Web.Routing.Router,+ Web.Routing.SafeRouting,+ Web.Routing.Combinators build-depends: base >=4.6 && <5, deepseq >= 1.1.0.2,@@ -42,21 +42,21 @@ other-modules: Web.Routing.SafeRoutingSpec build-depends:- base,- hspec,- mtl,- reroute,- text,- unordered-containers,- vector,- hvect+ base,+ hspec,+ mtl,+ reroute,+ text,+ unordered-containers,+ vector,+ hvect default-language: Haskell2010 ghc-options: -Wall -fno-warn-orphans benchmark reroute-benchmarks type: exitcode-stdio-1.0 ghc-options: -Wall -O2- hs-source-dirs: src benchmarks+ hs-source-dirs: benchmarks default-language: Haskell2010 main-is: Benchmarks.hs build-depends:@@ -72,7 +72,8 @@ deepseq, path-pieces, graph-core,- hvect+ hvect,+ reroute source-repository head type: git