haddocks for :>

This commit is contained in:
Alp Mestanogullari 2014-11-22 17:56:45 +01:00
parent 15adc964e4
commit 92ddcf4380

View file

@ -15,9 +15,17 @@ import Servant.Server
-- | The contained API (second argument) can be found under @("/" ++ path)@ -- | The contained API (second argument) can be found under @("/" ++ path)@
-- (path being the first argument). -- (path being the first argument).
--
-- Example:
--
-- > -- GET /hello/world
-- > -- returning a JSON encoded World value
-- > type MyApi = "hello" :> "world" :> Get World
data (path :: k) :> a = Proxy path :> a data (path :: k) :> a = Proxy path :> a
infixr 9 :> infixr 9 :>
-- | Make sure the incoming request starts with @"/path"@, strip it and
-- pass the rest of the request path to @sublayout@.
instance (KnownSymbol path, HasServer sublayout) => HasServer (path :> sublayout) where instance (KnownSymbol path, HasServer sublayout) => HasServer (path :> sublayout) where
type Server (path :> sublayout) = Server sublayout type Server (path :> sublayout) = Server sublayout
route Proxy subserver request respond = case pathInfo request of route Proxy subserver request respond = case pathInfo request of
@ -30,6 +38,7 @@ instance (KnownSymbol path, HasServer sublayout) => HasServer (path :> sublayout
where proxyPath = Proxy :: Proxy path where proxyPath = Proxy :: Proxy path
-- | Make the querying function append @path@ to the request path.
instance (KnownSymbol path, HasClient sublayout) => HasClient (path :> sublayout) where instance (KnownSymbol path, HasClient sublayout) => HasClient (path :> sublayout) where
type Client (path :> sublayout) = Client sublayout type Client (path :> sublayout) = Client sublayout