From 850ea02dbd575b4fa1720a8b0592fede6a1e6050 Mon Sep 17 00:00:00 2001 From: PHO Date: Mon, 14 Nov 2011 14:45:36 +0900 Subject: [PATCH] Eliminate some of Dispatchable instances. Ditz-issue: e0312227f40a0fa92d4c5d69a64dad473f54389a --- Network/HTTP/Lucu/Resource/Dispatcher.hs | 38 ++++-------------------- 1 file changed, 5 insertions(+), 33 deletions(-) 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 ∘ ((<$>) ∘ (<$>)) ((,) []) -- 2.40.0