This commit is contained in:
Michael Snoyman 2013-03-22 10:33:33 +02:00
parent 8ab09931c4
commit f3b459e9ce

View File

@ -53,7 +53,9 @@ module Yesod.Core.Handler
, lookupPostParams , lookupPostParams
, lookupCookies , lookupCookies
, lookupFiles , lookupFiles
-- * Special responses -- * Responses
-- ** Pure
, respond
-- ** Streaming -- ** Streaming
, respondSource , respondSource
, sendChunk , sendChunk
@ -915,6 +917,14 @@ rawRequestBody = do
fileSource :: MonadResource m => FileInfo -> Source m S.ByteString fileSource :: MonadResource m => FileInfo -> Source m S.ByteString
fileSource = transPipe liftResourceT . fileSourceRaw fileSource = transPipe liftResourceT . fileSourceRaw
-- | Provide a pure value for the response body.
--
-- > respond ct = return . TypedContent ct . toContent
--
-- Since 1.2.0
respond :: (Monad m, ToContent a) => ContentType -> a -> m TypedContent
respond ct = return . TypedContent ct . toContent
-- | Use a @Source@ for the response body. -- | Use a @Source@ for the response body.
-- --
-- Note that, for ease of use, the underlying monad is a @HandlerT@. This -- Note that, for ease of use, the underlying monad is a @HandlerT@. This