From: PHO Date: Mon, 14 Nov 2011 05:47:01 +0000 (+0900) Subject: rename: findResource => dispatch X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=7e51c30;p=Lucu.git rename: findResource => dispatch Ditz-issue: e0312227f40a0fa92d4c5d69a64dad473f54389a --- diff --git a/Network/HTTP/Lucu/Resource/Dispatcher.hs b/Network/HTTP/Lucu/Resource/Dispatcher.hs index aadd39b..ac3112f 100644 --- a/Network/HTTP/Lucu/Resource/Dispatcher.hs +++ b/Network/HTTP/Lucu/Resource/Dispatcher.hs @@ -19,10 +19,10 @@ import Prelude.Unicode -- |FIXME: docs class Dispatchable α where - findResource ∷ α - → CI Text - → [ByteString] - → IO (Maybe ([ByteString], ResourceDef)) + dispatch ∷ α + → CI Text + → [ByteString] + → IO (Maybe ([ByteString], ResourceDef)) dispatcher ∷ α → Dispatcher {-# INLINE dispatcher #-} @@ -32,7 +32,7 @@ class Dispatchable α where data Dispatcher = ∀α. Dispatchable α ⇒ Dispatcher α instance Dispatchable Dispatcher where - findResource (Dispatcher α) = findResource α + dispatch (Dispatcher α) = dispatch α dispatcher = id -- |FIXME: doc @@ -43,30 +43,30 @@ instance Monoid Dispatcher where {-# INLINEABLE mappend #-} mappend (Dispatcher α) (Dispatcher β) = dispatcher - $ \host path → do r ← findResource α host path + $ \host path → do r ← dispatch α host path case r of Just _ → return r - Nothing → findResource β host path + Nothing → dispatch β host path instance Dispatchable (CI Text → [ByteString] → IO (Maybe ([ByteString], ResourceDef))) where - findResource = id + dispatch = id instance Dispatchable (CI Text → [ByteString] → IO (Maybe ResourceDef)) where - findResource = ((((<$>) ∘ (<$>)) ((,) []) ∘) ∘) + dispatch = ((((<$>) ∘ (<$>)) ((,) []) ∘) ∘) instance Dispatchable (CI Text → [ByteString] → Maybe ResourceDef) where - findResource = (((return ∘ ((,) [] <$>)) ∘) ∘) + dispatch = (((return ∘ ((,) [] <$>)) ∘) ∘) instance Dispatchable ([ByteString] → IO (Maybe ResourceDef)) where - findResource = const ∘ (((<$>) ∘ (<$>)) ((,) []) ∘) + dispatch = const ∘ (((<$>) ∘ (<$>)) ((,) []) ∘) instance Dispatchable ([ByteString] → Maybe ResourceDef) where - findResource = const ∘ ((return ∘ ((,) [] <$>)) ∘) + dispatch = const ∘ ((return ∘ ((,) [] <$>)) ∘) instance Dispatchable (IO (Maybe ResourceDef)) where - findResource = const ∘ const ∘ ((<$>) ∘ (<$>)) ((,) []) + dispatch = const ∘ const ∘ ((<$>) ∘ (<$>)) ((,) []) instance Dispatchable ResourceDef where - findResource = const ∘ const ∘ return ∘ Just ∘ (,) [] + dispatch = const ∘ const ∘ return ∘ Just ∘ (,) []