Skip to content

Commit bcd0924

Browse files
committed
Remove -Wno-deprecations in multiple benchmarks and tests
1 parent 0ebf772 commit bcd0924

File tree

27 files changed

+49
-71
lines changed

27 files changed

+49
-71
lines changed

benchmark/Streamly/Benchmark/Data/Array.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{-# OPTIONS_GHC -Wno-deprecations #-}
21
{-# OPTIONS_GHC -Wno-orphans #-}
32

43
{-# LANGUAGE CPP #-}
@@ -73,7 +72,7 @@ sourceIsString value n = GHC.fromString (P.replicate (n + value) 'a')
7372

7473
{-# INLINE sourceIntFromToFromStream #-}
7574
sourceIntFromToFromStream :: MonadIO m => Int -> Int -> m (Stream Int)
76-
sourceIntFromToFromStream value n = S.fold A.write $ S.enumerateFromTo n (n + value)
75+
sourceIntFromToFromStream value n = S.fold A.create $ S.enumerateFromTo n (n + value)
7776

7877
-------------------------------------------------------------------------------
7978
-- Bench groups

benchmark/Streamly/Benchmark/Data/Array/Common.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ onArray
7171
-> m (Stream Int)
7272
onArray value f arr = S.fold (A.createOf value) $ f $ S.unfold A.reader arr
7373

74-
scanl' value n = composeN n $ onArray value $ S.scan (Fold.foldl' (+) 0)
74+
scanl' value n = composeN n $ onArray value $ S.scanl (Scanl.mkScanl (+) 0)
7575
scanl1' value n = composeN n $ onArray value $ Stream.scanl1' (+)
7676
map value n = composeN n $ onArray value $ fmap (+1)
7777
-- map n = composeN n $ A.map (+1)

benchmark/Streamly/Benchmark/Data/Array/CommonImports.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Data.Functor ((<&>))
66
import System.Random (randomRIO)
77

88
import qualified Streamly.Data.Fold as Fold
9+
import qualified Streamly.Data.Scanl as Scanl
910
import qualified Streamly.Data.Stream as S
1011
import qualified Streamly.Internal.Data.Stream as Stream
1112

benchmark/Streamly/Benchmark/Data/Array/Generic.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{-# OPTIONS_GHC -Wno-deprecations #-}
21
{-# OPTIONS_GHC -Wno-orphans #-}
32

43
{-# LANGUAGE CPP #-}
@@ -58,7 +57,7 @@ foldableSum = P.sum
5857
{-# INLINE sourceIntFromToFromStream #-}
5958
sourceIntFromToFromStream :: MonadIO m => Int -> Int -> m (Stream Int)
6059
sourceIntFromToFromStream value n =
61-
S.fold A.write $ S.enumerateFromTo n (n + value)
60+
S.fold A.create $ S.enumerateFromTo n (n + value)
6261

6362
-------------------------------------------------------------------------------
6463
-- Bench groups

benchmark/Streamly/Benchmark/Data/Array/Stream.hs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{-# OPTIONS_GHC -Wno-deprecations #-}
21

32
-- |
43
-- Module : Streamly.Benchmark.Data.ParserD
@@ -39,7 +38,6 @@ import Prelude hiding ()
3938

4039
import qualified Streamly.Data.Stream as Stream
4140
import qualified Streamly.Internal.Data.Array as Array
42-
import qualified Streamly.Internal.Data.Array.Stream as ArrayStream
4341
import qualified Streamly.Internal.Data.Fold as Fold
4442
import qualified Streamly.Internal.Data.Parser as Parser
4543
import qualified Streamly.Internal.Data.Stream as Stream
@@ -138,7 +136,7 @@ inspect $ hasNoTypeClasses 'toChunksDecodeUtf8Arrays
138136
toChunksSplitOnSuffix :: Handle -> IO Int
139137
toChunksSplitOnSuffix =
140138
Stream.fold Fold.length
141-
. ArrayStream.splitOnSuffix 10
139+
. Array.compactEndByByte_ 10
142140
. Handle.readChunks
143141

144142
#ifdef INSPECTION
@@ -151,7 +149,7 @@ inspect $ 'toChunksSplitOnSuffix `hasNoType` ''Step
151149
toChunksSplitOn :: Handle -> IO Int
152150
toChunksSplitOn =
153151
Stream.fold Fold.length
154-
. ArrayStream.splitOn 32
152+
. Array.compactSepByByte_ 32
155153
. Handle.readChunks
156154

157155
#ifdef INSPECTION
@@ -190,7 +188,7 @@ o_1_space_read_chunked env =
190188
copyChunksSplitInterposeSuffix :: Handle -> Handle -> IO ()
191189
copyChunksSplitInterposeSuffix inh outh =
192190
Stream.fold (Handle.write outh)
193-
$ ArrayStream.interposeSuffix 10 . ArrayStream.splitOnSuffix 10
191+
$ Array.concatEndBy 10 . Array.compactEndByByte_ 10
194192
$ Handle.readChunks inh
195193

196194
#ifdef INSPECTION
@@ -204,7 +202,7 @@ copyChunksSplitInterpose :: Handle -> Handle -> IO ()
204202
copyChunksSplitInterpose inh outh =
205203
Stream.fold (Handle.write outh)
206204
-- XXX this is not correct word splitting combinator
207-
$ ArrayStream.interpose 32 . ArrayStream.splitOn 32
205+
$ Array.concatSepBy 32 . Array.compactSepByByte_ 32
208206
$ Handle.readChunks inh
209207

210208
#ifdef INSPECTION
@@ -236,23 +234,23 @@ drainWhile p = Parser.takeWhile p Fold.drain
236234

237235
{-# INLINE fold #-}
238236
fold :: Stream IO (Array.Array Int) -> IO ()
239-
fold s = void $ ArrayStream.foldBreak Fold.drain $ StreamK.fromStream s
237+
fold s = void $ Array.foldBreakChunksK Fold.drain $ StreamK.fromStream s
240238

241239
{-# INLINE parse #-}
242240
parse :: Int -> Stream IO (Array.Array Int) -> IO ()
243241
parse value s =
244-
void $ ArrayStream.parseBreak (drainWhile (< value)) $ StreamK.fromStream s
242+
void $ Array.parseBreakChunksK (drainWhile (< value)) $ StreamK.fromStream s
245243

246244
{-# INLINE foldBreak #-}
247245
foldBreak :: StreamK IO (Array.Array Int) -> IO ()
248246
foldBreak s = do
249-
(r, s1) <- ArrayStream.foldBreak Fold.one s
247+
(r, s1) <- Array.foldBreakChunksK Fold.one s
250248
when (isJust r) $ foldBreak s1
251249

252250
{-# INLINE parseBreak #-}
253251
parseBreak :: StreamK IO (Array.Array Int) -> IO ()
254252
parseBreak s = do
255-
r <- ArrayStream.parseBreak Parser.one s
253+
r <- Array.parseBreakChunksK Parser.one s
256254
case r of
257255
(Left _, _) -> return ()
258256
(Right _, s1) -> parseBreak s1

benchmark/Streamly/Benchmark/Data/MutArray.hs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{-# OPTIONS_GHC -Wno-deprecations #-}
21
{-# OPTIONS_GHC -Wno-orphans #-}
32

43
-- |
@@ -47,6 +46,7 @@ import Streamly.Internal.Data.MutArray (MutArray)
4746
import qualified Streamly.Internal.Data.Array as Array
4847
import qualified Streamly.Internal.Data.MutArray as MArray
4948
import qualified Streamly.Internal.Data.Fold as Fold
49+
import qualified Streamly.Internal.Data.Scanl as Scanl
5050
import qualified Streamly.Internal.Data.Stream as Stream
5151

5252
import Test.Tasty.Bench
@@ -95,7 +95,7 @@ drain = Stream.fold Fold.drain
9595
{-# INLINE sourceUnfoldr #-}
9696
sourceUnfoldr :: MonadIO m => Int -> Int -> m (Stream Int)
9797
sourceUnfoldr value n =
98-
Stream.fold (MArray.writeN value) $ Stream.unfoldr step n
98+
Stream.fold (MArray.createOf value) $ Stream.unfoldr step n
9999

100100
where
101101

@@ -107,12 +107,12 @@ sourceUnfoldr value n =
107107
{-# INLINE sourceIntFromTo #-}
108108
sourceIntFromTo :: MonadIO m => Int -> Int -> m (Stream Int)
109109
sourceIntFromTo value n =
110-
Stream.fold (MArray.writeN value) $ Stream.enumerateFromTo n (n + value)
110+
Stream.fold (MArray.createOf value) $ Stream.enumerateFromTo n (n + value)
111111

112112
{-# INLINE sourceFromList #-}
113113
sourceFromList :: MonadIO m => Int -> Int -> m (Stream Int)
114114
sourceFromList value n =
115-
Stream.fold (MArray.writeN value) $ Stream.fromList [n .. n + value]
115+
Stream.fold (MArray.createOf value) $ Stream.fromList [n .. n + value]
116116

117117
{-# INLINE sourceIntFromToFromList #-}
118118
sourceIntFromToFromList :: MonadIO m => Int -> Int -> m (Stream Int)
@@ -121,7 +121,7 @@ sourceIntFromToFromList value n = MArray.fromListN value [n..n + value]
121121
{-# INLINE sourceIntFromToFromStream #-}
122122
sourceIntFromToFromStream :: MonadIO m => Int -> Int -> m (Stream Int)
123123
sourceIntFromToFromStream value n =
124-
Stream.fold MArray.write $ Stream.enumerateFromTo n (n + value)
124+
Stream.fold MArray.create $ Stream.enumerateFromTo n (n + value)
125125

126126
{-# INLINE sourceUnfoldrM #-}
127127
sourceUnfoldrM :: Monad m => Int -> Int -> Stream.Stream m Int
@@ -149,7 +149,7 @@ composeN n f x =
149149

150150
{-# INLINE scanl' #-}
151151
scanl' :: MonadIO m => Int -> Int -> Stream Int -> m (Stream Int)
152-
scanl' value n = composeN n $ onArray value $ Stream.scan (Fold.foldl' (+) 0)
152+
scanl' value n = composeN n $ onArray value $ Stream.scanl (Scanl.mkScanl (+) 0)
153153

154154
{-# INLINE scanl1' #-}
155155
scanl1' :: MonadIO m => Int -> Int -> Stream Int -> m (Stream Int)
@@ -165,7 +165,7 @@ onArray
165165
-> Stream Int
166166
-> m (Stream Int)
167167
onArray value f arr =
168-
Stream.fold (MArray.writeN value) $ f $ Stream.unfold MArray.reader arr
168+
Stream.fold (MArray.createOf value) $ f $ Stream.unfold MArray.reader arr
169169

170170
-------------------------------------------------------------------------------
171171
-- Elimination
@@ -199,12 +199,12 @@ o_1_space_generation :: Int -> [Benchmark]
199199
o_1_space_generation value =
200200
[ bgroup
201201
"generation"
202-
[ benchIOSrc "writeN . intFromTo" (sourceIntFromTo value)
202+
[ benchIOSrc "createOf . intFromTo" (sourceIntFromTo value)
203203
, benchIOSrc
204204
"fromList . intFromTo"
205205
(sourceIntFromToFromList value)
206-
, benchIOSrc "writeN . unfoldr" (sourceUnfoldr value)
207-
, benchIOSrc "writeN . fromList" (sourceFromList value)
206+
, benchIOSrc "createOf . unfoldr" (sourceUnfoldr value)
207+
, benchIOSrc "createOf . fromList" (sourceFromList value)
208208
, benchIOSrc "write . intFromTo" (sourceIntFromToFromStream value)
209209
]
210210
]
@@ -226,7 +226,7 @@ o_n_heap_serial value =
226226
[ bgroup "elimination"
227227
[
228228
-- Converting the stream to an array
229-
benchFold "writeN" (Stream.fold (MArray.writeN value))
229+
benchFold "createOf" (Stream.fold (MArray.createOf value))
230230
(sourceUnfoldrM value)
231231
]
232232
]

benchmark/Streamly/Benchmark/Data/Parser.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{-# OPTIONS_GHC -Wno-deprecations #-}
21

32
#undef FUSION_CHECK
43
#ifdef FUSION_CHECK
@@ -136,11 +135,11 @@ takeGE value = Stream.parse (PR.takeGE value Fold.drain)
136135
dropWhile :: Monad m => Int -> Stream m Int -> m (Either ParseError ())
137136
dropWhile value = Stream.parse (PR.dropWhile (<= value))
138137

139-
{-# INLINE takeStartBy #-}
140-
takeStartBy :: Monad m => Int -> Stream m Int -> m (Either ParseError ())
141-
takeStartBy value stream = do
138+
{-# INLINE takeBeginBy #-}
139+
takeBeginBy :: Monad m => Int -> Stream m Int -> m (Either ParseError ())
140+
takeBeginBy value stream = do
142141
let stream2 = value `Stream.cons` stream
143-
Stream.parse (PR.takeStartBy (== value) Fold.drain) stream2
142+
Stream.parse (PR.takeBeginBy (== value) Fold.drain) stream2
144143

145144
takeFramedByEsc_ :: Monad m => Int -> Stream m Char -> m (Either ParseError ())
146145
takeFramedByEsc_ _ = Stream.parse parser
@@ -718,7 +717,7 @@ o_1_space_serial value =
718717
, benchIOSink value "takeWhileP" $ takeWhileP value
719718
, benchIOSink value "takeP" $ takeP value
720719
, benchIOSink value "dropWhile" $ dropWhile value
721-
, benchIOSink value "takeStartBy" $ takeStartBy value
720+
, benchIOSink value "takeBeginBy" $ takeBeginBy value
722721
, benchIOSink value "takeEndBy_" $ takeEndBy_ value
723722
, benchIOSink value "groupBy" $ groupBy
724723
, benchIOSink value "groupByRolling" $ groupByRolling

benchmark/Streamly/Benchmark/Data/Stream/Common.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
-- Maintainer : [email protected]
1111

1212
#ifdef USE_PRELUDE
13-
{-# OPTIONS_GHC -Wno-deprecations #-}
1413
#endif
1514

1615
module Stream.Common

benchmark/Streamly/Benchmark/Data/Stream/Eliminate.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
{-# OPTIONS_GHC -Wno-orphans #-}
1414
#ifdef USE_PRELUDE
15-
{-# OPTIONS_GHC -Wno-deprecations #-}
1615
#endif
1716

1817
#ifdef __HADDOCK_VERSION__

benchmark/Streamly/Benchmark/Data/Stream/Exceptions.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
{-# LANGUAGE ScopedTypeVariables #-}
1212

1313
#ifdef USE_PRELUDE
14-
{-# OPTIONS_GHC -Wno-deprecations #-}
1514
#endif
1615

1716
#ifdef __HADDOCK_VERSION__

0 commit comments

Comments
 (0)