|Portability||non-portable (uses ghc extensions)|
This package provides typesafe URLs for Wai applications.
- parseRoutes :: QuasiQuoter
- parseRoutesFile :: FilePath -> Q Exp
- parseRoutesNoCheck :: QuasiQuoter
- parseRoutesFileNoCheck :: FilePath -> Q Exp
- mkRoute :: String -> [Resource] -> Q [Dec]
- dispatch :: Route route => route -> Middleware
- data Resource = Resource String [Piece] [String]
- data Piece
- class Route route where
parseRoutesFile, but performs no overlap checking.
Call this function to automatically generate your route datatype and
The application dispatcher function.
This function takes an instance of
Route class as an argument.
It is normal to pass (undefined::YourRoute).
A single resource pattern.
First argument is the name of the constructor, second is the URL pattern to match, third is how to dispatch.
A single piece of a URL, delimited by slashes.
In the case of StaticPiece, the argument is the value of the piece; for the other constructors, it is the name of the parameter represented by this piece.