Generalized sendChunk* functions

This commit is contained in:
Michael Snoyman 2013-03-27 09:46:10 +02:00
parent cb49b684bd
commit 6d98103115

View File

@ -948,42 +948,42 @@ respondSource ctype src = HandlerT $ \hd ->
-- on most datatypes, such as @ByteString@ and @Html@. -- on most datatypes, such as @ByteString@ and @Html@.
-- --
-- Since 1.2.0 -- Since 1.2.0
sendChunk :: ToFlushBuilder a => a -> Producer (HandlerT site IO) (Flush Builder) sendChunk :: Monad m => ToFlushBuilder a => a -> Producer m (Flush Builder)
sendChunk = yield . toFlushBuilder sendChunk = yield . toFlushBuilder
-- | In a streaming response, send a flush command, causing all buffered data -- | In a streaming response, send a flush command, causing all buffered data
-- to be immediately sent to the client. -- to be immediately sent to the client.
-- --
-- Since 1.2.0 -- Since 1.2.0
sendFlush :: Producer (HandlerT site IO) (Flush Builder) sendFlush :: Monad m => Producer m (Flush Builder)
sendFlush = yield Flush sendFlush = yield Flush
-- | Type-specialized version of 'sendChunk' for strict @ByteString@s. -- | Type-specialized version of 'sendChunk' for strict @ByteString@s.
-- --
-- Since 1.2.0 -- Since 1.2.0
sendChunkBS :: S.ByteString -> Producer (HandlerT site IO) (Flush Builder) sendChunkBS :: Monad m => S.ByteString -> Producer m (Flush Builder)
sendChunkBS = sendChunk sendChunkBS = sendChunk
-- | Type-specialized version of 'sendChunk' for lazy @ByteString@s. -- | Type-specialized version of 'sendChunk' for lazy @ByteString@s.
-- --
-- Since 1.2.0 -- Since 1.2.0
sendChunkLBS :: L.ByteString -> Producer (HandlerT site IO) (Flush Builder) sendChunkLBS :: Monad m => L.ByteString -> Producer m (Flush Builder)
sendChunkLBS = sendChunk sendChunkLBS = sendChunk
-- | Type-specialized version of 'sendChunk' for strict @Text@s. -- | Type-specialized version of 'sendChunk' for strict @Text@s.
-- --
-- Since 1.2.0 -- Since 1.2.0
sendChunkText :: T.Text -> Producer (HandlerT site IO) (Flush Builder) sendChunkText :: Monad m => T.Text -> Producer m (Flush Builder)
sendChunkText = sendChunk sendChunkText = sendChunk
-- | Type-specialized version of 'sendChunk' for lazy @Text@s. -- | Type-specialized version of 'sendChunk' for lazy @Text@s.
-- --
-- Since 1.2.0 -- Since 1.2.0
sendChunkLazyText :: TL.Text -> Producer (HandlerT site IO) (Flush Builder) sendChunkLazyText :: Monad m => TL.Text -> Producer m (Flush Builder)
sendChunkLazyText = sendChunk sendChunkLazyText = sendChunk
-- | Type-specialized version of 'sendChunk' for @Html@s. -- | Type-specialized version of 'sendChunk' for @Html@s.
-- --
-- Since 1.2.0 -- Since 1.2.0
sendChunkHtml :: Html -> Producer (HandlerT site IO) (Flush Builder) sendChunkHtml :: Monad m => Html -> Producer m (Flush Builder)
sendChunkHtml = sendChunk sendChunkHtml = sendChunk