From: PHO Date: Mon, 14 Nov 2011 05:45:36 +0000 (+0900) Subject: Eliminate some of Dispatchable instances. X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=850ea02;p=Lucu.git Eliminate some of Dispatchable instances. Ditz-issue: e0312227f40a0fa92d4c5d69a64dad473f54389a --- diff --git a/Network/HTTP/Lucu/Resource/Dispatcher.hs b/Network/HTTP/Lucu/Resource/Dispatcher.hs index b3c6d07..aadd39b 100644 --- a/Network/HTTP/Lucu/Resource/Dispatcher.hs +++ b/Network/HTTP/Lucu/Resource/Dispatcher.hs @@ -38,10 +38,7 @@ instance Dispatchable Dispatcher where -- |FIXME: doc instance Monoid Dispatcher where {-# INLINE mempty #-} - mempty = dispatcher f - where - f ∷ CI Text → [ByteString] → IO (Maybe ([ByteString], ResourceDef)) - f _ _ = return Nothing + mempty = dispatcher (return Nothing ∷ IO (Maybe ResourceDef)) {-# INLINEABLE mappend #-} mappend (Dispatcher α) (Dispatcher β) @@ -56,43 +53,18 @@ instance Dispatchable (CI Text → IO (Maybe ([ByteString], ResourceDef))) where findResource = id -instance Dispatchable (CI Text - → [ByteString] - → Maybe ([ByteString], ResourceDef)) where - findResource = ((return ∘) ∘) - -instance Dispatchable (CI Text - → [ByteString] - → IO (Maybe ResourceDef)) where +instance Dispatchable (CI Text → [ByteString] → IO (Maybe ResourceDef)) where findResource = ((((<$>) ∘ (<$>)) ((,) []) ∘) ∘) -instance Dispatchable (CI Text - → [ByteString] - → Maybe ResourceDef) where +instance Dispatchable (CI Text → [ByteString] → Maybe ResourceDef) where findResource = (((return ∘ ((,) [] <$>)) ∘) ∘) -instance Dispatchable ([ByteString] - → IO (Maybe ([ByteString], ResourceDef))) where - findResource = const - -instance Dispatchable ([ByteString] - → Maybe ([ByteString], ResourceDef)) where - findResource = const ∘ (return ∘) - -instance Dispatchable ([ByteString] - → IO (Maybe ResourceDef)) where +instance Dispatchable ([ByteString] → IO (Maybe ResourceDef)) where findResource = const ∘ (((<$>) ∘ (<$>)) ((,) []) ∘) -instance Dispatchable ([ByteString] - → Maybe ResourceDef) where +instance Dispatchable ([ByteString] → Maybe ResourceDef) where findResource = const ∘ ((return ∘ ((,) [] <$>)) ∘) -instance Dispatchable (IO (Maybe ([ByteString], ResourceDef))) where - findResource = const ∘ const - -instance Dispatchable ([ByteString], ResourceDef) where - findResource = const ∘ const ∘ return ∘ Just - instance Dispatchable (IO (Maybe ResourceDef)) where findResource = const ∘ const ∘ ((<$>) ∘ (<$>)) ((,) [])