@@ -20,6 +20,8 @@ module Streamly.Test.Prelude.Common
20 , constructWithIterateM
20 , constructWithIterateM
21 , constructWithFromIndices
21 , constructWithFromIndices
22 , constructWithFromIndicesM
22 , constructWithFromIndicesM
23 -- * Applicative operations
25 -- * Applicative operations
24 , applicativeOps
26 , applicativeOps
25 , applicativeOps1
27 , applicativeOps1
@@ -251,6 +253,39 @@ constructWithFromIndicesM op len =
251 streamEffect <- run $ readIORef mvl
253 streamEffect <- run $ readIORef mvl
252 listEquals (==) streamEffect list
254 listEquals (==) streamEffect list
258+ => (Int -> t IO Int -> t IO Int)
259+ -> (t IO Int -> SerialT IO Int)
262+constructWithCons cons op len =
263+ withMaxSuccess maxTestCount $
267+ S.toList . op . S.take (fromIntegral len) $
268+ foldr cons S.nil (repeat 0)
269+ let list = replicate (fromIntegral len) 0
270+ listEquals (==) strm list
272+constructWithConsM ::
274+ => (IO Int -> t IO Int -> t IO Int)
276+ -> (t IO Int -> SerialT IO Int)
279+constructWithConsM consM listT op len =
280+ withMaxSuccess maxTestCount $
284+ S.toList . op . S.take (fromIntegral len) $
285+ foldr consM S.nil (repeat (return 0))
286+ let list = replicate (fromIntegral len) 0
287+ listEquals (==) (listT strm) list
254-------------------------------------------------------------------------------
289-------------------------------------------------------------------------------
255-- Applicative operations
290-- Applicative operations
256-------------------------------------------------------------------------------
291-------------------------------------------------------------------------------