]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/Dispatcher/Internal.hs
Code reorganisation
[Lucu.git] / Network / HTTP / Lucu / Dispatcher / Internal.hs
index 80effa786e30d4c6a6d5c98b52a9b127b01cd0ec..3699f700fd82c2413bd47b54e82d7b4ee2c8a072 100644 (file)
@@ -58,7 +58,7 @@ class HostMapper α where
     hostMap = HMap
 
 -- |Container type for the 'HostMapper' type class.
-data HostMap = ∀α. HostMapper α ⇒ HMap α
+data HostMap = ∀α. HostMapper α ⇒ HMap !α
 
 -- |Class of maps from resource 'Path' to 'Resource'.
 --
@@ -77,10 +77,10 @@ class ResourceMapper α where
     resourceMap = RMap
 
 -- |Container type for the 'ResourceMapper' type class.
-data ResourceMap = ∀α. ResourceMapper α ⇒ RMap α
+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\" ) -- \/
@@ -96,7 +96,8 @@ data ResourceMap = ∀α. ResourceMapper α ⇒ RMap α
 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 }
@@ -106,12 +107,13 @@ data ResourceNode
 -- 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