@@ -1,4 +1,5 @@
1{-# LANGUAGE DeriveDataTypeable #-}
1{-# LANGUAGE DeriveDataTypeable #-}
2+{-# LANGUAGE RankNTypes #-}
2{-# LANGUAGE NamedFieldPuns #-}
3{-# LANGUAGE NamedFieldPuns #-}
3{-# LANGUAGE PatternGuards #-}
4{-# LANGUAGE PatternGuards #-}
4{-# LANGUAGE CPP #-}
5{-# LANGUAGE CPP #-}
@@ -31,11 +32,10 @@ import qualified Network.Wai.Handler.Warp.Timeout as T
32----------------------------------------------------------------
33----------------------------------------------------------------
34−-- | The wai definition is @type Http2Application = Request -> (Response -> IO ()) -> IO Trailers@.
35+-- | An 'Http2Application' takes a @forall a. Response a -> IO a@; this type
35−-- This type implements the second argument @Response -> IO ()@
36−-- with extra arguments.
36+-- implements that with extra arguments.
37−type Responder = ThreadContinue -> T.Handle -> Stream ->
37+type Responder = forall a. ThreadContinue -> T.Handle -> Stream ->
38− TBQueue Sequence -> Response -> IO ()
38+ TBQueue Sequence -> Response a -> IO a
40-- | This function is passed to workers.
40-- | This function is passed to workers.
41-- They also pass 'Response's from 'Http2Application's to this function.
41-- They also pass 'Response's from 'Http2Application's to this function.
@@ -70,8 +70,12 @@ data Break = Break deriving (Show, Typeable)
71instance Exception Break
71instance Exception Break
73−worker ::
73+worker :: Context
74− Context -> S.Settings -> T.Manager -> Http2Application -> Responder -> IO ()
76+ -> Http2Application
75worker ctx@Context{inputQ,outputQ} set tm app responder = do
79worker ctx@Context{inputQ,outputQ} set tm app responder = do
76 tid <- myThreadId
80 tid <- myThreadId
77 sinfo <- newStreamInfo
81 sinfo <- newStreamInfo