From dfecce27eb845d78d2c4f2891ecb6e5baf125c0e Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Thu, 24 May 2018 17:35:18 +0530 Subject: [PATCH] Fix build for ghc-7.10 and 8.0 --- stack-8.0.yaml | 1 + streamly.cabal | 1 + test/Prop.hs | 18 +++++++++--------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/stack-8.0.yaml b/stack-8.0.yaml index 04c3d2d51..aed11c19b 100644 --- a/stack-8.0.yaml +++ b/stack-8.0.yaml @@ -2,6 +2,7 @@ resolver: lts-9.20 packages: - '.' extra-deps: + - QuickCheck-2.10 - lockfree-queue-0.2.3.1 - simple-conduit-0.6.0 - SDL-0.6.5.1 diff --git a/streamly.cabal b/streamly.cabal index e07bd69b7..b5f90f8e7 100644 --- a/streamly.cabal +++ b/streamly.cabal @@ -64,6 +64,7 @@ extra-source-files: README.md bench.sh stack-7.10.yaml + stack-8.0.yaml stack.yaml source-repository head diff --git a/test/Prop.hs b/test/Prop.hs index cc78f0fd7..285972527 100644 --- a/test/Prop.hs +++ b/test/Prop.hs @@ -7,7 +7,6 @@ import Control.Monad (when) import Control.Applicative (ZipList(..)) import Control.Concurrent (MVar, takeMVar, putMVar, newEmptyMVar) import Control.Monad (replicateM, replicateM_) -import Control.Monad.IO.Class (liftIO) import Data.List (sort, foldl', scanl') import GHC.Word (Word8) @@ -121,7 +120,7 @@ sourceUnfoldrM mv n = A.unfoldrM step 0 if cnt > fromIntegral n then return Nothing else do - liftIO $ dbgMVar ("put sourceUnfoldrM " ++ msg) (putMVar mv ()) + dbgMVar ("put sourceUnfoldrM " ++ msg) (putMVar mv ()) return (Just (fromIntegral cnt, cnt + 1)) concurrentUnfoldrM @@ -142,15 +141,16 @@ concurrentUnfoldrM eq op n = A.toList $ do x <- op (sourceUnfoldrM mv n) let msg = show x ++ "/" ++ show n - if even x - then do - liftIO $ dbgMVar ("first take concurrentUnfoldrM " ++ msg) - (takeMVar mv) - if n > x - then liftIO $ dbgMVar ("second take concurrentUnfoldrM " ++ msg) + A.once $ do + if even x + then do + dbgMVar ("first take concurrentUnfoldrM " ++ msg) (takeMVar mv) + if n > x + then dbgMVar ("second take concurrentUnfoldrM " ++ msg) + (takeMVar mv) + else return () else return () - else return () return x equals eq stream list