git.iko.soy/typeable/servant
on master help sign in
haddocks for :>
commit92ddcf4380ec3db9dc123784691f7503a52dc66e authorAlp Mestanogullari <alpmestan@gmail.com> dateSat 22 Nov 2014, 17:56 (12 years ago) parent15adc96
1 file changed+9
src/Servant/API/Sub.hs+9
src/Servant/API/Sub.hs+9
@@ -15,9 +15,17 @@ import Servant.Server
1515
1616-- | The contained API (second argument) can be found under @("/" ++ path)@
1717-- (path being the first argument).
18+--
19+-- Example:
20+--
21+-- > -- GET /hello/world
22+-- > -- returning a JSON encoded World value
23+-- > type MyApi = "hello" :> "world" :> Get World
1824data (path :: k) :> a = Proxy path :> a
1925infixr 9 :>
2026
27+-- | Make sure the incoming request starts with @"/path"@, strip it and
28+-- pass the rest of the request path to @sublayout@.
2129instance (KnownSymbol path, HasServer sublayout) => HasServer (path :> sublayout) where
2230 type Server (path :> sublayout) = Server sublayout
2331 route Proxy subserver request respond = case pathInfo request of
@@ -30,6 +38,7 @@ instance (KnownSymbol path, HasServer sublayout) => HasServer (path :> sublayout
3038
3139 where proxyPath = Proxy :: Proxy path
3240
41+-- | Make the querying function append @path@ to the request path.
3342instance (KnownSymbol path, HasClient sublayout) => HasClient (path :> sublayout) where
3443 type Client (path :> sublayout) = Client sublayout
3544