on master help sign in
Clean up interface and Haddocks
commitbf5c8fb8819159b9915db452289a366e7bca399e authorAndrew Pritchard <awpr@google.com> dateMon 31 Aug 2015, 09:44 (11 years ago) parentc8a764e
2 files changed+26−17
wai/Network/Wai/HTTP2.hs+21−13 warp/Network/Wai/Handler/Warp/HTTP2/Worker.hs+5−4
wai/Network/Wai/HTTP2.hs+21−13
@@ -1,13 +1,20 @@
11{-# LANGUAGE OverloadedStrings, RankNTypes #-}
22{-# LANGUAGE CPP #-}
33module Network.Wai.HTTP2
4− ( Chunk(..)
5− , HTTP2Application
6− , PushPromise(..)
7− , RespondFunc
4+ (
5+ -- * Applications
6+ HTTP2Application
87 , Responder
8+ , Body
9+ , Chunk(..)
10+ , BodyOf
11+ , PushFunc
912 , Trailers
13+ -- * Server push
14+ , PushPromise(..)
1015 , promiseHeaders
16+ -- * Conveniences
17+ , SimpleBody
1118 , promoteApplication
1219 , responder
1320 , streamFilePart
@@ -58,15 +65,16 @@ type Body a = BodyOf Chunk a
5865-- 'Network.Wai.StreamingBody' with @c ~ Builder@ and @a ~ ()@.
5966type BodyOf c a = (c -> IO ()) -> IO () -> IO a
6067
61−-- | A function given to an 'HTTP2Application' used to send the response. This
62−-- is similar to the respond function in 'Network.Wai.Application', but the
63−-- status and headers are curried, and it passes on any result value from the
64−-- stream body.
65−type RespondFunc = forall a. H.Status -> H.ResponseHeaders -> Body a -> IO a
66−
67−-- | A continuation-passing style function that provides a response by calling
68−-- the 'RespondFunc', then returns the request's 'Trailers'.
69−type Responder = RespondFunc -> IO Trailers
68+-- | The result of an 'HTTP2Application'; or, alternately, an application
69+-- that's independent of the request. This is a continuation-passing style
70+-- function that first provides a response by calling the given respond
71+-- function, then returns the request's 'Trailers'.
72+--
73+-- The respond function is similar to the one in 'Network.Wai.Application', but
74+-- it only takes a streaming body, the status and headers are curried, and it
75+-- passes on any result value from the stream body.
76+type Responder = (forall a. H.Status -> H.ResponseHeaders -> Body a -> IO a)
77+ -> IO Trailers
7078
7179-- | A function given to an 'HTTP2Application' to initiate a server-pushed
7280-- stream. Its argument is the same as the result of an 'HTTP2Application', so
warp/Network/Wai/Handler/Warp/HTTP2/Worker.hs+5−4
@@ -27,17 +27,18 @@ import Network.Wai.Handler.Warp.HTTP2.EncodeFrame
2727import Network.Wai.Handler.Warp.HTTP2.Manager
2828import Network.Wai.Handler.Warp.HTTP2.Types
2929import Network.Wai.Handler.Warp.IORef
30−import Network.Wai.HTTP2 (Chunk(..), HTTP2Application, PushPromise, Responder, RespondFunc)
30+import Network.Wai.HTTP2 (Chunk(..), HTTP2Application, PushPromise, Responder)
3131import qualified Network.Wai.Handler.Warp.Settings as S
3232import qualified Network.Wai.Handler.Warp.Timeout as T
3333
3434----------------------------------------------------------------
3535
36−-- | An 'HTTP2Application' takes a 'RespondFunc'; this type implements that by
37−-- currying some internal arguments.
36+-- | An 'HTTP2Application' takes a function of status, headers, and body; this
37+-- type implements that by currying some internal arguments.
3838--
3939-- This is the argument to a 'Responder'.
40−type Respond = IO () -> Stream -> TBQueue Sequence -> RespondFunc
40+type Respond = forall a. IO () -> Stream -> TBQueue Sequence
41+ -> H.Status -> H.ResponseHeaders -> Body a -> IO a
4142
4243-- | This function is passed to workers.
4344-- They also pass responses from 'HTTP2Application's to this function.