iteratee 0.8.7.4 → 0.8.7.5
raw patch · 3 files changed
+27/−11 lines, 3 filesdep +HUnitdep +test-framework-hunitPVP ok
version bump matches the API change (PVP)
Dependencies added: HUnit, test-framework-hunit
API changes (from Hackage documentation)
Files
- iteratee.cabal +4/−2
- src/Data/Iteratee/ListLike.hs +5/−9
- tests/testIteratee.hs +18/−0
iteratee.cabal view
@@ -1,5 +1,5 @@ name: iteratee-version: 0.8.7.4+version: 0.8.7.5 synopsis: Iteratee-based I/O description: The Iteratee monad provides strict, safe, and functional I/O. In addition@@ -92,10 +92,12 @@ if flag(buildTests) build-depends: base >= 3 && < 6,+ HUnit == 1.2.* , mtl >= 2 && < 3, QuickCheck >= 2 && < 3, test-framework >= 0.3 && < 0.5,- test-framework-quickcheck2 >= 0.2 && < 0.3+ test-framework-quickcheck2 >= 0.2 && < 0.3,+ test-framework-hunit >= 0.2 && < 0.3 else buildable: False
src/Data/Iteratee/ListLike.hs view
@@ -70,11 +70,11 @@ import qualified Prelude as Prelude +import Data.List (partition) import qualified Data.ListLike as LL import qualified Data.ListLike.FoldableLL as FLL import Data.Iteratee.Iteratee import Data.Monoid-import Data.Maybe (catMaybes) import Control.Applicative ((<$>), (<*>), (<*)) import Control.Monad (liftM, liftM2, mplus, (<=<)) import Control.Monad.Trans.Class@@ -930,19 +930,15 @@ -- give a chunk to each iteratee is' <- lift $ mapM (enumChunk s) is -- filter done iteratees- is'' <- lift $ catMaybes `liftM` mapM checkIfDone is'- if Prelude.null is''- then idone () <=< remainingStream $ is'- else self is''+ (done, notDone) <- lift $ partition fst `liftM` mapM enumCheckIfDone is'+ if Prelude.null notDone+ then idone () <=< remainingStream $ map snd done+ else self $ map snd notDone step s@(EOF _) = do s' <- remainingStream <=< lift $ mapM (enumChunk s) is case s' of EOF (Just e) -> throwErr e _ -> idone () s'-- checkIfDone i = runIter i- (\_ _ -> return Nothing)- (\k e -> return $ Just $ icont k e) -- returns the unconsumed part of the stream; "sequence_ is" consumes as -- much of the stream as the iteratee in is that consumes the most; e.g.
tests/testIteratee.hs view
@@ -7,7 +7,9 @@ import Test.Framework (defaultMain, testGroup) import Test.Framework.Providers.QuickCheck2 (testProperty)+import Test.Framework.Providers.HUnit (testCase) +import Test.HUnit import Test.QuickCheck import Data.Iteratee hiding (head, break)@@ -411,6 +413,21 @@ where types = (i1 :: I, i2 :: I, xs :: [Int]) -- ---------------------------------------------+-- Sequences++test_sequence_ =+ assertEqual "sequence_: no duplicate runs" ((),[4,5])+ (runWriter (Iter.enumList [[4],[5::Int]] (Iter.sequence_ [iter])+ >>= run))+ where+ iter = do+ x <- Iter.head+ lift $ tell [x]+ y <- Iter.head+ lift $ tell [y]+++-- --------------------------------------------- -- Data.Iteratee.Char {-@@ -509,6 +526,7 @@ ] ,testGroup "Zips" [ testProperty "zip" prop_zip+ ,testCase "sequence_" test_sequence_ ] ,testGroup "Data.Iteratee.Char" [ --testProperty "line" prop_line