From: PHO Date: Mon, 14 Nov 2011 05:55:49 +0000 (+0900) Subject: () should be an instance of Dispatchable. X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=6cc54cc;p=Lucu.git () should be an instance of Dispatchable. Ditz-issue: e0312227f40a0fa92d4c5d69a64dad473f54389a --- diff --git a/Network/HTTP/Lucu/Resource/Dispatcher.hs b/Network/HTTP/Lucu/Resource/Dispatcher.hs index ac3112f..13080ee 100644 --- a/Network/HTTP/Lucu/Resource/Dispatcher.hs +++ b/Network/HTTP/Lucu/Resource/Dispatcher.hs @@ -38,7 +38,7 @@ instance Dispatchable Dispatcher where -- |FIXME: doc instance Monoid Dispatcher where {-# INLINE mempty #-} - mempty = dispatcher (return Nothing ∷ IO (Maybe ResourceDef)) + mempty = dispatcher () {-# INLINEABLE mappend #-} mappend (Dispatcher α) (Dispatcher β) @@ -68,5 +68,10 @@ instance Dispatchable ([ByteString] → Maybe ResourceDef) where 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