From a11fe009650eaf13f4ba9703273457e1e063fcf6 Mon Sep 17 00:00:00 2001 From: Harendra Kumar Date: Thu, 2 Nov 2023 17:35:17 +0530 Subject: [PATCH] Fix warnings for GHC 9.6 and 9.8 --- benchmark/Streamly/Benchmark/Data/Serialize.hs | 2 +- benchmark/Streamly/Benchmark/Data/Stream/Common.hs | 2 ++ benchmark/Streamly/Benchmark/Data/Stream/StreamD.hs | 2 ++ benchmark/Streamly/Benchmark/Data/Stream/StreamK.hs | 2 ++ benchmark/streamly-benchmarks.cabal | 4 ++++ core/src/Streamly/Internal/Data/Builder.hs | 2 ++ core/src/Streamly/Internal/Data/Fold/Chunked.hs | 2 ++ core/src/Streamly/Internal/Data/Fold/Tee.hs | 2 ++ core/src/Streamly/Internal/Data/Fold/Type.hs | 2 ++ core/src/Streamly/Internal/Data/Parser/Type.hs | 5 ++++- core/src/Streamly/Internal/Data/ParserK/Type.hs | 5 ++++- core/src/Streamly/Internal/Data/Stream/Type.hs | 2 ++ core/src/Streamly/Internal/Data/StreamK/Type.hs | 2 ++ core/src/Streamly/Internal/Data/Time/Units.hs | 3 ++- core/streamly-core.cabal | 4 ++++ src/Streamly/Internal/Data/Stream/Zip.hs | 2 ++ src/Streamly/Internal/Unicode/Char.hs | 4 ++++ streamly.cabal | 4 ++++ test/Streamly/Test/Data/Parser.hs | 4 ++++ test/Streamly/Test/Data/ParserK.hs | 5 +++++ test/Streamly/Test/Prelude/Serial.hs | 4 ++++ test/lib/Streamly/Test/Prelude/Common.hs | 9 ++++++++- 22 files changed, 68 insertions(+), 5 deletions(-) diff --git a/benchmark/Streamly/Benchmark/Data/Serialize.hs b/benchmark/Streamly/Benchmark/Data/Serialize.hs index 5f44b2bfe..4f9742bb7 100644 --- a/benchmark/Streamly/Benchmark/Data/Serialize.hs +++ b/benchmark/Streamly/Benchmark/Data/Serialize.hs @@ -318,7 +318,7 @@ loop count f val = go count val -- The first arg of "f" is the environment which is not threaded around in the -- loop. {-# INLINE loopWith #-} -loopWith :: Int -> (env -> a -> IO b) -> env -> a -> IO () +loopWith :: Int -> (e -> a -> IO b) -> e -> a -> IO () loopWith count f e val = go count val where diff --git a/benchmark/Streamly/Benchmark/Data/Stream/Common.hs b/benchmark/Streamly/Benchmark/Data/Stream/Common.hs index 8548496c4..755e80789 100644 --- a/benchmark/Streamly/Benchmark/Data/Stream/Common.hs +++ b/benchmark/Streamly/Benchmark/Data/Stream/Common.hs @@ -71,7 +71,9 @@ module Stream.Common ) where +#if !MIN_VERSION_base(4,18,0) import Control.Applicative (liftA2) +#endif import Control.DeepSeq (NFData) import Control.Exception (try) import GHC.Exception (ErrorCall) diff --git a/benchmark/Streamly/Benchmark/Data/Stream/StreamD.hs b/benchmark/Streamly/Benchmark/Data/Stream/StreamD.hs index 74c390aa5..123d70b5d 100644 --- a/benchmark/Streamly/Benchmark/Data/Stream/StreamD.hs +++ b/benchmark/Streamly/Benchmark/Data/Stream/StreamD.hs @@ -22,7 +22,9 @@ module Main (main) where +#if !MIN_VERSION_base(4,18,0) import Control.Applicative (liftA2) +#endif import Control.Monad (when) import Data.Maybe (isJust) import Gauge (bench, nfIO, bgroup, Benchmark, defaultMain) diff --git a/benchmark/Streamly/Benchmark/Data/Stream/StreamK.hs b/benchmark/Streamly/Benchmark/Data/Stream/StreamK.hs index 48302d515..21c89c046 100644 --- a/benchmark/Streamly/Benchmark/Data/Stream/StreamK.hs +++ b/benchmark/Streamly/Benchmark/Data/Stream/StreamK.hs @@ -21,7 +21,9 @@ module Main (main) where +#if !MIN_VERSION_base(4,18,0) import Control.Applicative (liftA2) +#endif import Control.Monad (when) import Data.Maybe (isJust) import System.Random (randomRIO) diff --git a/benchmark/streamly-benchmarks.cabal b/benchmark/streamly-benchmarks.cabal index f0c9d5e28..18d108aa0 100644 --- a/benchmark/streamly-benchmarks.cabal +++ b/benchmark/streamly-benchmarks.cabal @@ -145,6 +145,10 @@ common compile-options -Wno-missing-kind-signatures -Wno-operator-whitespace + if impl(ghc >= 9.8) + ghc-options: + -Wno-missing-role-annotations + if flag(has-llvm) ghc-options: -fllvm diff --git a/core/src/Streamly/Internal/Data/Builder.hs b/core/src/Streamly/Internal/Data/Builder.hs index 4b22f8584..11041df6e 100644 --- a/core/src/Streamly/Internal/Data/Builder.hs +++ b/core/src/Streamly/Internal/Data/Builder.hs @@ -16,7 +16,9 @@ module Streamly.Internal.Data.Builder ) where +#if !MIN_VERSION_base(4,18,0) import Control.Applicative (liftA2) +#endif ------------------------------------------------------------------------------ -- The Builder type diff --git a/core/src/Streamly/Internal/Data/Fold/Chunked.hs b/core/src/Streamly/Internal/Data/Fold/Chunked.hs index 14499e107..ce5f1836d 100644 --- a/core/src/Streamly/Internal/Data/Fold/Chunked.hs +++ b/core/src/Streamly/Internal/Data/Fold/Chunked.hs @@ -58,7 +58,9 @@ where #include "ArrayMacros.h" +#if !MIN_VERSION_base(4,18,0) import Control.Applicative (liftA2) +#endif import Control.Exception (assert) import Control.Monad.IO.Class (MonadIO(..)) import Data.Bifunctor (first) diff --git a/core/src/Streamly/Internal/Data/Fold/Tee.hs b/core/src/Streamly/Internal/Data/Fold/Tee.hs index 9689bb919..c0af52cb7 100644 --- a/core/src/Streamly/Internal/Data/Fold/Tee.hs +++ b/core/src/Streamly/Internal/Data/Fold/Tee.hs @@ -16,7 +16,9 @@ module Streamly.Internal.Data.Fold.Tee ) where +#if !MIN_VERSION_base(4,18,0) import Control.Applicative (liftA2) +#endif import Streamly.Internal.Data.Fold.Type (Fold) import qualified Streamly.Internal.Data.Fold.Type as Fold diff --git a/core/src/Streamly/Internal/Data/Fold/Type.hs b/core/src/Streamly/Internal/Data/Fold/Type.hs index dd9c3834c..d57b7330c 100644 --- a/core/src/Streamly/Internal/Data/Fold/Type.hs +++ b/core/src/Streamly/Internal/Data/Fold/Type.hs @@ -442,7 +442,9 @@ where #include "inline.hs" +#if !MIN_VERSION_base(4,18,0) import Control.Applicative (liftA2) +#endif import Control.Monad ((>=>)) import Data.Bifunctor (Bifunctor(..)) import Data.Either (fromLeft, fromRight, isLeft, isRight) diff --git a/core/src/Streamly/Internal/Data/Parser/Type.hs b/core/src/Streamly/Internal/Data/Parser/Type.hs index 402cc645c..0ebf5aa27 100644 --- a/core/src/Streamly/Internal/Data/Parser/Type.hs +++ b/core/src/Streamly/Internal/Data/Parser/Type.hs @@ -216,7 +216,10 @@ where #include "inline.hs" #include "assert.hs" -import Control.Applicative (Alternative(..), liftA2) +#if !MIN_VERSION_base(4,18,0) +import Control.Applicative (liftA2) +#endif +import Control.Applicative (Alternative(..)) import Control.Exception (Exception(..)) -- import Control.Monad (MonadPlus(..), (>=>)) import Control.Monad ((>=>)) diff --git a/core/src/Streamly/Internal/Data/ParserK/Type.hs b/core/src/Streamly/Internal/Data/ParserK/Type.hs index 7610766b5..cdc42786f 100644 --- a/core/src/Streamly/Internal/Data/ParserK/Type.hs +++ b/core/src/Streamly/Internal/Data/ParserK/Type.hs @@ -41,7 +41,10 @@ where #include "assert.hs" #include "inline.hs" -import Control.Applicative (Alternative(..), liftA2) +#if !MIN_VERSION_base(4,18,0) +import Control.Applicative (liftA2) +#endif +import Control.Applicative (Alternative(..)) import Control.Monad (MonadPlus(..), ap) import Control.Monad.IO.Class (MonadIO, liftIO) -- import Control.Monad.Trans.Class (MonadTrans(lift)) diff --git a/core/src/Streamly/Internal/Data/Stream/Type.hs b/core/src/Streamly/Internal/Data/Stream/Type.hs index dcf7ce107..e61d51c3d 100644 --- a/core/src/Streamly/Internal/Data/Stream/Type.hs +++ b/core/src/Streamly/Internal/Data/Stream/Type.hs @@ -136,7 +136,9 @@ where #include "inline.hs" +#if !MIN_VERSION_base(4,18,0) import Control.Applicative (liftA2) +#endif import Control.Monad.Catch (MonadThrow, throwM) import Control.Monad.Trans.Class (MonadTrans(lift)) import Control.Monad.IO.Class (MonadIO(..)) diff --git a/core/src/Streamly/Internal/Data/StreamK/Type.hs b/core/src/Streamly/Internal/Data/StreamK/Type.hs index f681c9c7b..51c306345 100644 --- a/core/src/Streamly/Internal/Data/StreamK/Type.hs +++ b/core/src/Streamly/Internal/Data/StreamK/Type.hs @@ -144,7 +144,9 @@ where import Control.Monad ((>=>)) import Control.Monad.Catch (MonadThrow, throwM) import Control.Monad.Trans.Class (MonadTrans(lift)) +#if !MIN_VERSION_base(4,18,0) import Control.Applicative (liftA2) +#endif import Control.Monad.IO.Class (MonadIO(..)) import Data.Foldable (Foldable(foldl'), fold, foldr) import Data.Function (fix) diff --git a/core/src/Streamly/Internal/Data/Time/Units.hs b/core/src/Streamly/Internal/Data/Time/Units.hs index 39037e34d..b29f3b6e5 100644 --- a/core/src/Streamly/Internal/Data/Time/Units.hs +++ b/core/src/Streamly/Internal/Data/Time/Units.hs @@ -1,4 +1,5 @@ -{-# LANGUAGE TypeInType #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE PolyKinds #-} {-# LANGUAGE UnboxedTuples #-} -- | diff --git a/core/streamly-core.cabal b/core/streamly-core.cabal index 7d2147bc5..49b28ae6a 100644 --- a/core/streamly-core.cabal +++ b/core/streamly-core.cabal @@ -157,6 +157,10 @@ common compile-options -Wno-redundant-bang-patterns -Wno-operator-whitespace + if impl(ghc >= 9.8) + ghc-options: + -Wno-missing-role-annotations + if flag(has-llvm) ghc-options: -fllvm diff --git a/src/Streamly/Internal/Data/Stream/Zip.hs b/src/Streamly/Internal/Data/Stream/Zip.hs index d3279e961..37357a779 100644 --- a/src/Streamly/Internal/Data/Stream/Zip.hs +++ b/src/Streamly/Internal/Data/Stream/Zip.hs @@ -27,7 +27,9 @@ module Streamly.Internal.Data.Stream.Zip ) where +#if !MIN_VERSION_base(4,18,0) import Control.Applicative (liftA2) +#endif import Control.DeepSeq (NFData(..)) #if MIN_VERSION_deepseq(1,4,3) import Control.DeepSeq (NFData1(..)) diff --git a/src/Streamly/Internal/Unicode/Char.hs b/src/Streamly/Internal/Unicode/Char.hs index a6f695b57..e703c00e9 100644 --- a/src/Streamly/Internal/Unicode/Char.hs +++ b/src/Streamly/Internal/Unicode/Char.hs @@ -7,6 +7,10 @@ -- Stability : experimental -- Portability : GHC +-- XXX We are using head/tail at one place +#if __GLASGOW_HASKELL__ >= 908 +{-# OPTIONS_GHC -Wno-x-partial #-} +#endif -- XXX This module should have the reader/writer unfold/refold and read/write -- stream/fold routines to convert a char to/from stream. -- diff --git a/streamly.cabal b/streamly.cabal index dd0b11f99..2856df9ac 100644 --- a/streamly.cabal +++ b/streamly.cabal @@ -266,6 +266,10 @@ common compile-options -Wno-redundant-bang-patterns -Wno-operator-whitespace + if impl(ghc >= 9.8) + ghc-options: + -Wno-missing-role-annotations + if flag(has-llvm) ghc-options: -fllvm diff --git a/test/Streamly/Test/Data/Parser.hs b/test/Streamly/Test/Data/Parser.hs index 25190943e..ccd66537f 100644 --- a/test/Streamly/Test/Data/Parser.hs +++ b/test/Streamly/Test/Data/Parser.hs @@ -1,3 +1,7 @@ +-- XXX We are using head/tail at one place +#if __GLASGOW_HASKELL__ >= 908 +{-# OPTIONS_GHC -Wno-x-partial #-} +#endif module Main (main) where import Control.Applicative ((<|>)) diff --git a/test/Streamly/Test/Data/ParserK.hs b/test/Streamly/Test/Data/ParserK.hs index ae75a648a..d02eab275 100644 --- a/test/Streamly/Test/Data/ParserK.hs +++ b/test/Streamly/Test/Data/ParserK.hs @@ -1,3 +1,8 @@ +-- XXX We are using head/tail at one place +#if __GLASGOW_HASKELL__ >= 908 +{-# OPTIONS_GHC -Wno-x-partial #-} +#endif + module Main (main) where import Control.Applicative ((<|>)) diff --git a/test/Streamly/Test/Prelude/Serial.hs b/test/Streamly/Test/Prelude/Serial.hs index 112820960..d43d61b75 100644 --- a/test/Streamly/Test/Prelude/Serial.hs +++ b/test/Streamly/Test/Prelude/Serial.hs @@ -1,5 +1,9 @@ {-# OPTIONS_GHC -Wno-deprecations #-} {-# Language TypeApplications #-} +-- XXX We are using head/tail at one place +#if __GLASGOW_HASKELL__ >= 908 +{-# OPTIONS_GHC -Wno-x-partial #-} +#endif -- | -- Module : Streamly.Test.Prelude.Serial diff --git a/test/lib/Streamly/Test/Prelude/Common.hs b/test/lib/Streamly/Test/Prelude/Common.hs index cc2b6af4d..1ee70ac8b 100644 --- a/test/lib/Streamly/Test/Prelude/Common.hs +++ b/test/lib/Streamly/Test/Prelude/Common.hs @@ -1,4 +1,8 @@ {-# OPTIONS_GHC -Wno-deprecations #-} +-- XXX We are using head/tail at one place +#if __GLASGOW_HASKELL__ >= 908 +{-# OPTIONS_GHC -Wno-x-partial #-} +#endif -- | -- Module : Streamly.Test.Prelude.Common @@ -85,7 +89,10 @@ module Streamly.Test.Prelude.Common , sortEq ) where -import Control.Applicative (ZipList(..), liftA2) +#if !MIN_VERSION_base(4,18,0) +import Control.Applicative (liftA2) +#endif +import Control.Applicative (ZipList(..)) import Control.Exception (Exception, try) import Control.Concurrent (threadDelay) import Control.Monad (replicateM)