X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FResource%2FDispatcher.hs;h=ffaba2d1ec114e49a3a22eb900a1bc81d286055e;hp=7b1ac43f485436734a249aa2e6b4228374bae4fe;hb=1ead053df6a792edafa9d714c4c038a8a9c3ad16;hpb=545053db37e71ed18ca59c12467a8ecb10bf5f83 diff --git a/Network/HTTP/Lucu/Resource/Dispatcher.hs b/Network/HTTP/Lucu/Resource/Dispatcher.hs index 7b1ac43..ffaba2d 100644 --- a/Network/HTTP/Lucu/Resource/Dispatcher.hs +++ b/Network/HTTP/Lucu/Resource/Dispatcher.hs @@ -22,7 +22,7 @@ class Dispatchable α where dispatch ∷ α → CI Text → [ByteString] - → IO (Maybe ([ByteString], ResourceDef)) + → IO (Maybe ([ByteString], Resource)) dispatcher ∷ α → Dispatcher {-# INLINE dispatcher #-} @@ -50,30 +50,30 @@ instance Monoid Dispatcher where Nothing → dispatch β host path -- |An IO-based dispatcher returning resource paths as well as --- 'ResourceDef's. +-- 'Resource's. instance Dispatchable (CI Text → [ByteString] - → IO (Maybe ([ByteString], ResourceDef))) where + → IO (Maybe ([ByteString], Resource))) where dispatch = id -- |An IO-based dispatcher. -instance Dispatchable (CI Text → [ByteString] → IO (Maybe ResourceDef)) where +instance Dispatchable (CI Text → [ByteString] → IO (Maybe Resource)) where dispatch = ((((<$>) ∘ (<$>)) ((,) []) ∘) ∘) -- |A pure dispatcher. -instance Dispatchable (CI Text → [ByteString] → Maybe ResourceDef) where +instance Dispatchable (CI Text → [ByteString] → Maybe Resource) where dispatch = (((return ∘ ((,) [] <$>)) ∘) ∘) -- |An IO-based dispatcher ignoring host names. -instance Dispatchable ([ByteString] → IO (Maybe ResourceDef)) where +instance Dispatchable ([ByteString] → IO (Maybe Resource)) where dispatch = const ∘ (((<$>) ∘ (<$>)) ((,) []) ∘) -- |A pure dispatcher ignoring host names. -instance Dispatchable ([ByteString] → Maybe ResourceDef) where +instance Dispatchable ([ByteString] → Maybe Resource) where dispatch = const ∘ ((return ∘ ((,) [] <$>)) ∘) --- |The constant dispatcher returning always the same 'ResourceDef'. -instance Dispatchable ResourceDef where +-- |The constant dispatcher returning always the same 'Resource'. +instance Dispatchable Resource where dispatch = const ∘ const ∘ return ∘ Just ∘ (,) [] -- |The empty dispatcher returning always 'Nothing'.