conduit 1.2 patch

This commit is contained in:
Michael Snoyman 2014-08-27 17:34:35 +03:00
parent 8b2297adf4
commit d3df218a96
2 changed files with 9 additions and 1 deletions

View File

@ -78,7 +78,7 @@ executable yesod
, fsnotify >= 0.0 && < 0.2 , fsnotify >= 0.0 && < 0.2
, split >= 0.2 && < 0.3 , split >= 0.2 && < 0.3
, file-embed , file-embed
, conduit >= 0.5 && < 1.2 , conduit >= 0.5 && < 1.3
, conduit-extra , conduit-extra
, resourcet >= 0.3 && < 1.2 , resourcet >= 0.3 && < 1.2
, base64-bytestring , base64-bytestring

View File

@ -63,6 +63,9 @@ import Text.Blaze.Html.Renderer.Utf8 (renderHtmlBuilder)
import Data.Conduit (Source, Flush (Chunk), ResumableSource, mapOutput) import Data.Conduit (Source, Flush (Chunk), ResumableSource, mapOutput)
import Control.Monad.Trans.Resource (ResourceT) import Control.Monad.Trans.Resource (ResourceT)
import Data.Conduit.Internal (ResumableSource (ResumableSource)) import Data.Conduit.Internal (ResumableSource (ResumableSource))
#if MIN_VERSION_conduit(1, 2, 0)
import qualified Data.Conduit.Internal as CI
#endif
import qualified Data.Aeson as J import qualified Data.Aeson as J
import Data.Aeson.Encode (fromValue) import Data.Aeson.Encode (fromValue)
@ -115,6 +118,11 @@ instance ToContent Css where
instance ToContent Javascript where instance ToContent Javascript where
toContent = toContent . toLazyText . unJavascript toContent = toContent . toLazyText . unJavascript
#if MIN_VERSION_conduit(1, 2, 0)
instance ToFlushBuilder builder => ToContent (CI.Pipe () () builder () (ResourceT IO) ()) where
toContent src = ContentSource $ CI.ConduitM (CI.mapOutput toFlushBuilder src >>=)
#endif
instance ToFlushBuilder builder => ToContent (Source (ResourceT IO) builder) where instance ToFlushBuilder builder => ToContent (Source (ResourceT IO) builder) where
toContent src = ContentSource $ mapOutput toFlushBuilder src toContent src = ContentSource $ mapOutput toFlushBuilder src
instance ToFlushBuilder builder => ToContent (ResumableSource (ResourceT IO) builder) where instance ToFlushBuilder builder => ToContent (ResumableSource (ResourceT IO) builder) where