Skip to content

Commit 408eacf

Browse files
BodigrimLysxia
authored andcommitted
Fix warnings for redundant imports/bindings
1 parent 82d8ecb commit 408eacf

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

benchmarks/haskell/Benchmarks/FileWrite.hs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ module Benchmarks.FileWrite
1515
import Control.DeepSeq (NFData, deepseq)
1616
import Data.Bifunctor (first)
1717
import Data.List (intercalate, intersperse)
18-
import Data.Semigroup ((<>))
1918
import Data.String (fromString)
2019
import Data.Text (StrictText)
2120
import Data.Text.Internal.Lazy (LazyText, defaultChunkSize)
22-
import System.IO (Handle, Newline(CRLF,LF), NewlineMode(NewlineMode), BufferMode(NoBuffering,LineBuffering,BlockBuffering), hSetBuffering, hSetNewlineMode)
21+
import System.IO (Handle, Newline(CRLF,LF), NewlineMode(NewlineMode), BufferMode(..), hSetBuffering, hSetNewlineMode)
2322
import Test.Tasty.Bench (Benchmark, bgroup, bench, whnfAppIO)
2423
import qualified Data.Text as T
2524
import qualified Data.Text.IO as T
@@ -112,11 +111,15 @@ mkFileWriteBenchmarks mkSinkNRemove = do
112111
#endif
113112

114113
where
115-
lazy, lazyNewlines, lazySmallChunks, lazySmallChunksNewlines :: (String, StrictText -> LazyText)
114+
lazy, lazyNewlines :: (String, StrictText -> LazyText)
116115
lazy = ("lazy", L.fromChunks . T.chunksOf defaultChunkSize)
117116
lazyNewlines = ("lazy many newlines", snd lazy . snd strictNewlines)
117+
118+
#ifdef ExtendedBenchmarks
119+
lazySmallChunks, lazySmallChunksNewlines :: (String, StrictText -> LazyText)
118120
lazySmallChunks = ("lazy small chunks", L.fromChunks . T.chunksOf 10)
119121
lazySmallChunksNewlines = ("lazy small chunks many newlines", snd lazySmallChunks . snd strictNewlines)
122+
#endif
120123

121124
strict, strictNewlines :: (String, StrictText -> StrictText)
122125
strict = ("strict", id)

benchmarks/haskell/Benchmarks/Programs/Fold.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ module Benchmarks.Programs.Fold
1717
( benchmark
1818
) where
1919

20-
import Data.List (foldl')
20+
import Data.Foldable (Foldable(..))
2121
import Data.List (intersperse)
22+
import Prelude hiding (Foldable(..))
2223
import System.IO (Handle)
2324
import Test.Tasty.Bench (Benchmark, bench, whnfIO)
2425
import qualified Data.Text as T
@@ -29,16 +30,16 @@ import qualified Data.Text.Lazy.IO as TL
2930

3031
benchmark :: FilePath -> Handle -> Benchmark
3132
benchmark i o =
32-
bench "Fold" $ whnfIO $ T.readFile i >>= TL.hPutStr o . fold 80
33+
bench "Fold" $ whnfIO $ T.readFile i >>= TL.hPutStr o . foldText 80
3334

3435
-- | We represent a paragraph by a word list
3536
--
3637
type Paragraph = [T.Text]
3738

3839
-- | Fold a text
3940
--
40-
fold :: Int -> T.Text -> TL.Text
41-
fold maxWidth = TLB.toLazyText . mconcat .
41+
foldText :: Int -> T.Text -> TL.Text
42+
foldText maxWidth = TLB.toLazyText . mconcat .
4243
intersperse "\n\n" . map (foldParagraph maxWidth) . paragraphs
4344

4445
-- | Fold a paragraph

benchmarks/haskell/Benchmarks/ReadNumbers.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ module Benchmarks.ReadNumbers
2121
, benchmark
2222
) where
2323

24+
import Data.Foldable (Foldable(..))
25+
import Prelude hiding (Foldable(..))
2426
import Test.Tasty.Bench (Benchmark, bgroup, bench, whnf)
25-
import Data.List (foldl')
2627
import qualified Data.Text as T
2728
import qualified Data.Text.IO as T
2829
import qualified Data.Text.Lazy as TL

benchmarks/haskell/Benchmarks/WordFrequencies.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ module Benchmarks.WordFrequencies
1313
, benchmark
1414
) where
1515

16-
import Test.Tasty.Bench (Benchmark, bench, bgroup, whnf)
17-
import Data.List (foldl')
16+
import Data.Foldable (Foldable(..))
1817
import Data.Map (Map)
18+
import Prelude hiding (Foldable(..))
19+
import Test.Tasty.Bench (Benchmark, bench, bgroup, whnf)
1920
import qualified Data.Map as M
2021
import qualified Data.Text as T
2122
import qualified Data.Text.IO as T

0 commit comments

Comments
 (0)