]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/Resource/Dispatcher.hs
Eliminate some of Dispatchable instances.
[Lucu.git] / Network / HTTP / Lucu / Resource / Dispatcher.hs
index b3c6d0758be3f18d379d620dbbc00034146d8362..aadd39bce5a827f2b1da84b37c047e60acfee21f 100644 (file)
@@ -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 ∘ ((<$>) ∘ (<$>)) ((,) [])