@@ -20,6 +20,7 @@ import Foreign.Storable (Storable)
20#if __GLASGOW_HASKELL__ < 808
20#if __GLASGOW_HASKELL__ < 808
21import Data.Semigroup ((<>))
21import Data.Semigroup ((<>))
23+import Data.Semigroup (Sum(..), getSum)
23import Test.Hspec.QuickCheck
24import Test.Hspec.QuickCheck
24import Test.QuickCheck
25import Test.QuickCheck
@@ -43,7 +44,7 @@ import Streamly.Prelude (SerialT, IsStream, serial, serially)
43import Streamly.Prelude (avgRate, maxBuffer)
44import Streamly.Prelude (avgRate, maxBuffer)
45import qualified Streamly.Prelude as S
46import qualified Streamly.Prelude as S
46−import qualified Streamly.Data.Fold as FL
47+import qualified Streamly.Internal.Data.Fold as FL
47import qualified Streamly.Internal.Data.Unfold as UF
48import qualified Streamly.Internal.Data.Unfold as UF
48import qualified Streamly.Internal.Data.Stream.IsStream as IS
49import qualified Streamly.Internal.Data.Stream.IsStream as IS
49import qualified Streamly.Data.Array.Foreign as A
50import qualified Streamly.Data.Array.Foreign as A
@@ -485,6 +486,22 @@ testFromCallback = do
485 threadDelay 100000
486 threadDelay 100000
486 return Nothing
487 return Nothing
489+foldIterateM :: Property
491+ forAll (listOf (chooseInt (0, max_length))) $ \lst -> monadicIO $ do
492+ let s1 = Prelude.sum lst
493+ strm = S.fromList lst
498+ (return . FL.take 1 . FL.sconcat)
502+ Nothing -> assert $ s1 == 0
503+ Just s2 -> assert $ s1 == s2
488main :: IO ()
505main :: IO ()
489main = hspec
506main = hspec
490 $ H.parallel
507 $ H.parallel
@@ -651,3 +668,6 @@ main = hspec
651 describe "Composed MonadThrow serially" $ composeWithMonadThrow serially
668 describe "Composed MonadThrow serially" $ composeWithMonadThrow serially
653 it "fromCallback" $ testFromCallback `shouldReturn` (50*101)
670 it "fromCallback" $ testFromCallback `shouldReturn` (50*101)
672+ describe "Nesting" $ do
673+ prop "foldIterateM" foldIterateM