nested-routes 0.3.1 → 0.3.2
raw patch · 3 files changed
+10/−1 lines, 3 filesdep +regex-compatPVP ok
version bump matches the API change (PVP)
Dependencies added: regex-compat
API changes (from Hackage documentation)
+ Web.Routes.Nested.Types.UrlChunks: (:*) :: (Text, Regex) -> EitherUrlChunk (Just [String])
+ Web.Routes.Nested.Types.UrlChunks: r :: (Text, Regex) -> EitherUrlChunk (Just [String])
Files
- nested-routes.cabal +2/−1
- src/Web/Routes/Nested/Types.hs +3/−0
- src/Web/Routes/Nested/Types/UrlChunks.hs +5/−0
nested-routes.cabal view
@@ -1,5 +1,5 @@ Name: nested-routes-Version: 0.3.1+Version: 0.3.2 Author: Athan Clark <athan.clark@gmail.com> Maintainer: Athan Clark <athan.clark@gmail.com> License: BSD3@@ -133,6 +133,7 @@ , lucid , bytestring , attoparsec+ , regex-compat , pred-trie >= 0.1 , poly-arity >= 0.0.3
src/Web/Routes/Nested/Types.hs view
@@ -26,6 +26,7 @@ ) where import Data.Attoparsec.Text+import Text.Regex import Web.Routes.Nested.Types.UrlChunks import qualified Data.Text as T import Data.List.NonEmpty@@ -57,6 +58,7 @@ instance Extend (EitherUrlChunk ('Just r)) (RUPTrie T.Text (r -> a)) (RUPTrie T.Text a) where extend ((:~) (t,q)) (Rooted mx xs) = Rooted Nothing [UPred t (eitherToMaybe . parseOnly q) mx xs]+ extend ((:*) (t,q)) (Rooted mx xs) = Rooted Nothing [UPred t (matchRegex q . T.unpack) mx xs] class Extrude chunks start result | chunks start -> result where@@ -79,6 +81,7 @@ restAreLits (Cons ((:=) _) Root) = True restAreLits (Cons ((:=) _) us) = restAreLits us restAreLits (Cons _ _) = False+ class ToNE chunks where toNE :: chunks -> NonEmpty T.Text
src/Web/Routes/Nested/Types/UrlChunks.hs view
@@ -9,6 +9,7 @@ module Web.Routes.Nested.Types.UrlChunks where import Data.Attoparsec.Text+import Text.Regex import qualified Data.Text as T @@ -16,12 +17,16 @@ data EitherUrlChunk (x :: Maybe *) where (:=) :: T.Text -> EitherUrlChunk 'Nothing (:~) :: (T.Text, Parser r) -> EitherUrlChunk ('Just r)+ (:*) :: (T.Text, Regex) -> EitherUrlChunk ('Just [String]) l :: T.Text -> EitherUrlChunk 'Nothing l = (:=) p :: (T.Text, Parser r) -> EitherUrlChunk ('Just r) p = (:~)++r :: (T.Text, Regex) -> EitherUrlChunk ('Just [String])+r = (:*) -- | Container when defining route paths data UrlChunks (xs :: [Maybe *]) where