on master help sign in
Remove remaining code meant for GHC < 8.4
commitcc7ac6cad9aa11c8287d7bb5fde4c4ce8091e58b authorHarendra Kumar <harendra@composewell.com> dateThu 24 Mar 2022, 01:59 (5 years ago) parent07bf70d
15 files changed+23−74
benchmark/lib/Streamly/Benchmark/Common.hs−4 core/src/Streamly/Internal/BaseCompat.hs−9 core/src/Streamly/Internal/Data/Array/Foreign/Mut/Type.hs+1−7 core/src/Streamly/Internal/Data/Array/Foreign/Type.hs+1−6 core/src/Streamly/Internal/Data/Fold.hs+1−2 core/src/Streamly/Internal/Data/List.hs+9−14 core/src/Streamly/Internal/Data/Refold/Type.hs−3 core/src/Streamly/Internal/Data/Stream/Instances.hs−4 core/src/Streamly/Internal/Data/Stream/Serial.hs+4−7 core/src/Streamly/Internal/Data/Stream/StreamK/Type.hs−3 core/src/Streamly/Internal/Data/Stream/Zip.hs+4−7 src/Streamly/Internal/Data/Stream/Instances.hs−4 src/Streamly/Internal/Data/Stream/IsStream/Transform.hs+1−2 src/Streamly/Internal/FileSystem/Dir.hs+1−2 test/Streamly/Test/Unicode/Char.hs+1
benchmark/lib/Streamly/Benchmark/Common.hs−4
@@ -78,10 +78,6 @@ o_n_stack_prefix name = name ++ "/o-n-stack"
7878-- Benchmarking utilities
7979-------------------------------------------------------------------------------
8080
81−#if !MIN_VERSION_deepseq(1,4,3)
82−instance NFData Ordering where rnf = (`seq` ())
83−#endif
84−
8581-- XXX once we convert all the functions to use this we can rename this to
8682-- benchIOSink
8783{-# INLINE benchIOSink1 #-}
core/src/Streamly/Internal/BaseCompat.hs−9
@@ -10,20 +10,14 @@
1010module Streamly.Internal.BaseCompat
1111 (
1212 (#.)
13− , errorWithoutStackTrace
14− , fromLeft
15− , fromRight
1613 , unsafeWithForeignPtr
17− , oneShot
1814 )
1915where
2016
2117import Data.Coerce (Coercible, coerce)
22−import Data.Either (fromRight, fromLeft)
2318import GHC.ForeignPtr (ForeignPtr(..))
2419import GHC.Ptr (Ptr(..))
2520
26−import qualified GHC.Exts as GHCExt
2721#if MIN_VERSION_base(4,15,0)
2822import qualified GHC.ForeignPtr as GHCForeignPtr
2923#else
@@ -41,6 +35,3 @@ unsafeWithForeignPtr = GHCForeignPtr.unsafeWithForeignPtr
4135#else
4236unsafeWithForeignPtr = withForeignPtr
4337#endif
44−
45−oneShot :: (a -> b) -> a -> b
46−oneShot = GHCExt.oneShot
core/src/Streamly/Internal/Data/Array/Foreign/Mut/Type.hs+1−7
@@ -206,10 +206,7 @@ where
206206#endif
207207
208208import Control.Exception (assert)
209−import Control.DeepSeq (NFData(..))
210−#if MIN_VERSION_deepseq(1,4,3)
211−import Control.DeepSeq (NFData1(..))
212−#endif
209+import Control.DeepSeq (NFData(..), NFData1(..))
213210import Control.Monad (when, void)
214211import Control.Monad.IO.Class (MonadIO(..))
215212import Data.Bits (shiftR, (.|.), (.&.))
@@ -239,7 +236,6 @@ import GHC.ForeignPtr (mallocForeignPtrAlignedBytes)
239236#endif
240237import GHC.Ptr (Ptr(..))
241238
242−import Streamly.Internal.BaseCompat
243239import Streamly.Internal.Data.Fold.Type (Fold(..))
244240import Streamly.Internal.Data.Producer.Type (Producer (..))
245241import Streamly.Internal.Data.Stream.Serial (SerialT(..))
@@ -2287,11 +2283,9 @@ instance NFData (Array a) where
22872283 {-# INLINE rnf #-}
22882284 rnf Array {} = ()
22892285
2290−#if MIN_VERSION_deepseq(1,4,3)
22912286instance NFData1 Array where
22922287 {-# INLINE liftRnf #-}
22932288 liftRnf _ Array{} = ()
2294−#endif
22952289
22962290-- | Strip elements which match with predicate from both ends.
22972291--
core/src/Streamly/Internal/Data/Array/Foreign/Type.hs+1−6
@@ -77,10 +77,7 @@ where
7777#include "inline.hs"
7878
7979import Control.Exception (assert)
80−import Control.DeepSeq (NFData(..))
81−#if MIN_VERSION_deepseq(1,4,3)
82−import Control.DeepSeq (NFData1(..))
83−#endif
80+import Control.DeepSeq (NFData(..), NFData1(..))
8481import Control.Monad.IO.Class (MonadIO(..))
8582import Data.Functor.Identity (Identity(..))
8683import Data.Word (Word8)
@@ -741,10 +738,8 @@ instance NFData (Array a) where
741738 {-# INLINE rnf #-}
742739 rnf Array {} = ()
743740
744−#if MIN_VERSION_deepseq(1,4,3)
745741instance NFData1 Array where
746742 liftRnf _ Array{} = ()
747−#endif
748743
749744instance (Storable a, Ord a) => Ord (Array a) where
750745 {-# INLINE compare #-}
core/src/Streamly/Internal/Data/Fold.hs+1−2
@@ -258,12 +258,11 @@ module Streamly.Internal.Data.Fold
258258where
259259
260260import Data.Bifunctor (first)
261−import Data.Either (isLeft, isRight)
261+import Data.Either (isLeft, isRight, fromLeft, fromRight)
262262import Data.Functor.Identity (Identity(..))
263263import Data.Int (Int64)
264264import Data.Map.Strict (Map)
265265import Data.Maybe (isJust, fromJust)
266−import Streamly.Internal.BaseCompat (fromLeft, fromRight)
267266import Streamly.Internal.Data.Either.Strict
268267 (Either'(..), fromLeft', fromRight', isLeft', isRight')
269268import Streamly.Internal.Data.Pipe.Type (Pipe (..), PipeState(..))
core/src/Streamly/Internal/Data/List.hs+9−14
@@ -63,9 +63,7 @@ where
6363
6464import Control.Arrow (second)
6565import Control.DeepSeq (NFData(..))
66−#if MIN_VERSION_deepseq(1,4,3)
6766import Control.DeepSeq (NFData1(..))
68−#endif
6967import Data.Functor.Identity (Identity, runIdentity)
7068import GHC.Exts (IsList(..), IsString(..))
7169#if __GLASGOW_HASKELL__ < 808
@@ -93,12 +91,10 @@ import qualified Streamly.Internal.Data.Stream.StreamK.Type as K
9391--
9492-- @since 0.6.0
9593newtype List a = List { toSerial :: SerialT Identity a }
96− deriving (Show, Read, Eq, Ord, NFData
97−#if MIN_VERSION_deepseq(1,4,3)
98− , NFData1
99−#endif
100− , Semigroup, Monoid, Functor, Foldable
101− , Applicative, Traversable, Monad)
94+ deriving
95+ ( Show, Read, Eq, Ord, NFData , NFData1
96+ , Semigroup, Monoid, Functor, Foldable
97+ , Applicative, Traversable, Monad)
10298
10399instance (a ~ Char) => IsString (List a) where
104100 {-# INLINE fromString #-}
@@ -158,12 +154,11 @@ pattern Cons x xs <-
158154--
159155-- @since 0.6.0
160156newtype ZipList a = ZipList { toZipSerial :: ZipSerialM Identity a }
161− deriving (Show, Read, Eq, Ord, NFData
162−#if MIN_VERSION_deepseq(1,4,3)
163− , NFData1
164−#endif
165− , Semigroup, Monoid, Functor, Foldable
166− , Applicative, Traversable)
157+ deriving
158+ ( Show, Read, Eq, Ord, NFData , NFData1
159+ , Semigroup, Monoid, Functor, Foldable
160+ , Applicative, Traversable
161+ )
167162
168163instance (a ~ Char) => IsString (ZipList a) where
169164 {-# INLINE fromString #-}
core/src/Streamly/Internal/Data/Refold/Type.hs−3
@@ -44,9 +44,6 @@ module Streamly.Internal.Data.Refold.Type
4444where
4545
4646import Control.Monad ((>=>))
47−#if __GLASGOW_HASKELL__ < 804
48−import Data.Semigroup (Semigroup((<>)))
49−#endif
5047import Fusion.Plugin.Types (Fuse(..))
5148import Streamly.Internal.Data.Fold.Step (Step(..), mapMStep)
5249
core/src/Streamly/Internal/Data/Stream/Instances.hs−4
@@ -56,14 +56,10 @@ instance (MonadState s m CONSTRAINT) => MonadState s (STREAM m) where { \
5656-- well, because they do not get inlined. Need to add INLINE in Ord class in
5757-- base?
5858
59−#if MIN_VERSION_deepseq(1,4,3)
6059#define NFDATA1_INSTANCE(STREAM) \
6160instance NFData1 (STREAM Identity) where { \
6261 {-# INLINE liftRnf #-}; \
6362 liftRnf f (STREAM xs) = runIdentity $ P.foldl' (\_ x -> f x) () xs}
64−#else
65−#define NFDATA1_INSTANCE(STREAM)
66−#endif
6763
6864#define LIST_INSTANCES(STREAM) \
6965instance IsList (STREAM Identity a) where { \
core/src/Streamly/Internal/Data/Stream/Serial.hs+4−7
@@ -47,10 +47,7 @@ module Streamly.Internal.Data.Stream.Serial
4747where
4848
4949import Control.Applicative (liftA2)
50−import Control.DeepSeq (NFData(..))
51−#if MIN_VERSION_deepseq(1,4,3)
52−import Control.DeepSeq (NFData1(..))
53−#endif
50+import Control.DeepSeq (NFData(..), NFData1(..))
5451import Control.Monad.Base (MonadBase(..), liftBaseDefault)
5552import Control.Monad.Catch (MonadThrow, throwM)
5653import Control.Monad.IO.Class (MonadIO(..))
@@ -64,11 +61,11 @@ import Data.Semigroup (Endo(..))
6461#if __GLASGOW_HASKELL__ < 808
6562import Data.Semigroup (Semigroup(..))
6663#endif
67−import GHC.Exts (IsList(..), IsString(..))
64+import GHC.Exts (IsList(..), IsString(..), oneShot)
6865import Text.Read
6966 ( Lexeme(Ident), lexP, parens, prec, readPrec, readListPrec
7067 , readListPrecDefault)
71−import Streamly.Internal.BaseCompat ((#.), errorWithoutStackTrace, oneShot)
68+import Streamly.Internal.BaseCompat ((#.))
7269import Streamly.Internal.Data.Fold.Type (Fold)
7370import Streamly.Internal.Data.Maybe.Strict (Maybe'(..), toMaybe)
7471import Streamly.Internal.Data.Stream.StreamK.Type
@@ -80,7 +77,7 @@ import qualified Streamly.Internal.Data.Stream.StreamD.Transform as D
8077import qualified Streamly.Internal.Data.Stream.StreamD.Type as D
8178import qualified Streamly.Internal.Data.Stream.StreamK.Type as K
8279
83−import Prelude hiding (map, mapM, errorWithoutStackTrace, repeat)
80+import Prelude hiding (map, mapM, repeat)
8481
8582#include "Instances.hs"
8683#include "inline.hs"
core/src/Streamly/Internal/Data/Stream/StreamK/Type.hs−3
@@ -98,9 +98,6 @@ import Control.Monad (ap, (>=>))
9898import Control.Monad.Reader.Class (MonadReader(..))
9999import Control.Monad.Trans.Class (MonadTrans(lift))
100100import Data.Function (fix)
101−#if __GLASGOW_HASKELL__ < 804
102−import Data.Semigroup (Semigroup(..))
103−#endif
104101import Streamly.Internal.Data.SVar.Type (State, adaptState, defState)
105102import Prelude hiding
106103 (map, mapM, concatMap, foldr, repeat, null, reverse, tail, init)
core/src/Streamly/Internal/Data/Stream/Zip.hs+4−7
@@ -24,10 +24,7 @@ module Streamly.Internal.Data.Stream.Zip
2424where
2525
2626import Control.Applicative (liftA2)
27−import Control.DeepSeq (NFData(..))
28−#if MIN_VERSION_deepseq(1,4,3)
29−import Control.DeepSeq (NFData1(..))
30−#endif
27+import Control.DeepSeq (NFData(..), NFData1(..))
3128import Data.Foldable (Foldable(foldl'), fold)
3229import Data.Functor.Identity (Identity(..), runIdentity)
3330import Data.Maybe (fromMaybe)
@@ -35,11 +32,11 @@ import Data.Semigroup (Endo(..))
3532#if __GLASGOW_HASKELL__ < 808
3633import Data.Semigroup (Semigroup(..))
3734#endif
38−import GHC.Exts (IsList(..), IsString(..))
35+import GHC.Exts (IsList(..), IsString(..), oneShot)
3936import Text.Read
4037 ( Lexeme(Ident), lexP, parens, prec, readPrec, readListPrec
4138 , readListPrecDefault)
42−import Streamly.Internal.BaseCompat ((#.), errorWithoutStackTrace, oneShot)
39+import Streamly.Internal.BaseCompat ((#.))
4340import Streamly.Internal.Data.Maybe.Strict (Maybe'(..), toMaybe)
4441import Streamly.Internal.Data.Stream.Serial (SerialT(..))
4542import Streamly.Internal.Data.Stream.StreamK.Type (Stream)
@@ -50,7 +47,7 @@ import qualified Streamly.Internal.Data.Stream.StreamK.Type as K
5047import qualified Streamly.Internal.Data.Stream.StreamD as D
5148import qualified Streamly.Internal.Data.Stream.Serial as Serial
5249
53−import Prelude hiding (map, repeat, zipWith, errorWithoutStackTrace)
50+import Prelude hiding (map, repeat, zipWith)
5451
5552#include "Instances.hs"
5653
src/Streamly/Internal/Data/Stream/Instances.hs−4
@@ -56,14 +56,10 @@ instance (MonadState s m CONSTRAINT) => MonadState s (STREAM m) where { \
5656-- well, because they do not get inlined. Need to add INLINE in Ord class in
5757-- base?
5858
59−#if MIN_VERSION_deepseq(1,4,3)
6059#define NFDATA1_INSTANCE(STREAM) \
6160instance NFData1 (STREAM Identity) where { \
6261 {-# INLINE liftRnf #-}; \
6362 liftRnf f (STREAM xs) = runIdentity $ P.foldl' (\_ x -> f x) () xs}
64−#else
65−#define NFDATA1_INSTANCE(STREAM)
66−#endif
6763
6864#define LIST_INSTANCES(STREAM) \
6965instance IsList (STREAM Identity a) where { \
src/Streamly/Internal/Data/Stream/IsStream/Transform.hs+1−2
@@ -218,10 +218,9 @@ import Control.Monad (void)
218218import Control.Monad.Catch (MonadCatch)
219219import Control.Monad.IO.Class (MonadIO(..))
220220import Control.Monad.Trans.Class (MonadTrans(..))
221−import Data.Either (isLeft, isRight)
221+import Data.Either (isLeft, isRight, fromLeft, fromRight)
222222import Data.Kind (Type)
223223import Data.Maybe (isJust, fromJust)
224−import Streamly.Internal.BaseCompat (fromLeft, fromRight)
225224import Streamly.Internal.Data.Fold.Type (Fold (..))
226225import Streamly.Internal.Data.Pipe.Type (Pipe (..))
227226import Streamly.Internal.Data.Stream.IsStream.Combinators
src/Streamly/Internal/FileSystem/Dir.hs+1−2
@@ -51,7 +51,7 @@ module Streamly.Internal.FileSystem.Dir
5151where
5252
5353import Control.Monad.IO.Class (MonadIO(..))
54−import Data.Either (isRight, isLeft)
54+import Data.Either (isRight, isLeft, fromLeft, fromRight)
5555-- import Data.Word (Word8)
5656-- import Foreign.ForeignPtr (withForeignPtr)
5757-- import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
@@ -62,7 +62,6 @@ import Data.Either (isRight, isLeft)
6262import Prelude hiding (read)
6363
6464-- import Streamly.Data.Fold (Fold)
65−import Streamly.Internal.BaseCompat (fromLeft, fromRight)
6665import Streamly.Internal.Data.Unfold.Type (Unfold(..))
6766-- import Streamly.Internal.Data.Array.Foreign.Type
6867-- (Array(..), writeNUnsafe, defaultChunkSize, shrinkToFit,
test/Streamly/Test/Unicode/Char.hs+1
@@ -16,6 +16,7 @@ module Streamly.Test.Unicode.Char (main) where
1616import Control.Monad (when)
1717import Data.Char (chr, isSpace, ord, toUpper)
1818import Data.List (intercalate, isPrefixOf)
19+import Data.Function ((&))
1920import Streamly.Internal.Unicode.Char
2021 ( NormalizationMode(NFC, NFD, NFKC, NFKD)
2122 , normalize