@@ -1,4 +1,5 @@
1{-# LANGUAGE Rank2Types #-}
1{-# LANGUAGE Rank2Types #-}
2+{-# LANGUAGE ExistentialQuantification #-}
4This module defines a generic web application interface. It is a common
5This module defines a generic web application interface. It is a common
@@ -56,6 +57,7 @@ module Network.Wai
56 , statusCode
57 , statusCode
57 , statusMessage
58 , statusMessage
58 -- * Enumerator
59 -- * Enumerator
59 , Enumerator (..)
61 , Enumerator (..)
60 -- * WAI interface
62 -- * WAI interface
61 , Request (..)
63 , Request (..)
@@ -308,6 +310,8 @@ statusMessage Status405 = B8.pack "Method Not Allowed"
308statusMessage Status500 = B8.pack "Internal Server Error"
310statusMessage Status500 = B8.pack "Internal Server Error"
309statusMessage (Status _ m) = m
311statusMessage (Status _ m) = m
313+data Source = forall a. Source a (a -> IO (Maybe (B.ByteString, a)))
311-- | An enumerator is a data producer. It takes two arguments: a function to
315-- | An enumerator is a data producer. It takes two arguments: a function to
312-- enumerate over (the iteratee) and an accumulating parameter. As the
316-- enumerate over (the iteratee) and an accumulating parameter. As the
313-- enumerator produces output, it calls the iteratee, thereby avoiding the need
317-- enumerator produces output, it calls the iteratee, thereby avoiding the need
@@ -363,7 +367,7 @@ data Request = Request
363 , serverPort :: Int
367 , serverPort :: Int
364 , requestHeaders :: [(RequestHeader, B.ByteString)]
368 , requestHeaders :: [(RequestHeader, B.ByteString)]
365 , urlScheme :: UrlScheme
369 , urlScheme :: UrlScheme
366− , requestBody :: Enumerator
370+ , requestBody :: Source
367 , errorHandler :: String -> IO ()
371 , errorHandler :: String -> IO ()
368 -- | The client\'s host information.
372 -- | The client\'s host information.
369 , remoteHost :: B.ByteString
373 , remoteHost :: B.ByteString