X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FDispatcher%2FInternal.hs;h=6e088df8061178f32ffd492187502d4206def0cf;hp=80effa786e30d4c6a6d5c98b52a9b127b01cd0ec;hb=fffa09842d060c7d738084125dea07783d84aefe;hpb=060378af59e17e67e3cf79fc35f6e95ff770b9ef diff --git a/Network/HTTP/Lucu/Dispatcher/Internal.hs b/Network/HTTP/Lucu/Dispatcher/Internal.hs index 80effa7..6e088df 100644 --- a/Network/HTTP/Lucu/Dispatcher/Internal.hs +++ b/Network/HTTP/Lucu/Dispatcher/Internal.hs @@ -79,8 +79,8 @@ class ResourceMapper α where -- |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\" ) -- \/ @@ -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