From 6cc54ccef706a0eba367e63c8b4248df81010f2a Mon Sep 17 00:00:00 2001 From: PHO Date: Mon, 14 Nov 2011 14:55:49 +0900 Subject: [PATCH] () should be an instance of Dispatchable. Ditz-issue: e0312227f40a0fa92d4c5d69a64dad473f54389a --- Network/HTTP/Lucu/Resource/Dispatcher.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- 2.40.0