X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FResource%2FDispatcher.hs;h=13080ee1da3a0e9fe32bca44152e6375cb774a58;hp=ac3112fb9d030cb91330f0d7c2f2d0aa3a103cba;hb=6cc54ccef706a0eba367e63c8b4248df81010f2a;hpb=7e51c30303e9d3f65cfdaf5b35bc4a64260ce8b9 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