@@ -311,19 +311,14 @@ statusMessage Status405 = B8.pack "Method Not Allowed"
311311statusMessage Status500 = B8.pack "Internal Server Error"
312312statusMessage (Status _ m) = m
313313
314−-- | This is a source for 'B.ByteString's. It is composed of two pieces: a
315−-- state variable, and a function to produce the output. The type of the state
316−-- variable is completely unknown to the user; some examples might be an 'Int'
317−-- for the remaining length of the content, or a list of 'B.ByteString's from
318−-- which to generate content.
314+-- | This is a source for 'B.ByteString's. It is a function (wrapped in a
315+-- newtype) that will return Nothing if the data has been completely consumed,
316+-- or return the next 'B.ByteString' from the source along with a new 'Source'
317+-- to continue reading from.
319318--
320−-- The function accepts that state variable as its first argument. If input has
321−-- been fully consumed, it returns 'Nothing'; otherwise, it returns the next
322−-- piece of data and the next state.
323−--
324−-- Be certain not to reuse a state variable! It might work fine with some
319+-- Be certain not to reuse a 'Source'! It might work fine with some
325320-- implementations of 'Source', while causing bugs with others.
326−data Source = forall a. Source a (a -> IO (Maybe (B.ByteString, a)))
321+newtype Source = Source { runSource :: IO (Maybe (B.ByteString, Source)) }
327322
328323-- | An enumerator is a data producer. It takes two arguments: a function to
329324-- enumerate over (the iteratee) and an accumulating parameter. As the