-- |Container type for the 'ResourceMapper' type class.
data ResourceMap = ∀α. ResourceMapper α ⇒ RMap α
--- |'ResourceTree' is an opaque structure which is a map from resource
--- path to 'Resource'.
+-- |'ResourceTree' is an opaque structure which a map from resource
+-- 'Path' to 'ResourceNode'.
--
-- @
-- 'fromList' [ ([] , 'nonGreedy' '$' 'Network.HTTP.Lucu.StaticFile.staticFile' \"\/usr\/include\/stdio.h\" ) -- \/
newtype ResourceTree = Tree (M.Map Path ResourceNode)
deriving Monoid
--- |FIXME: doc
+-- |A node of 'Resource' located somewhere in a 'ResourceTree'. Such
+-- nodes are either 'greedy' or 'nonGreedy'.
data ResourceNode
= Greedy { nResource ∷ !Resource }
| NonGreedy { nResource ∷ !Resource }
-- Say a client is trying to access \"\/aaa\/bbb\/ccc\' while there is
-- no resource node at the path. If there are greedy resource nodes at
-- \"\/aaa\/bbb\", \"\/aaa\" or \"/\" they will be chosen instead as a
--- fallback. Greedy resource nodes are searched in depth-first order.
+-- fallback. Greedy resource nodes are searched in depth-first
+-- order, just like CGI scripts.
greedy ∷ Resource → ResourceNode
{-# INLINE CONLIKE greedy #-}
greedy = Greedy
--- |FIXME: doc
+-- |Make a normal, non-greedy resource node.
nonGreedy ∷ Resource → ResourceNode
{-# INLINE CONLIKE nonGreedy #-}
nonGreedy = NonGreedy