@@ -1,8 +1,9 @@
1−{-# LANGUAGE RankNTypes #-}
1+{-# LANGUAGE EmptyCase, EmptyDataDecls, RankNTypes #-}
22module Network.Wai.HTTP2
33 ( Http2Application
44 , Response
55 , Trailers
6+ , absurd
67 , responseStatus
78 , responseStream
89 , responseHeaders
@@ -17,9 +18,19 @@ import qualified Network.Wai.Internal as H1 (Request)
1718-- the HTTP\/1.1 spec (RFC 7230), and section 8.1 of the HTTP\/2 spec.
1819type Trailers = H.ResponseHeaders
1920
20−-- | The type of an HTTP\/2 request.
21−-- TODO(awpr): specialize this for HTTP\/2.
22−type Request = H1.Request
21+-- | The synthesized request and headers of a pushed stream.
22+-- TODO(awpr): implement for real.
23+data PushPromise
24+
25+-- 'PushPromise' is currently uninhabited, which proves the caller cannot use
26+-- 'pushPromise'. This discharges the obligation to implement any function
27+-- taking a 'PushPromise'.
28+absurd :: PushPromise -> a
29+absurd p = case p of {}
30+
31+-- | The type of an HTTP\/2 request: a normal HTTP request and an action to
32+-- push streams associated with this request.
33+type Request = (H1.Request, PushPromise -> Responder -> IO ())
2334
2435-- | The HTTP\/2-aware equivalent of 'Network.Wai.Application'.
2536type Http2Application = Request -> Responder