web-routing 0.3.0 → 0.4.0
raw patch · 4 files changed
+14/−8 lines, 4 files
Files
- src/Network/Routing.hs +1/−1
- src/Network/Routing/Dict.hs +3/−1
- src/Network/Routing/Dict/Internal.hs +9/−5
- web-routing.cabal +1/−1
src/Network/Routing.hs view
@@ -248,7 +248,7 @@ -- | execute router execute :: MonadPlus m => Router '[] m a -> Method -> [T.Text] -> m a-execute = execute' D.empty+execute = execute' D.emptyStore execute' :: MonadPlus m => D.Store d -> Router d m a -> Method -> [T.Text] -> m a execute' d Router{params, methods, anyMethod} m [] = fetching d m [] params `mplus`
src/Network/Routing/Dict.hs view
@@ -6,12 +6,14 @@ module Network.Routing.Dict ( -- * store Store- , empty+ , emptyStore , type (</) , add+ , mkDict -- * dictionary , Dict+ , emptyDict , Member , get
src/Network/Routing/Dict/Internal.hs view
@@ -17,7 +17,8 @@ ( Dict, Store , ShowDict , KV(..)- , empty+ , emptyStore+ , emptyDict , type (</) , add , Member@@ -51,9 +52,12 @@ (intercalate ", " . map (\(k, v, t) -> k ++ " = " ++ v ++ " :: " ++ show t) $ showDict 0 (mkDict d)) ++ "}" -empty :: Store '[]-empty = Empty+emptyStore :: Store '[]+emptyStore = Empty +emptyDict :: Dict '[]+emptyDict = mkDict Empty+ size :: Store kvs -> Int size Empty = 0 size (Cons l _ _) = l@@ -78,7 +82,7 @@ -- | O(1) add key value pair to dictionary. ----- >>> let a = add (Proxy :: Proxy "foo") (12 :: Int) empty+-- >>> let a = add (Proxy :: Proxy "foo") (12 :: Int) emptyStore -- >>> a -- Store {foo = 12 :: Int} --@@ -130,7 +134,7 @@ -- | O(1) (>= ghc-7.8), O(n) (< ghc-7.8) get key from dictionary ----- >>> let d = mkDict $ add (Proxy :: Proxy "foo") 12 $ add (Proxy :: Proxy "bar") "baz" empty+-- >>> let d = mkDict $ add (Proxy :: Proxy "foo") 12 $ add (Proxy :: Proxy "bar") "baz" emptyStore -- >>> get (Proxy :: Proxy "foo") d -- 12 -- >>> get (Proxy :: Proxy "bar") d
web-routing.cabal view
@@ -1,5 +1,5 @@ name: web-routing-version: 0.3.0+version: 0.4.0 synopsis: simple routing library -- description: license: MIT