Safe Haskell | None |
---|---|
Language | Haskell2010 |
- (</>) :: UrlPat -> UrlPat -> UrlPat
- grabInt :: Text -> UrlPat
- grabText :: Text -> UrlPat
- pT :: Text -> UrlPat
- pS :: String -> UrlPat
- patRoute :: Maybe Text -> StdMethod -> UrlPat -> WhebHandlerT g s m -> Route g s m
- compilePat :: UrlPat -> UrlParser
- rootPat :: UrlPat
- getParam :: Typeable a => Text -> RouteParamList -> Maybe a
- matchUrl :: [Text] -> UrlParser -> Maybe RouteParamList
- generateUrl :: UrlParser -> RouteParamList -> Either UrlBuildError Text
- findUrlMatch :: StdMethod -> [Text] -> [Route g s m] -> Maybe (WhebHandlerT g s m, RouteParamList)
- findSocketMatch :: [Text] -> [SocketRoute g s m] -> Maybe (WhebSocket g s m, RouteParamList)
- findSiteMatch :: [PackedSite g s m] -> [Text] -> Maybe (WhebHandlerT g s m)
- testUrlParser :: UrlParser -> RouteParamList -> Bool
URL building
(</>) :: UrlPat -> UrlPat -> UrlPat Source
Allows for easier building of URL patterns This should be the primary URL constructor.
(\"blog\" '</>' ('grabInt' \"pk\") '</>' \"edit\" '</>' ('grabText' \"verb\"))
Convenience constructors
URL Patterns
Working with URLs
getParam :: Typeable a => Text -> RouteParamList -> Maybe a Source
Lookup and cast a URL parameter to its expected type if it exists.
generateUrl :: UrlParser -> RouteParamList -> Either UrlBuildError Text Source
Runs a UrlParser
with RouteParamList
to a URL path
findUrlMatch :: StdMethod -> [Text] -> [Route g s m] -> Maybe (WhebHandlerT g s m, RouteParamList) Source
Sort through a list of routes to find a Handler and RouteParamList
findSocketMatch :: [Text] -> [SocketRoute g s m] -> Maybe (WhebSocket g s m, RouteParamList) Source
Sort through socket routes to find a match
findSiteMatch :: [PackedSite g s m] -> [Text] -> Maybe (WhebHandlerT g s m) Source
Utilities
testUrlParser :: UrlParser -> RouteParamList -> Bool Source
Test a parser to make sure it can match what it produces and vice versa