packages feed

conduit 0.1.1 → 0.1.1.1

raw patch · 3 files changed

+36/−9 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Control.Monad.Trans.Resource: class Monad m => HasRef m where { type family Ref m :: * -> *; { atomicModifyRef' sa f = do { a0 <- readRef' sa; let (a, b) = f a0; writeRef' sa a; return b } mask f = f id mask_ = mask . const try = liftM Right } }
+ Control.Monad.Trans.Resource: class Monad m => HasRef m where type family Ref m :: * -> * atomicModifyRef' sa f = do { a0 <- readRef' sa; let (a, b) = f a0; writeRef' sa a; return b } mask f = f id mask_ = mask . const try = liftM Right
- Control.Monad.Trans.Resource: class (HasRef (Base m), Monad m) => Resource m where { type family Base m :: * -> *; }
+ Control.Monad.Trans.Resource: class (HasRef (Base m), Monad m) => Resource m where type family Base m :: * -> *
- Control.Monad.Trans.Resource: transResourceT :: (Base m) ~ (Base n) => (m a -> n a) -> ResourceT m a -> ResourceT n a
+ Control.Monad.Trans.Resource: transResourceT :: Base m ~ Base n => (m a -> n a) -> ResourceT m a -> ResourceT n a
- Data.Conduit: class (HasRef (Base m), Monad m) => Resource m where { type family Base m :: * -> *; }
+ Data.Conduit: class (HasRef (Base m), Monad m) => Resource m where type family Base m :: * -> *
- Data.Conduit: transConduit :: (Monad m, (Base m) ~ (Base n)) => (forall a. m a -> n a) -> Conduit input m output -> Conduit input n output
+ Data.Conduit: transConduit :: (Monad m, Base m ~ Base n) => (forall a. m a -> n a) -> Conduit input m output -> Conduit input n output
- Data.Conduit: transSink :: ((Base m) ~ (Base n), Monad m) => (forall a. m a -> n a) -> Sink input m output -> Sink input n output
+ Data.Conduit: transSink :: (Base m ~ Base n, Monad m) => (forall a. m a -> n a) -> Sink input m output -> Sink input n output
- Data.Conduit: transSource :: ((Base m) ~ (Base n), Monad m) => (forall a. m a -> n a) -> Source m output -> Source n output
+ Data.Conduit: transSource :: (Base m ~ Base n, Monad m) => (forall a. m a -> n a) -> Source m output -> Source n output

Files

Data/Conduit.hs view
@@ -176,11 +176,14 @@                                         writeRef istate $ FLClosed xs                                         return $ Open x     close istate src c = do-        -- Invariant: sourceClose cannot be called twice, so we will assume-        -- it is currently open. We could add a sanity check here.-        writeRef istate $ FLClosed []-        _ignored <- conduitClose c-        sourceClose src+        -- See comment on bufferedFuseLeft for why we need to have the+        -- following check+        state <- readRef istate+        case state of+            FLClosed _ -> return ()+            FLOpen _ -> do+                _ignored <- conduitClose c+                sourceClose src  infixr 0 =$ @@ -439,9 +442,17 @@                                         writeRef istate $ FLClosed xs                                         return $ Open x     close istate c = do-        writeRef istate $ FLClosed []-        _ignored <- conduitClose c-        return ()+        -- Normally we don't have to worry about double closing, as the+        -- invariant of a source is that close is never called twice. However,+        -- here, if the Conduit returned Finished with some data, the overall+        -- Source will return an Open while the Conduit will be Closed.+        -- Therefore, we have to do a check.+        state <- readRef istate+        case state of+            FLClosed _ -> return ()+            FLOpen _ -> do+                _ignored <- conduitClose c+                return ()  bsourcePull :: Resource m => BufferedSource m a -> ResourceT m (SourceResult a) bsourcePull (BufferedSource src bufRef) = do
conduit.cabal view
@@ -1,5 +1,5 @@ Name:                conduit-Version:             0.1.1+Version:             0.1.1.1 Synopsis:            Streaming data processing library. Description: 	Conduits are an approach to the streaming data problem. It is meant as an alternative to enumerators\/iterators, hoping to address the same issues with different trade-offs based on real-world experience with enumerators. For more information, see <http://www.yesodweb.com/book/conduit>.@@ -20,6 +20,8 @@ extra-source-files:  test/main.hs, test/random  flag debug+    default: True+    description: Turn on some runtime check to ensure invariants are respected.  flag nohandles 
test/main.hs view
@@ -386,5 +386,19 @@         a @?= "abcdefg"         b @?= [] +    describe "normalFuseLeft" $ do+        it "does not double close conduit" $ do+            x <- runResourceT $ do+                let src = CL.sourceList ["foobarbazbin"]+                src C.$= CB.isolate 10 C.$$ CL.head+            x @?= Just "foobarbazb"++    describe "bufferedFuseLeft" $ do+        it "does not double close conduit" $ do+            x <- runResourceT $ do+                bsrc <- C.bufferSource $ CL.sourceList ["foobarbazbin"]+                bsrc C.$= CB.isolate 10 C.$$ CL.head+            x @?= Just "foobarbazb"+ it' :: String -> IO () -> Writer [Spec] () it' = it