| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Airship.Route
Documentation
data RoutingSpec m a Source
Represents a fully-specified set of routes that map paths (represented as Routes) to Resources. RoutingSpecs are declared with do-notation, to wit:
myRoutes :: RoutingSpec IO ()
myRoutes = do
root #> myRootResource
"blog" </> var "date" </> var "post" #> blogPostResource
"about" #> aboutResource
"anything" </> star #> wildcardResource
Instances
| Monad (RoutingSpec m) Source | |
| Functor (RoutingSpec m) Source | |
| Applicative (RoutingSpec m) Source | |
| MonadWriter [(Route, Resource m)] (RoutingSpec m) Source |
Represents the root resource (/). This should usually be the first path declared in a RoutingSpec.
Captures a wildcard route. For example,
"emcees" </> star
will match /emcees, /emcees/biggie, /emcees/earl/vince, and so on and so forth.
(#>) :: MonadWriter [(k, v)] m => k -> v -> m () Source
The #> operator provides syntactic sugar for the construction of association lists.
For example, the following assoc list:
[("run", "jewels"), ("blue", "suede"), ("zion", "wolf")]
can be represented as such:
execWriter $ do
"run" #> "jewels"
"blue" #> "suede"
"zion" #> "wolf"
It used in RoutingSpec declarations to indicate that a particular Route maps
to a given Resource, but can be used in many other places where association lists
are expected, such as contentTypesProvided.