iteratee 0.8.1.1 → 0.8.1.2
raw patch · 4 files changed
+23/−20 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- iteratee.cabal +1/−1
- src/Data/Iteratee/ListLike.hs +3/−1
- tests/foo.hs +9/−18
- tests/testIteratee.hs +10/−0
iteratee.cabal view
@@ -1,5 +1,5 @@ name: iteratee-version: 0.8.1.1+version: 0.8.1.2 synopsis: Iteratee-based I/O description: The Iteratee monad provides strict, safe, and functional I/O. In addition
src/Data/Iteratee/ListLike.hs view
@@ -155,7 +155,9 @@ step l (Chunk xs) | nullC xs = liftI (step l) | otherwise = liftI $ step (Just $ LL.last xs)- step l s@(EOF _) = maybe (icont (step l) . Just . setEOF $ s) return l+ step l s@(EOF _) = case l of+ Nothing -> icont (step l) . Just . setEOF $ s+ Just x -> idone x s {-# INLINE last #-}
tests/foo.hs view
@@ -1,20 +1,11 @@-import Data.ByteString (ByteString)-import Data.Iteratee as I-import Data.Iteratee.Char-import System--main = do- args <- getArgs- let fname = args !! 0- let blockSize = read $ args !! 1-- fileDriver (leak blockSize) fname >>= print+import Control.Monad.Trans (liftIO)+import Data.Iteratee.Iteratee+import qualified Data.Iteratee.ListLike as I -leak :: Int -> Iteratee ByteString IO ()-leak blockSize = chunkedRead- where- consChunk :: Iteratee ByteString IO String- consChunk = (joinI $ I.take blockSize I.length) >>= return . show+main = enumPure1Chunk [1..10] myIter >>= run - chunkedRead :: Iteratee ByteString IO ()- chunkedRead = joinI $ convStream consChunk printLinesUnterminated+myIter :: Iteratee [Int] IO ()+myIter = do+ I.last+ x <- I.peek+ liftIO $ print x
tests/testIteratee.hs view
@@ -124,6 +124,14 @@ prop_skip xs = runner1 (enumPure1Chunk xs (skipToEof >> stream2list)) == [] where types = xs :: [Int] +prop_last1 xs = P.length xs > 0 ==>+ runner1 (enumPure1Chunk xs (Iter.last)) == P.last xs+ where types = xs :: [Int]++prop_last2 xs = P.length xs > 0 ==>+ runner1 (enumPure1Chunk xs (Iter.last >> Iter.peek)) == Nothing+ where types = xs :: [Int]+ -- --------------------------------------------- -- Simple enumerator tests @@ -274,6 +282,8 @@ ,testProperty "null heads" prop_heads2 ,testProperty "peek" prop_peek ,testProperty "peek2" prop_peek2+ ,testProperty "last" prop_last1+ ,testProperty "last ends properly" prop_last2 ,testProperty "skipToEof" prop_skip ,testProperty "iteratee Functor 1" prop_iterFmap ,testProperty "iteratee Functor 2" prop_iterFmap2