-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Support for static URL routing with overlap detection for Happstack.
--
@package happstack-static-routing
@version 0.4.2
-- | Support for static routing tables in Happstack. The routing tables are
-- order independent as long as:
--
--
-- - if any two handlers overlap, one of them handles a more specific
-- path than the other. The more specific handler is then tried
-- first.
--
--
-- Routing tables are constructed from dir, path,
-- remainingPath, choice, and param.
--
-- A routing table is compiled by using compile. The result is an
-- overlap report, and a prefix tree that is used to efficiently dispatch
-- requests by means of dispatch.
--
-- See the file src/Happstack/StaticRouting/Test.hs in the
-- distribution for examples.
module Happstack.StaticRouting
-- | Static routing tables consisting of handlers of type a.
data Route a
-- | Compile routes or return overlap report. Returns 'Left e' in case of
-- order-dependent overlap between handlers, where e describes
-- the overlap. Returns 'Right h', where h is a compiled handler that
-- returns Nothing in case no matching handler was found,
-- otherwise 'Just response'.
compile :: (MonadIO m, HasRqData m, ServerMonad m, FilterMonad Response m) => Route (m Response) -> Either String (m (Maybe Response))
-- | Combine several route alternatives into one.
choice :: [Route a] -> Route a
-- | Pop a path element if it matches the given string.
dir :: String -> Route a -> Route a
-- | Pop a path element, and store it to use with handler
param :: Route a -> Route a
-- | Expect the given method, and exactly n more segments, where
-- n is the arity of the handler.
path :: Path m hm h r => Method -> (m r -> hm r') -> h -> Route (hm r')
-- | Support for varying number of arguments to path handlers.
class Path m hm h r | h r -> m
-- | Expect zero or more segments.
remainingPath :: Method -> h -> Route h