-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A simple request dispatcher. -- @package webcrank-dispatch @version 0.1 module Webcrank.Dispatch -- | The simplest Path is the root path, which -- is equivalent to /. root :: Path [] -- | Other routes can be built with /: -- --
--   docsPath = "package" </> "webcrank-dispatch-0.1" </> "docs"
--   
() :: Path as -> Path bs -> Path (Append as bs) -- | Paths can contain parameters. To create a parameterized path, use -- param as a path component: -- --
--   docsPath :: Path '[String]
--   docsPath = "package" </> param </> "docs"
--   
-- -- Paths can contain as many parameters of varying types as needed: -- --
--   wat :: Path '[String, Int, Bool, Int, String]
--   wat :: "this" </> param </> param </> "crazyness" </> param </> "ends" </> param </> param
--   
-- -- Path parameters can be of any type that have instances for -- Typeable and PathPiece. param :: (Typeable a, PathPiece a) => Path (a : []) data Path (as :: [*]) :: [*] -> * -- | Paths can be rendered using renderPath and -- params. -- --
--   >>> renderPath root params
--   ["/"]
--   
-- --
--   >>> renderPath docsPath $ params "webcrank-dispatch-0.1"
--   ["package", "webcrank-dispatch-0.1", "docs"]
--   
-- --
--   >>> renderPath wat $ params "down is up" 42 False 7 "up is down"
--   ["this", "down is up", "42", "crazyness", "False", "ends", "7", "up is down"]
--   
-- -- Note in the last example that no encoding is done by -- renderPath. renderPath :: Path l -> HVect l -> [Text] params :: HBuild' [] r => r class HBuild' l r hBuild' :: HBuild' l r => HVect l -> r -- | An elementary Dispatcher can be built using -- ==>. -- --
--   disp = root ==> "Dispatched"
--   
-- -- Dispatchers form a Monoid, so more -- interesting dispatchers can be built with <> or -- mconcat. -- --
--   disp = mconcat
--     [ root ==> "Welcome!"
--     , "echo" / param ==> id
--     ]
--   
(==>) :: Path as -> HVectElim as a -> Dispatcher a -- | Dispatching requests is done with dispatch. It turns a -- Dispatcher into a function from a list of decoded path -- components to a possible handler. -- --
--   >>> dispatch (root ==> "Welcome!") [""]
--   Just "Welcome!"
--   
-- --
--   >>> dispatch (root ==> "Welcome!") ["echo", "Goodbye!"]
--   Nothing
--   
-- --
--   >>> dispatch (root ==> "Welcome!" <> "echo" </> param ==> id) ["echo", "Goodbye!"]
--   Just "Goodbye!"
--   
dispatch :: Dispatcher a -> [Text] -> Maybe a data Dispatcher a instance AbstractRouter (SafeRouter a) instance Monoid (Dispatcher a) instance HBuild' (a : l) r => HBuild' l (a -> r) instance l' ~ ReverseLoop l '[] => HBuild' l (HVect l')