web-routes 0.23.2 → 0.23.4
raw patch · 3 files changed
+16/−7 lines, 3 filesdep ~parsecPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: parsec
API changes (from Hackage documentation)
Files
- Web/Routes/PathInfo.hs +12/−3
- Web/Routes/RouteT.hs +2/−2
- web-routes.cabal +2/−2
Web/Routes/PathInfo.hs view
@@ -5,11 +5,9 @@ import Control.Monad (msum) import Data.List (stripPrefix, tails) import Data.Maybe (fromJust)-import Text.ParserCombinators.Parsec.Prim ((<?>), GenParser, getInput, setInput, pzero) import Text.ParserCombinators.Parsec.Error (ParseError, errorPos, errorMessages, showErrorMessages) import Text.ParserCombinators.Parsec.Pos (incSourceLine, sourceName, sourceLine, sourceColumn)-import Text.ParserCombinators.Parsec.Prim (getPosition, token, parse, many)-+import Text.ParserCombinators.Parsec.Prim ((<?>), GenParser, getInput, setInput, pzero,getPosition, token, parse, many) import Web.Routes.Base (decodePathInfo, encodePathInfo) import Web.Routes.Site (Site(..)) @@ -23,12 +21,23 @@ pToken msg f = do pos <- getPosition token id (const $ incSourceLine pos 1) f +-- | match on a specific string segment :: String -> URLParser String segment x = (pToken (const x) (\y -> if x == y then Just x else Nothing)) <?> x +-- | match on any string anySegment :: URLParser String anySegment = pToken (const "any string") Just +-- | apply a function to the remainder of the segments+--+-- useful if you want to just do normal pattern matching:+-- >+-- > foo ["foo", "bar"] = Right (Foo Bar)+-- > foo ["baz"] = Right Baz+-- > foo _ = Left "parse error"+-- +-- > patternParse foo patternParse :: ([String] -> Either String a) -> URLParser a patternParse p = do segs <- getInput
Web/Routes/RouteT.hs view
@@ -69,7 +69,7 @@ class ShowURL m where type URL m- showURLParams :: (URL m) -> [(String, String)] -> m Link -- ^ convert a URL value into a Link (aka, a String)+ showURLParams :: (URL m) -> [(String, String)] -> m Link -- ^ convert a URL value and a parameter list into a Link (aka, a String) instance (Monad m) => ShowURL (RouteT url m) where type URL (RouteT url m) = url@@ -77,7 +77,7 @@ do showF <- askRouteT return (showF url params) --- | convert a URL value into a Link (aka, a String)+-- | convert a URL value into a Link (aka, a String) using a null parameter list. showURL :: ShowURL m => URL m -> m Link showURL url = showURLParams url []
web-routes.cabal view
@@ -1,5 +1,5 @@ Name: web-routes-Version: 0.23.2+Version: 0.23.4 License: BSD3 License-File: LICENSE Author: jeremy@seereason.com@@ -13,7 +13,7 @@ Library Build-Depends: base >= 4 && < 5,- parsec >= 2 && <3,+ parsec >= 2 && <4, bytestring >= 0.9 && < 0.10, network >= 2.2 && < 2.4, utf8-string >= 0.3 && < 0.4