Safe Haskell | None |
---|
- parseRoutes :: QuasiQuoter
- parseRoutesNoCheck :: QuasiQuoter
- parseRoutesFile :: FilePath -> Q Exp
- parseRoutesFileNoCheck :: FilePath -> Q Exp
- mkYesod :: String -> [Resource String] -> Q [Dec]
- mkYesodSub :: String -> Cxt -> [Resource String] -> Q [Dec]
- mkYesodData :: String -> [Resource String] -> Q [Dec]
- mkYesodSubData :: String -> Cxt -> [Resource String] -> Q [Dec]
- mkYesodDispatch :: String -> [Resource String] -> Q [Dec]
- mkYesodSubDispatch :: String -> Cxt -> [Resource String] -> Q [Dec]
- class PathPiece s where
- fromPathPiece :: Text -> Maybe s
- toPathPiece :: s -> Text
- class PathMultiPiece s where
- fromPathMultiPiece :: [Text] -> Maybe s
- toPathMultiPiece :: s -> [Text]
- type Texts = [Text]
- toWaiApp :: (Yesod master, YesodDispatch master master) => master -> IO Application
- toWaiAppPlain :: (Yesod master, YesodDispatch master master) => master -> IO Application
- newtype WaiSubsite = WaiSubsite {}
Quasi-quoted routing
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.
parseRoutesNoCheck :: QuasiQuoter
Same as parseRoutes
, but performs no overlap checking.
parseRoutesFile :: FilePath -> Q Exp
parseRoutesFileNoCheck :: FilePath -> Q Exp
Generates URL datatype and site function for the given Resource
s. This
is used for creating sites, not subsites. See mkYesodSub
for the latter.
Use parseRoutes
to create the Resource
s.
Generates URL datatype and site function for the given Resource
s. This
is used for creating subsites, not sites. See mkYesod
for the latter.
Use parseRoutes
to create the Resource
s. In general, a subsite is not
executable by itself, but instead provides functionality to
be embedded in other sites.
More fine-grained
mkYesodData :: String -> [Resource String] -> Q [Dec]Source
Sometimes, you will want to declare your routes in one file and define
your handlers elsewhere. For example, this is the only way to break up a
monolithic file into smaller parts. Use this function, paired with
mkYesodDispatch
, to do just that.
mkYesodDispatch :: String -> [Resource String] -> Q [Dec]Source
See mkYesodData
.
Path pieces
class PathPiece s where
fromPathPiece :: Text -> Maybe s
toPathPiece :: s -> Text
class PathMultiPiece s where
fromPathMultiPiece :: [Text] -> Maybe s
toPathMultiPiece :: s -> [Text]
Convert to WAI
toWaiApp :: (Yesod master, YesodDispatch master master) => master -> IO ApplicationSource
Convert the given argument into a WAI application, executable with any WAI
handler. This is the same as toWaiAppPlain
, except it includes two
middlewares: GZIP compression and autohead. This is the
recommended approach for most users.
toWaiAppPlain :: (Yesod master, YesodDispatch master master) => master -> IO ApplicationSource
Convert the given argument into a WAI application, executable with any WAI
handler. This differs from toWaiApp
in that it uses no middlewares.
WAI subsites
newtype WaiSubsite Source
Wrap up a normal WAI application as a Yesod subsite.
RenderRoute WaiSubsite | |
YesodDispatch WaiSubsite master | |
Eq (Route WaiSubsite) | |
Ord (Route WaiSubsite) | |
Read (Route WaiSubsite) | |
Show (Route WaiSubsite) |