Skip to content

Commit 21c57ea

Browse files
committed
Fix review comments
1 parent 4dc548c commit 21c57ea

File tree

4 files changed

+22
-80
lines changed

4 files changed

+22
-80
lines changed

benchmark/Streamly/Benchmark/Prelude/Serial/NestedStream.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ o_n_heap_buffering value =
465465
--, benchIOSrc1 "differenceBy"
466466
-- $ joinMapWith (Internal.differenceBy (==)) halfVal
467467
, benchIOSrc1 "differenceBySorted"
468-
$ joinMapWith (Internal.differenceBySorted compare) halfVal
468+
$ joinMapWith (Internal.differenceBySorted compare) sqrtVal
469469
]
470470
]
471471

streamly.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ extra-source-files:
102102
test/Streamly/Test/Data/Array/Foreign.hs
103103
test/Streamly/Test/Data/Array/Stream/Foreign.hs
104104
test/Streamly/Test/Data/Parser/ParserD.hs
105-
test/Streamly/Test/Data/Stream/Top.hs
106105
test/Streamly/Test/FileSystem/Event.hs
107106
test/Streamly/Test/FileSystem/Event/Common.hs
108107
test/Streamly/Test/FileSystem/Event/Darwin.hs

test/Streamly/Test/Data/Stream/Top.hs

Lines changed: 0 additions & 77 deletions
This file was deleted.

test/Streamly/Test/Prelude/Top.hs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Main (main) where
22

3-
import Data.List (elem, intersect, nub, sort)
3+
import Data.List (elem, intersect, nub, sort, (\\))
44
import Data.Maybe (isNothing)
55
import Streamly.Prelude (SerialT)
66
import Test.QuickCheck
@@ -196,6 +196,25 @@ intersectBy _srt intersectFunc cmp =
196196
let v2 = ls0 `intersect` ls1
197197
assert (v1 == sort v2)
198198

199+
differenceBySorted :: Property
200+
differenceBySorted =
201+
forAll (listOf (chooseInt (min_value, max_value))) $ \ls0 ->
202+
forAll (listOf (chooseInt (min_value, max_value))) $ \ls1 ->
203+
monadicIO $ action (sort ls0) (sort ls1)
204+
205+
where
206+
207+
action ls0 ls1 = do
208+
v1 <-
209+
run
210+
$ S.toList
211+
$ Top.differenceBySorted
212+
compare
213+
(S.fromList ls0)
214+
(S.fromList ls1)
215+
let v2 = ls0 \\ ls1
216+
assert (v1 == sort v2)
217+
199218
-------------------------------------------------------------------------------
200219
-- Main
201220
-------------------------------------------------------------------------------
@@ -219,3 +238,4 @@ main = hspec $ do
219238
--prop "intersectBy" (intersectBy id Top.intersectBy (==))
220239
prop "intersectBySorted"
221240
(intersectBy sort Top.intersectBySorted compare)
241+
prop "differenceBySorted" Main.differenceBySorted

0 commit comments

Comments
 (0)