From 619b60675f5aca122ca49a2089ee20aeb2f6717f Mon Sep 17 00:00:00 2001 From: PHO Date: Mon, 14 Nov 2011 15:11:05 +0900 Subject: [PATCH] docs Ditz-issue: e0312227f40a0fa92d4c5d69a64dad473f54389a --- Network/HTTP/Lucu/Resource/Dispatcher.hs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Network/HTTP/Lucu/Resource/Dispatcher.hs b/Network/HTTP/Lucu/Resource/Dispatcher.hs index 13080ee..7b1ac43 100644 --- a/Network/HTTP/Lucu/Resource/Dispatcher.hs +++ b/Network/HTTP/Lucu/Resource/Dispatcher.hs @@ -28,14 +28,15 @@ class Dispatchable α where {-# INLINE dispatcher #-} dispatcher = Dispatcher --- |FIXME: doc +-- |Container type for 'Dispatchable' type class. data Dispatcher = ∀α. Dispatchable α ⇒ Dispatcher α instance Dispatchable Dispatcher where dispatch (Dispatcher α) = dispatch α dispatcher = id --- |FIXME: doc +-- |@a `'mappend'` b@ first tries to find a resource with @a@, and if +-- it returns 'Nothing', tries @b@ next. instance Monoid Dispatcher where {-# INLINE mempty #-} mempty = dispatcher () @@ -48,30 +49,33 @@ instance Monoid Dispatcher where Just _ → return r Nothing → dispatch β host path +-- |An IO-based dispatcher returning resource paths as well as +-- 'ResourceDef's. instance Dispatchable (CI Text → [ByteString] → IO (Maybe ([ByteString], ResourceDef))) where dispatch = id +-- |An IO-based dispatcher. instance Dispatchable (CI Text → [ByteString] → IO (Maybe ResourceDef)) where dispatch = ((((<$>) ∘ (<$>)) ((,) []) ∘) ∘) +-- |A pure dispatcher. instance Dispatchable (CI Text → [ByteString] → Maybe ResourceDef) where dispatch = (((return ∘ ((,) [] <$>)) ∘) ∘) +-- |An IO-based dispatcher ignoring host names. instance Dispatchable ([ByteString] → IO (Maybe ResourceDef)) where dispatch = const ∘ (((<$>) ∘ (<$>)) ((,) []) ∘) +-- |A pure dispatcher ignoring host names. instance Dispatchable ([ByteString] → Maybe ResourceDef) where dispatch = const ∘ ((return ∘ ((,) [] <$>)) ∘) -instance Dispatchable (IO (Maybe ResourceDef)) where - dispatch = const ∘ const ∘ ((<$>) ∘ (<$>)) ((,) []) - -- |The constant dispatcher returning always the same 'ResourceDef'. instance Dispatchable ResourceDef where dispatch = const ∘ const ∘ return ∘ Just ∘ (,) [] -- |The empty dispatcher returning always 'Nothing'. instance Dispatchable () where - dispatch _ _ _ = return Nothing \ No newline at end of file + dispatch _ _ _ = return Nothing -- 2.40.0