web-routes-0.25.2: Library for maintaining correctness and composability of URLs within an application.

Web.Routes.PathInfo

Synopsis

Documentation

stripOverlap :: Eq a => [a] -> [a] -> [a]Source

pToken :: tok -> (String -> Maybe a) -> URLParser aSource

segment :: String -> URLParser StringSource

match on a specific string

anySegment :: URLParser StringSource

match on any string

parseSegments :: URLParser a -> [String] -> Either String aSource

run a URLParser on a list of path segments

returns Left parse error on failure.

returns Right a on success

toPathInfo :: PathInfo url => url -> StringSource

convert url into the path info portion of a URL

toPathInfoParamsSource

Arguments

:: PathInfo url 
=> url

url

-> [(String, String)]

query string parameter

-> String 

convert url + params into the path info portion of a URL + a query string

fromPathInfo :: PathInfo url => String -> Either String urlSource

parse a String into url using PathInfo.

returns Left parse error on failure

returns Right url on success

mkSitePISource

Arguments

:: PathInfo url 
=> ((url -> [(String, String)] -> String) -> url -> a)

a routing function

-> Site url a 

turn a routing function into a Site value using the PathInfo class

showParseError :: ParseError -> StringSource

show Parsec ParseError using terms that relevant to parsing a url