conduit 1.1

This commit is contained in:
Michael Snoyman 2014-03-27 16:38:52 +02:00
parent 3f1fe6e1c0
commit d764464152
19 changed files with 91 additions and 43 deletions

View File

@ -1,5 +1,5 @@
name: yesod-auth
version: 1.3.0.1
version: 1.3.0.2
license: MIT
license-file: LICENSE
author: Michael Snoyman, Patrick Brisbin
@ -31,9 +31,10 @@ library
, text >= 0.7
, mime-mail >= 0.3
, yesod-persistent >= 1.2
, hamlet >= 1.1 && < 1.2
, shakespeare-css >= 1.0 && < 1.1
, shakespeare-js >= 1.0.2 && < 1.3
, hamlet >= 1.1
, shakespeare
, shakespeare-css >= 1.0
, shakespeare-js >= 1.0.2
, containers
, unordered-containers
, yesod-form >= 1.3 && < 1.4

View File

@ -64,8 +64,7 @@ import GhcBuild (buildPackage,
getBuildFlags, getPackageArgs)
import qualified Config as GHC
import Data.Conduit.Network (HostPreference (HostIPv4),
bindPort)
import Data.Streaming.Network (bindPortTCP)
import Network (withSocketsDo)
#if MIN_VERSION_http_conduit(2, 0, 0)
import Network.HTTP.Conduit (conduitManagerSettings, newManager)
@ -171,7 +170,7 @@ reverseProxy opts iappPort = do
checkPort :: Int -> IO Bool
checkPort p = do
es <- Ex.try $ bindPort p HostIPv4
es <- Ex.try $ bindPortTCP p "*4"
case es of
Left (_ :: Ex.IOException) -> return False
Right s -> do

View File

@ -2,7 +2,8 @@
module HsFile (mkHsFile) where
import Text.ProjectTemplate (createTemplate)
import Data.Conduit
( ($$), (=$), runResourceT, ResourceT, ConduitM, awaitForever, yield, Source )
( ($$), (=$), ConduitM, awaitForever, yield, Source )
import Control.Monad.Trans.Resource (ResourceT, runResourceT)
import qualified Data.Conduit.List as CL
import Prelude hiding (FilePath)
import Filesystem.Path ( FilePath )

View File

@ -4,7 +4,8 @@ module Scaffolding.Scaffolder (scaffold) where
import Control.Arrow ((&&&))
import qualified Data.ByteString.Char8 as S
import Data.Conduit (runResourceT, yield, ($$), ($$+-))
import Data.Conduit (yield, ($$), ($$+-))
import Control.Monad.Trans.Resource (runResourceT)
import Data.FileEmbed (embedFile)
import Data.String (fromString)
import qualified Data.Text as T

View File

@ -1,5 +1,5 @@
name: yesod-bin
version: 1.2.7.3
version: 1.2.7.4
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
@ -51,10 +51,11 @@ executable yesod
, ghc-paths >= 0.1
, parsec >= 2.1 && < 4
, text >= 0.11
, shakespeare-text >= 1.0 && < 1.1
, shakespeare >= 1.0.2 && < 1.3
, shakespeare-js >= 1.0.2 && < 1.3
, shakespeare-css >= 1.0.2 && < 1.1
, shakespeare
, shakespeare-text >= 1.0
, shakespeare >= 1.0.2 && < 2.1
, shakespeare-js >= 1.0.2
, shakespeare-css >= 1.0.2
, bytestring >= 0.9.1.4
, time >= 1.1.4
, template-haskell
@ -77,8 +78,9 @@ executable yesod
, fsnotify >= 0.0 && < 0.1
, split >= 0.2 && < 0.3
, file-embed
, conduit >= 0.5 && < 1.1
, resourcet >= 0.3 && < 0.5
, conduit >= 0.5 && < 1.2
, conduit-extra
, resourcet >= 0.3 && < 1.2
, base64-bytestring
, lifted-base
, http-reverse-proxy >= 0.1.1
@ -90,6 +92,7 @@ executable yesod
, warp >= 1.3.7.5
, wai >= 1.4
, data-default-class
, streaming-commons
ghc-options: -Wall -threaded
main-is: main.hs

View File

@ -61,7 +61,9 @@ GOX(Monoid w, RWST r w s)
GOX(Monoid w, Strict.RWST r w s)
GO(Strict.StateT s)
GOX(Monoid w, Strict.WriterT w)
#if !MIN_VERSION_resourcet(1,1,0)
GO(ExceptionT)
#endif
GO(Pipe l i o u)
GO(ConduitM i o)
#undef GO
@ -85,7 +87,9 @@ GOX(Monoid w, RWST r w s)
GOX(Monoid w, Strict.RWST r w s)
GO(Strict.StateT s)
GOX(Monoid w, Strict.WriterT w)
#if !MIN_VERSION_resourcet(1,1,0)
GO(ExceptionT)
#endif
GO(Pipe l i o u)
GO(ConduitM i o)
#undef GO

View File

@ -60,7 +60,8 @@ import Data.Monoid (mempty)
import Text.Hamlet (Html)
import Text.Blaze.Html.Renderer.Utf8 (renderHtmlBuilder)
import Data.Conduit (Source, ResourceT, Flush (Chunk), ResumableSource, mapOutput)
import Data.Conduit (Source, Flush (Chunk), ResumableSource, mapOutput)
import Control.Monad.Trans.Resource (ResourceT)
import Data.Conduit.Internal (ResumableSource (ResumableSource))
import qualified Data.Aeson as J

View File

@ -40,6 +40,7 @@ import Data.Conduit.List (sourceList)
import Data.Conduit.Binary (sourceFile, sinkFile)
import Data.Word (Word64)
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Trans.Resource (runResourceT, ResourceT)
import Control.Exception (throwIO)
import Yesod.Core.Types
import qualified Data.Map as Map

View File

@ -1,4 +1,5 @@
{-# LANGUAGE TypeSynonymInstances, OverloadedStrings #-}
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Yesod.Core.Json
( -- * Convert from a JSON value
@ -28,6 +29,7 @@ module Yesod.Core.Json
import Yesod.Core.Handler (HandlerT, getRequest, invalidArgs, redirect, selectRep, provideRep, rawRequestBody, ProvidedRep)
import Control.Monad.Trans.Writer (Writer)
import Control.Monad.Trans.Resource (runExceptionT)
import Data.Monoid (Endo)
import Yesod.Core.Content (TypedContent)
import Yesod.Core.Types (reqAccept)
@ -42,6 +44,7 @@ import Data.Conduit.Attoparsec (sinkParser)
import Data.Text (pack)
import qualified Data.Vector as V
import Data.Conduit
import Data.Conduit.Lift
import qualified Data.ByteString.Char8 as B8
import Data.Maybe (listToMaybe)
import Control.Monad (liftM)
@ -92,7 +95,11 @@ provideJson = provideRep . return . J.toJSON
-- /Since: 0.3.0/
parseJsonBody :: (MonadHandler m, J.FromJSON a) => m (J.Result a)
parseJsonBody = do
#if MIN_VERSION_resourcet(1,1,0)
eValue <- rawRequestBody $$ runCatchC (sinkParser JP.value')
#else
eValue <- runExceptionT $ rawRequestBody $$ sinkParser JP.value'
#endif
return $ case eValue of
Left e -> J.Error $ show e
Right value -> J.fromJSON value

View File

@ -20,12 +20,13 @@ import Control.Monad.IO.Class (MonadIO (liftIO))
import Control.Monad.Logger (LogLevel, LogSource,
MonadLogger (..))
import Control.Monad.Trans.Control (MonadBaseControl (..))
import Control.Monad.Trans.Resource (MonadResource (..), InternalState, runInternalState)
import Control.Monad.Trans.Resource (MonadResource (..), InternalState, runInternalState, MonadThrow (..), monadThrow, ResourceT)
#if !MIN_VERSION_resourcet(1,1,0)
import Control.Monad.Trans.Resource (MonadUnsafeIO (..))
#endif
import Data.ByteString (ByteString)
import qualified Data.ByteString.Lazy as L
import Data.Conduit (Flush, MonadThrow (..),
MonadUnsafeIO (..),
ResourceT, Source)
import Data.Conduit (Flush, Source)
import Data.Dynamic (Dynamic)
import Data.IORef (IORef)
import Data.Map (Map, unionWith)
@ -394,8 +395,17 @@ instance MonadBaseControl b m => MonadBaseControl b (WidgetT site m) where
instance MonadTrans (WidgetT site) where
lift = WidgetT . const . liftM (, mempty)
instance MonadThrow m => MonadThrow (WidgetT site m) where
#if MIN_VERSION_resourcet(1,1,0)
throwM = lift . throwM
#else
monadThrow = lift . monadThrow
#endif
#if MIN_VERSION_resourcet(1,1,0)
instance (Applicative m, MonadIO m, MonadBase IO m, MonadThrow m) => MonadResource (WidgetT site m) where
#else
instance (Applicative m, MonadIO m, MonadUnsafeIO m, MonadThrow m) => MonadResource (WidgetT site m) where
#endif
liftResourceT f = WidgetT $ \hd -> liftIO $ fmap (, mempty) $ runInternalState f (handlerResource hd)
instance MonadIO m => MonadLogger (WidgetT site m) where
@ -434,8 +444,17 @@ instance MonadBaseControl b m => MonadBaseControl b (HandlerT site m) where
restoreM (StH base) = HandlerT $ const $ restoreM base
instance MonadThrow m => MonadThrow (HandlerT site m) where
#if MIN_VERSION_resourcet(1,1,0)
throwM = lift . monadThrow
#else
monadThrow = lift . monadThrow
#endif
#if MIN_VERSION_resourcet(1,1,0)
instance (MonadIO m, MonadBase IO m, MonadThrow m) => MonadResource (HandlerT site m) where
#else
instance (MonadIO m, MonadUnsafeIO m, MonadThrow m) => MonadResource (HandlerT site m) where
#endif
liftResourceT f = HandlerT $ \hd -> liftIO $ runInternalState f (handlerResource hd)
instance MonadIO m => MonadLogger (HandlerT site m) where

View File

@ -19,6 +19,7 @@ import Control.Concurrent (threadDelay)
import Control.Concurrent.Async (withAsync)
import Control.Monad.Trans.Resource (register)
import Data.IORef
import Data.Streaming.Network (bindPortTCP)
data App = App
@ -42,7 +43,7 @@ getFreePort = do
loop 43124
where
loop port = do
esocket <- try $ bindPort port "*"
esocket <- try $ bindPortTCP port "*"
case esocket of
Left (_ :: IOException) -> loop (succ port)
Right socket -> do

View File

@ -1,5 +1,5 @@
name: yesod-core
version: 1.2.9.1
version: 1.2.9.2
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
@ -32,11 +32,11 @@ library
, text >= 0.7
, template-haskell
, path-pieces >= 0.1.2 && < 0.2
, hamlet >= 1.1 && < 1.2
, shakespeare >= 1.0 && < 1.3
, shakespeare-js >= 1.0.2 && < 1.3
, shakespeare-css >= 1.0 && < 1.1
, shakespeare-i18n >= 1.0 && < 1.1
, hamlet >= 1.1
, shakespeare >= 1.0 && < 2.1
, shakespeare-js >= 1.0.2
, shakespeare-css >= 1.0
, shakespeare-i18n >= 1.0
, blaze-builder >= 0.2.1.4 && < 0.4
, transformers >= 0.2.2 && < 0.4
, clientsession >= 0.9 && < 0.10
@ -57,7 +57,7 @@ library
, wai-logger >= 0.2
, monad-logger >= 0.3.1 && < 0.4
, conduit >= 0.5
, resourcet >= 0.4.9 && < 0.5
, resourcet >= 0.4.9 && < 1.2
, lifted-base >= 0.1.2
, attoparsec-conduit
, blaze-html >= 0.5
@ -66,6 +66,7 @@ library
, safe
, warp >= 1.3.8
, unix-compat
, conduit-extra
exposed-modules: Yesod.Core
Yesod.Core.Content
@ -124,6 +125,9 @@ test-suite tests
, network-conduit
, network
, async
, conduit-extra
, shakespeare
, streaming-commons
ghc-options: -Wall
extensions: TemplateHaskell

View File

@ -1,5 +1,5 @@
name: yesod-eventsource
version: 1.1.0.1
version: 1.1.0.2
license: MIT
license-file: LICENSE
author: Felipe Lessa <felipe.lessa@gmail.com>
@ -29,7 +29,7 @@ description:
library
build-depends: base >= 4 && < 5
, yesod-core == 1.2.*
, conduit >= 0.5 && < 1.1
, conduit >= 0.5 && < 1.2
, wai >= 1.3
, wai-eventsource >= 1.3
, blaze-builder

View File

@ -1,5 +1,5 @@
name: yesod-form
version: 1.3.8
version: 1.3.8.1
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
@ -17,9 +17,10 @@ library
, yesod-core >= 1.2 && < 1.3
, yesod-persistent >= 1.2 && < 1.3
, time >= 1.1.4
, hamlet >= 1.1 && < 1.2
, shakespeare-css >= 1.0 && < 1.1
, shakespeare-js >= 1.0.2 && < 1.3
, hamlet >= 1.1
, shakespeare
, shakespeare-css >= 1.0
, shakespeare-js >= 1.0.2
, persistent >= 1.2 && < 1.4
, template-haskell
, transformers >= 0.2.2

View File

@ -1,5 +1,5 @@
name: yesod-newsfeed
version: 1.2.0.1
version: 1.2.0.2
license: MIT
license-file: LICENSE
author: Michael Snoyman, Patrick Brisbin
@ -16,7 +16,8 @@ library
build-depends: base >= 4 && < 5
, yesod-core >= 1.2 && < 1.3
, time >= 1.1.4
, hamlet >= 1.1 && < 1.2
, hamlet >= 1.1
, shakespeare
, bytestring >= 0.9.1.4
, text >= 0.9
, xml-conduit >= 1.0

View File

@ -66,6 +66,7 @@ import System.Directory
import Control.Monad
import Data.FileEmbed (embedDir)
import Control.Monad.Trans.Resource (runResourceT)
import Yesod.Core
import Yesod.Core.Types

View File

@ -41,6 +41,7 @@ library
, http-types >= 0.7
, unix-compat >= 0.2
, conduit >= 0.5
, conduit-extra
, cryptohash-conduit >= 0.1
, cryptohash >= 0.11
, system-filepath >= 0.4.6 && < 0.5
@ -101,12 +102,12 @@ test-suite tests
, shakespeare-css
, mime-types
, hjsmin
, process-conduit
, filepath
, resourcet
, unordered-containers
, async
, process
, conduit-extra
ghc-options: -Wall -threaded
extensions: TemplateHaskell

View File

@ -1,5 +1,5 @@
name: yesod-test
version: 1.2.1.1
version: 1.2.1.2
license: MIT
license-file: LICENSE
author: Nubis <nubis@woobiz.com.ar>

View File

@ -1,5 +1,5 @@
name: yesod
version: 1.2.5.1
version: 1.2.5.2
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
@ -30,9 +30,9 @@ library
, transformers >= 0.2.2 && < 0.4
, wai >= 1.3
, wai-extra >= 1.3
, hamlet >= 1.1 && < 1.2
, shakespeare-js >= 1.0.2 && < 1.3
, shakespeare-css >= 1.0 && < 1.1
, hamlet >= 1.1
, shakespeare-js >= 1.0.2
, shakespeare-css >= 1.0
, warp >= 1.3
, blaze-html >= 0.5
, blaze-markup >= 0.5.1
@ -48,6 +48,8 @@ library
, bytestring
, monad-logger
, fast-logger
, conduit-extra
, shakespeare
exposed-modules: Yesod
, Yesod.Default.Config