snap-core 0.8.0 → 0.8.0.1
raw patch · 3 files changed
+12/−10 lines, 3 files
Files
snap-core.cabal view
@@ -1,5 +1,5 @@ name: snap-core-version: 0.8.0+version: 0.8.0.1 synopsis: Snap: A Haskell Web Framework (core interfaces and types) description:
src/Snap/Internal/Routing.hs view
@@ -10,6 +10,8 @@ import Data.ByteString.Internal (c2w) import qualified Data.ByteString as B import Data.Monoid+import Data.HashMap.Strict (HashMap)+import qualified Data.HashMap.Strict as H import qualified Data.Map as Map ------------------------------------------------------------------------------@@ -42,7 +44,7 @@ -- captures the dir in a param | Capture ByteString (Route a m) (Route a m) -- match on a dir- | Dir (Map.Map ByteString (Route a m)) (Route a m)+ | Dir (HashMap ByteString (Route a m)) (Route a m) | NoRoute @@ -55,7 +57,7 @@ mappend l@(Action a) r = case r of (Action a') -> Action (a <|> a') (Capture p r' fb) -> Capture p r' (mappend fb l)- (Dir _ _) -> mappend (Dir Map.empty l) r+ (Dir _ _) -> mappend (Dir H.empty l) r NoRoute -> l -- Whenever we're unioning two Captures and their capture variables@@ -82,7 +84,7 @@ mappend l@(Dir rm fb) r = case r of (Action _) -> Dir rm (mappend fb r) (Capture _ _ _) -> Dir rm (mappend fb r)- (Dir rm' fb') -> Dir (Map.unionWith mappend rm rm') (mappend fb fb')+ (Dir rm' fb') -> Dir (H.unionWith mappend rm rm') (mappend fb fb') NoRoute -> l @@ -92,7 +94,7 @@ NoRoute -> 1 (Action _) -> 1 (Capture _ r' _) -> 1 + routeHeight r'- (Dir rm _) -> 1 + foldl max 1 (map routeHeight $ Map.elems rm)+ (Dir rm _) -> 1 + foldl max 1 (map routeHeight $ H.elems rm) {-# INLINE routeHeight #-} @@ -212,7 +214,7 @@ hier = filter (not . B.null) $ B.splitWith (== (c2w '/')) r f s rt = if B.head s == c2w ':' then Capture (B.tail s) rt NoRoute- else Dir (Map.fromList [(s, rt)]) NoRoute+ else Dir (H.fromList [(s, rt)]) NoRoute {-# INLINE pRoute #-} @@ -250,7 +252,7 @@ route' pre ctx [] params fb route' pre !ctx (cwd:rest) !params (Dir rtm fb) = do cwd' <- maybe pass return $ urlDecode cwd- case Map.lookup cwd' rtm of+ case H.lookup cwd' rtm of Just rt -> (route' pre (cwd:ctx) rest params rt) <|> (route' pre ctx (cwd:rest) params fb) Nothing -> route' pre ctx (cwd:rest) params fb
test/snap-core-testsuite.cabal view
@@ -48,9 +48,9 @@ parallel >= 3 && <4, pureMD5 == 2.1.*, regex-posix >= 0.94.4 && <0.96,- test-framework >= 0.4 && <0.6,- test-framework-hunit >= 0.2.5 && <0.3,- test-framework-quickcheck2 >= 0.2.6 && <0.3,+ test-framework >= 0.6 && <0.7,+ test-framework-hunit >= 0.2.7 && <0.3,+ test-framework-quickcheck2 >= 0.2.12.1 && <0.3, text >= 0.11 && <0.12, time, transformers,