@@ -129,7 +129,9 @@ responseBuilder = ResponseBuilder
129129responseLBS :: H.Status -> H.ResponseHeaders -> L.ByteString -> Response
130130responseLBS s h = ResponseBuilder s h . fromLazyByteString
131131
132−-- | Creating 'Response' from 'C.Source'.
132+-- | Creating 'Response' from a stream of values.
133+--
134+-- Since 3.0.0
133135responseStream :: H.Status
134136 -> H.ResponseHeaders
135137 -> StreamingBody
@@ -168,7 +170,7 @@ responseHeaders (ResponseBuilder _ hs _ ) = hs
168170responseHeaders (ResponseStream _ hs _ ) = hs
169171responseHeaders (ResponseRaw _ res) = responseHeaders res
170172
171−-- | Converting the body information in 'Response' to 'Source'.
173+-- | Converting the body information in 'Response' to a @StreamingBody@.
172174responseToStream :: Response
173175 -> ( H.Status
174176 , H.ResponseHeaders
@@ -206,6 +208,18 @@ responseToStream (ResponseRaw _ res) = responseToStream res
206208----------------------------------------------------------------
207209
208210-- | The WAI application.
211+--
212+-- Note that, since WAI 3.0, this type is structured in continuation passing
213+-- style to allow for proper safe resource handling. This was handled in the
214+-- past via other means (e.g., @ResourceT@). As a demonstration:
215+--
216+-- @
217+-- app :: Application
218+-- app req respond = bracket_
219+-- (putStrLn "Allocating scarce resource")
220+-- (putStrLn "Cleaning up")
221+-- (respond $ responseLBS status200 [] "Hello World")
222+-- @
209223type Application = Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived
210224
211225-- | Middleware is a component that sits between the server and application. It