Portability | non-portable (uses ghc extensions) |
---|---|
Stability | experimental |
Maintainer | ajnsit@gmail.com |
Safe Haskell | None |
This package provides typesafe URLs for Wai applications.
- parseRoutes :: QuasiQuoter
- parseRoutesFile :: FilePath -> Q Exp
- parseRoutesNoCheck :: QuasiQuoter
- parseRoutesFileNoCheck :: FilePath -> Q Exp
- mkRoute :: String -> [ResourceTree String] -> Q [Dec]
- routeDispatch :: Routable master => master -> Middleware
- showRoute :: RenderRoute master => Route master -> Text
- type Handler master = master -> Application
- class Routable master where
- class Eq (Route a) => RenderRoute a where
Quasi Quoters
A quasi-quoter to parse a string into a list of Resource
s. Checks for
overlapping routes, failing if present; use parseRoutesNoCheck
to skip the
checking. See documentation site for details on syntax.
Parse Routes declared inline
parseRoutesFile :: FilePath -> Q Exp
Parse routes declared in a file
parseRoutesNoCheck :: QuasiQuoter
Same as parseRoutes
, but performs no overlap checking.
Parse routes declared inline, without checking for overlaps
parseRoutesFileNoCheck :: FilePath -> Q Exp
Parse routes declared in a file, without checking for overlaps
Template Haskell methods
mkRoute :: String -> [ResourceTree String] -> Q [Dec]Source
Generates all the things needed for efficient routing,
including your application's Route
datatype, and a RenderRoute
instance
Dispatch
routeDispatch :: Routable master => master -> MiddlewareSource
Generates the application middleware from a Routable
master datatype
URL rendering
Application Handlers
type Handler master = master -> ApplicationSource
A Handler
generates an Application
from the master datatype
Generated Datatypes
class Eq (Route a) => RenderRoute a where
data Route a1
The type-safe URLs associated with a site argument.
renderRoute :: Route a -> ([Text], [(Text, Text)])
A RenderRoute
instance for your site datatype is automatically generated by mkRoute