X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FResource%2FDispatcher.hs;h=aadd39bce5a827f2b1da84b37c047e60acfee21f;hp=b3c6d0758be3f18d379d620dbbc00034146d8362;hb=850ea02dbd575b4fa1720a8b0592fede6a1e6050;hpb=24d6b6e25e79495eaa00eb6eacdb707d181d0770 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 ∘ ((<$>) ∘ (<$>)) ((,) [])