From 7e51c30303e9d3f65cfdaf5b35bc4a64260ce8b9 Mon Sep 17 00:00:00 2001 From: PHO Date: Mon, 14 Nov 2011 14:47:01 +0900 Subject: [PATCH] rename: findResource => dispatch Ditz-issue: e0312227f40a0fa92d4c5d69a64dad473f54389a --- Network/HTTP/Lucu/Resource/Dispatcher.hs | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) 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 ∘ (,) [] -- 2.40.0