on master help sign in
Remove remaining code meant for GHC < 8.4
cc7ac6cHarendra Kumar
benchmark/lib/Streamly/Benchmark/Common.hs−4
@@ -78,10 +78,6 @@ o_n_stack_prefix name = name ++ "/o-n-stack"
78-- Benchmarking utilities
78-- Benchmarking utilities
79-------------------------------------------------------------------------------
79-------------------------------------------------------------------------------
80
80
81−#if !MIN_VERSION_deepseq(1,4,3)
82−instance NFData Ordering where rnf = (`seq` ())
83−#endif
84−
85-- XXX once we convert all the functions to use this we can rename this to
81-- XXX once we convert all the functions to use this we can rename this to
86-- benchIOSink
82-- benchIOSink
87{-# INLINE benchIOSink1 #-}
83{-# INLINE benchIOSink1 #-}
core/src/Streamly/Internal/BaseCompat.hs−9
@@ -10,20 +10,14 @@
10module Streamly.Internal.BaseCompat
10module Streamly.Internal.BaseCompat
11 (
11 (
12 (#.)
12 (#.)
13− , errorWithoutStackTrace
14− , fromLeft
15− , fromRight
16 , unsafeWithForeignPtr
13 , unsafeWithForeignPtr
17− , oneShot
18 )
14 )
19where
15where
20
16
21import Data.Coerce (Coercible, coerce)
17import Data.Coerce (Coercible, coerce)
22−import Data.Either (fromRight, fromLeft)
23import GHC.ForeignPtr (ForeignPtr(..))
18import GHC.ForeignPtr (ForeignPtr(..))
24import GHC.Ptr (Ptr(..))
19import GHC.Ptr (Ptr(..))
25
20
26−import qualified GHC.Exts as GHCExt
27#if MIN_VERSION_base(4,15,0)
21#if MIN_VERSION_base(4,15,0)
28import qualified GHC.ForeignPtr as GHCForeignPtr
22import qualified GHC.ForeignPtr as GHCForeignPtr
29#else
23#else
@@ -41,6 +35,3 @@ unsafeWithForeignPtr = GHCForeignPtr.unsafeWithForeignPtr
41#else
35#else
42unsafeWithForeignPtr = withForeignPtr
36unsafeWithForeignPtr = withForeignPtr
43#endif
37#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
206#endif
206#endif
207
207
208import Control.Exception (assert)
208import Control.Exception (assert)
209−import Control.DeepSeq (NFData(..))
209+import Control.DeepSeq (NFData(..), NFData1(..))
210−#if MIN_VERSION_deepseq(1,4,3)
211−import Control.DeepSeq (NFData1(..))
212−#endif
213import Control.Monad (when, void)
210import Control.Monad (when, void)
214import Control.Monad.IO.Class (MonadIO(..))
211import Control.Monad.IO.Class (MonadIO(..))
215import Data.Bits (shiftR, (.|.), (.&.))
212import Data.Bits (shiftR, (.|.), (.&.))
@@ -239,7 +236,6 @@ import GHC.ForeignPtr (mallocForeignPtrAlignedBytes)
239#endif
236#endif
240import GHC.Ptr (Ptr(..))
237import GHC.Ptr (Ptr(..))
241
238
242−import Streamly.Internal.BaseCompat
243import Streamly.Internal.Data.Fold.Type (Fold(..))
239import Streamly.Internal.Data.Fold.Type (Fold(..))
244import Streamly.Internal.Data.Producer.Type (Producer (..))
240import Streamly.Internal.Data.Producer.Type (Producer (..))
245import Streamly.Internal.Data.Stream.Serial (SerialT(..))
241import Streamly.Internal.Data.Stream.Serial (SerialT(..))
@@ -2287,11 +2283,9 @@ instance NFData (Array a) where
2287 {-# INLINE rnf #-}
2283 {-# INLINE rnf #-}
2288 rnf Array {} = ()
2284 rnf Array {} = ()
2289
2285
2290−#if MIN_VERSION_deepseq(1,4,3)
2291instance NFData1 Array where
2286instance NFData1 Array where
2292 {-# INLINE liftRnf #-}
2287 {-# INLINE liftRnf #-}
2293 liftRnf _ Array{} = ()
2288 liftRnf _ Array{} = ()
2294−#endif
2295
2289
2296-- | Strip elements which match with predicate from both ends.
2290-- | Strip elements which match with predicate from both ends.
2297--
2291--
core/src/Streamly/Internal/Data/Array/Foreign/Type.hs+1−6
@@ -77,10 +77,7 @@ where
77#include "inline.hs"
77#include "inline.hs"
78
78
79import Control.Exception (assert)
79import Control.Exception (assert)
80−import Control.DeepSeq (NFData(..))
80+import Control.DeepSeq (NFData(..), NFData1(..))
81−#if MIN_VERSION_deepseq(1,4,3)
82−import Control.DeepSeq (NFData1(..))
83−#endif
84import Control.Monad.IO.Class (MonadIO(..))
81import Control.Monad.IO.Class (MonadIO(..))
85import Data.Functor.Identity (Identity(..))
82import Data.Functor.Identity (Identity(..))
86import Data.Word (Word8)
83import Data.Word (Word8)
@@ -741,10 +738,8 @@ instance NFData (Array a) where
741 {-# INLINE rnf #-}
738 {-# INLINE rnf #-}
742 rnf Array {} = ()
739 rnf Array {} = ()
743
740
744−#if MIN_VERSION_deepseq(1,4,3)
745instance NFData1 Array where
741instance NFData1 Array where
746 liftRnf _ Array{} = ()
742 liftRnf _ Array{} = ()
747−#endif
748
743
749instance (Storable a, Ord a) => Ord (Array a) where
744instance (Storable a, Ord a) => Ord (Array a) where
750 {-# INLINE compare #-}
745 {-# INLINE compare #-}
core/src/Streamly/Internal/Data/Fold.hs+1−2
@@ -258,12 +258,11 @@ module Streamly.Internal.Data.Fold
258where
258where
259
259
260import Data.Bifunctor (first)
260import Data.Bifunctor (first)
261−import Data.Either (isLeft, isRight)
261+import Data.Either (isLeft, isRight, fromLeft, fromRight)
262import Data.Functor.Identity (Identity(..))
262import Data.Functor.Identity (Identity(..))
263import Data.Int (Int64)
263import Data.Int (Int64)
264import Data.Map.Strict (Map)
264import Data.Map.Strict (Map)
265import Data.Maybe (isJust, fromJust)
265import Data.Maybe (isJust, fromJust)
266−import Streamly.Internal.BaseCompat (fromLeft, fromRight)
267import Streamly.Internal.Data.Either.Strict
266import Streamly.Internal.Data.Either.Strict
268 (Either'(..), fromLeft', fromRight', isLeft', isRight')
267 (Either'(..), fromLeft', fromRight', isLeft', isRight')
269import Streamly.Internal.Data.Pipe.Type (Pipe (..), PipeState(..))
268import Streamly.Internal.Data.Pipe.Type (Pipe (..), PipeState(..))
core/src/Streamly/Internal/Data/List.hs+9−14
@@ -63,9 +63,7 @@ where
63
63
64import Control.Arrow (second)
64import Control.Arrow (second)
65import Control.DeepSeq (NFData(..))
65import Control.DeepSeq (NFData(..))
66−#if MIN_VERSION_deepseq(1,4,3)
67import Control.DeepSeq (NFData1(..))
66import Control.DeepSeq (NFData1(..))
68−#endif
69import Data.Functor.Identity (Identity, runIdentity)
67import Data.Functor.Identity (Identity, runIdentity)
70import GHC.Exts (IsList(..), IsString(..))
68import GHC.Exts (IsList(..), IsString(..))
71#if __GLASGOW_HASKELL__ < 808
69#if __GLASGOW_HASKELL__ < 808
@@ -93,12 +91,10 @@ import qualified Streamly.Internal.Data.Stream.StreamK.Type as K
93--
91--
94-- @since 0.6.0
92-- @since 0.6.0
95newtype List a = List { toSerial :: SerialT Identity a }
93newtype List a = List { toSerial :: SerialT Identity a }
94+ deriving
96− deriving (Show, Read, Eq, Ord, NFData
95+ ( Show, Read, Eq, Ord, NFData , NFData1
97−#if MIN_VERSION_deepseq(1,4,3)
98− , NFData1
99−#endif
100− , Semigroup, Monoid, Functor, Foldable
96+ , Semigroup, Monoid, Functor, Foldable
101− , Applicative, Traversable, Monad)
97+ , Applicative, Traversable, Monad)
102
98
103instance (a ~ Char) => IsString (List a) where
99instance (a ~ Char) => IsString (List a) where
104 {-# INLINE fromString #-}
100 {-# INLINE fromString #-}
@@ -158,12 +154,11 @@ pattern Cons x xs <-
158--
154--
159-- @since 0.6.0
155-- @since 0.6.0
160newtype ZipList a = ZipList { toZipSerial :: ZipSerialM Identity a }
156newtype ZipList a = ZipList { toZipSerial :: ZipSerialM Identity a }
157+ deriving
161− deriving (Show, Read, Eq, Ord, NFData
158+ ( Show, Read, Eq, Ord, NFData , NFData1
162−#if MIN_VERSION_deepseq(1,4,3)
163− , NFData1
164−#endif
165− , Semigroup, Monoid, Functor, Foldable
159+ , Semigroup, Monoid, Functor, Foldable
166− , Applicative, Traversable)
160+ , Applicative, Traversable
161+ )
167
162
168instance (a ~ Char) => IsString (ZipList a) where
163instance (a ~ Char) => IsString (ZipList a) where
169 {-# INLINE fromString #-}
164 {-# INLINE fromString #-}
core/src/Streamly/Internal/Data/Refold/Type.hs−3
@@ -44,9 +44,6 @@ module Streamly.Internal.Data.Refold.Type
44where
44where
45
45
46import Control.Monad ((>=>))
46import Control.Monad ((>=>))
47−#if __GLASGOW_HASKELL__ < 804
48−import Data.Semigroup (Semigroup((<>)))
49−#endif
50import Fusion.Plugin.Types (Fuse(..))
47import Fusion.Plugin.Types (Fuse(..))
51import Streamly.Internal.Data.Fold.Step (Step(..), mapMStep)
48import Streamly.Internal.Data.Fold.Step (Step(..), mapMStep)
52
49
core/src/Streamly/Internal/Data/Stream/Instances.hs−4
@@ -56,14 +56,10 @@ instance (MonadState s m CONSTRAINT) => MonadState s (STREAM m) where { \
56-- well, because they do not get inlined. Need to add INLINE in Ord class in
56-- well, because they do not get inlined. Need to add INLINE in Ord class in
57-- base?
57-- base?
58
58
59−#if MIN_VERSION_deepseq(1,4,3)
60#define NFDATA1_INSTANCE(STREAM) \
59#define NFDATA1_INSTANCE(STREAM) \
61instance NFData1 (STREAM Identity) where { \
60instance NFData1 (STREAM Identity) where { \
62 {-# INLINE liftRnf #-}; \
61 {-# INLINE liftRnf #-}; \
63 liftRnf f (STREAM xs) = runIdentity $ P.foldl' (\_ x -> f x) () xs}
62 liftRnf f (STREAM xs) = runIdentity $ P.foldl' (\_ x -> f x) () xs}
64−#else
65−#define NFDATA1_INSTANCE(STREAM)
66−#endif
67
63
68#define LIST_INSTANCES(STREAM) \
64#define LIST_INSTANCES(STREAM) \
69instance IsList (STREAM Identity a) where { \
65instance 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
47where
47where
48
48
49import Control.Applicative (liftA2)
49import Control.Applicative (liftA2)
50−import Control.DeepSeq (NFData(..))
50+import Control.DeepSeq (NFData(..), NFData1(..))
51−#if MIN_VERSION_deepseq(1,4,3)
52−import Control.DeepSeq (NFData1(..))
53−#endif
54import Control.Monad.Base (MonadBase(..), liftBaseDefault)
51import Control.Monad.Base (MonadBase(..), liftBaseDefault)
55import Control.Monad.Catch (MonadThrow, throwM)
52import Control.Monad.Catch (MonadThrow, throwM)
56import Control.Monad.IO.Class (MonadIO(..))
53import Control.Monad.IO.Class (MonadIO(..))
@@ -64,11 +61,11 @@ import Data.Semigroup (Endo(..))
64#if __GLASGOW_HASKELL__ < 808
61#if __GLASGOW_HASKELL__ < 808
65import Data.Semigroup (Semigroup(..))
62import Data.Semigroup (Semigroup(..))
66#endif
63#endif
67−import GHC.Exts (IsList(..), IsString(..))
64+import GHC.Exts (IsList(..), IsString(..), oneShot)
68import Text.Read
65import Text.Read
69 ( Lexeme(Ident), lexP, parens, prec, readPrec, readListPrec
66 ( Lexeme(Ident), lexP, parens, prec, readPrec, readListPrec
70 , readListPrecDefault)
67 , readListPrecDefault)
71−import Streamly.Internal.BaseCompat ((#.), errorWithoutStackTrace, oneShot)
68+import Streamly.Internal.BaseCompat ((#.))
72import Streamly.Internal.Data.Fold.Type (Fold)
69import Streamly.Internal.Data.Fold.Type (Fold)
73import Streamly.Internal.Data.Maybe.Strict (Maybe'(..), toMaybe)
70import Streamly.Internal.Data.Maybe.Strict (Maybe'(..), toMaybe)
74import Streamly.Internal.Data.Stream.StreamK.Type
71import Streamly.Internal.Data.Stream.StreamK.Type
@@ -80,7 +77,7 @@ import qualified Streamly.Internal.Data.Stream.StreamD.Transform as D
80import qualified Streamly.Internal.Data.Stream.StreamD.Type as D
77import qualified Streamly.Internal.Data.Stream.StreamD.Type as D
81import qualified Streamly.Internal.Data.Stream.StreamK.Type as K
78import qualified Streamly.Internal.Data.Stream.StreamK.Type as K
82
79
83−import Prelude hiding (map, mapM, errorWithoutStackTrace, repeat)
80+import Prelude hiding (map, mapM, repeat)
84
81
85#include "Instances.hs"
82#include "Instances.hs"
86#include "inline.hs"
83#include "inline.hs"
core/src/Streamly/Internal/Data/Stream/StreamK/Type.hs−3
@@ -98,9 +98,6 @@ import Control.Monad (ap, (>=>))
98import Control.Monad.Reader.Class (MonadReader(..))
98import Control.Monad.Reader.Class (MonadReader(..))
99import Control.Monad.Trans.Class (MonadTrans(lift))
99import Control.Monad.Trans.Class (MonadTrans(lift))
100import Data.Function (fix)
100import Data.Function (fix)
101−#if __GLASGOW_HASKELL__ < 804
102−import Data.Semigroup (Semigroup(..))
103−#endif
104import Streamly.Internal.Data.SVar.Type (State, adaptState, defState)
101import Streamly.Internal.Data.SVar.Type (State, adaptState, defState)
105import Prelude hiding
102import Prelude hiding
106 (map, mapM, concatMap, foldr, repeat, null, reverse, tail, init)
103 (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
24where
24where
25
25
26import Control.Applicative (liftA2)
26import Control.Applicative (liftA2)
27−import Control.DeepSeq (NFData(..))
27+import Control.DeepSeq (NFData(..), NFData1(..))
28−#if MIN_VERSION_deepseq(1,4,3)
29−import Control.DeepSeq (NFData1(..))
30−#endif
31import Data.Foldable (Foldable(foldl'), fold)
28import Data.Foldable (Foldable(foldl'), fold)
32import Data.Functor.Identity (Identity(..), runIdentity)
29import Data.Functor.Identity (Identity(..), runIdentity)
33import Data.Maybe (fromMaybe)
30import Data.Maybe (fromMaybe)
@@ -35,11 +32,11 @@ import Data.Semigroup (Endo(..))
35#if __GLASGOW_HASKELL__ < 808
32#if __GLASGOW_HASKELL__ < 808
36import Data.Semigroup (Semigroup(..))
33import Data.Semigroup (Semigroup(..))
37#endif
34#endif
38−import GHC.Exts (IsList(..), IsString(..))
35+import GHC.Exts (IsList(..), IsString(..), oneShot)
39import Text.Read
36import Text.Read
40 ( Lexeme(Ident), lexP, parens, prec, readPrec, readListPrec
37 ( Lexeme(Ident), lexP, parens, prec, readPrec, readListPrec
41 , readListPrecDefault)
38 , readListPrecDefault)
42−import Streamly.Internal.BaseCompat ((#.), errorWithoutStackTrace, oneShot)
39+import Streamly.Internal.BaseCompat ((#.))
43import Streamly.Internal.Data.Maybe.Strict (Maybe'(..), toMaybe)
40import Streamly.Internal.Data.Maybe.Strict (Maybe'(..), toMaybe)
44import Streamly.Internal.Data.Stream.Serial (SerialT(..))
41import Streamly.Internal.Data.Stream.Serial (SerialT(..))
45import Streamly.Internal.Data.Stream.StreamK.Type (Stream)
42import Streamly.Internal.Data.Stream.StreamK.Type (Stream)
@@ -50,7 +47,7 @@ import qualified Streamly.Internal.Data.Stream.StreamK.Type as K
50import qualified Streamly.Internal.Data.Stream.StreamD as D
47import qualified Streamly.Internal.Data.Stream.StreamD as D
51import qualified Streamly.Internal.Data.Stream.Serial as Serial
48import qualified Streamly.Internal.Data.Stream.Serial as Serial
52
49
53−import Prelude hiding (map, repeat, zipWith, errorWithoutStackTrace)
50+import Prelude hiding (map, repeat, zipWith)
54
51
55#include "Instances.hs"
52#include "Instances.hs"
56
53
src/Streamly/Internal/Data/Stream/Instances.hs−4
@@ -56,14 +56,10 @@ instance (MonadState s m CONSTRAINT) => MonadState s (STREAM m) where { \
56-- well, because they do not get inlined. Need to add INLINE in Ord class in
56-- well, because they do not get inlined. Need to add INLINE in Ord class in
57-- base?
57-- base?
58
58
59−#if MIN_VERSION_deepseq(1,4,3)
60#define NFDATA1_INSTANCE(STREAM) \
59#define NFDATA1_INSTANCE(STREAM) \
61instance NFData1 (STREAM Identity) where { \
60instance NFData1 (STREAM Identity) where { \
62 {-# INLINE liftRnf #-}; \
61 {-# INLINE liftRnf #-}; \
63 liftRnf f (STREAM xs) = runIdentity $ P.foldl' (\_ x -> f x) () xs}
62 liftRnf f (STREAM xs) = runIdentity $ P.foldl' (\_ x -> f x) () xs}
64−#else
65−#define NFDATA1_INSTANCE(STREAM)
66−#endif
67
63
68#define LIST_INSTANCES(STREAM) \
64#define LIST_INSTANCES(STREAM) \
69instance IsList (STREAM Identity a) where { \
65instance IsList (STREAM Identity a) where { \
src/Streamly/Internal/Data/Stream/IsStream/Transform.hs+1−2
@@ -218,10 +218,9 @@ import Control.Monad (void)
218import Control.Monad.Catch (MonadCatch)
218import Control.Monad.Catch (MonadCatch)
219import Control.Monad.IO.Class (MonadIO(..))
219import Control.Monad.IO.Class (MonadIO(..))
220import Control.Monad.Trans.Class (MonadTrans(..))
220import Control.Monad.Trans.Class (MonadTrans(..))
221−import Data.Either (isLeft, isRight)
221+import Data.Either (isLeft, isRight, fromLeft, fromRight)
222import Data.Kind (Type)
222import Data.Kind (Type)
223import Data.Maybe (isJust, fromJust)
223import Data.Maybe (isJust, fromJust)
224−import Streamly.Internal.BaseCompat (fromLeft, fromRight)
225import Streamly.Internal.Data.Fold.Type (Fold (..))
224import Streamly.Internal.Data.Fold.Type (Fold (..))
226import Streamly.Internal.Data.Pipe.Type (Pipe (..))
225import Streamly.Internal.Data.Pipe.Type (Pipe (..))
227import Streamly.Internal.Data.Stream.IsStream.Combinators
226import Streamly.Internal.Data.Stream.IsStream.Combinators
src/Streamly/Internal/FileSystem/Dir.hs+1−2
@@ -51,7 +51,7 @@ module Streamly.Internal.FileSystem.Dir
51where
51where
52
52
53import Control.Monad.IO.Class (MonadIO(..))
53import Control.Monad.IO.Class (MonadIO(..))
54−import Data.Either (isRight, isLeft)
54+import Data.Either (isRight, isLeft, fromLeft, fromRight)
55-- import Data.Word (Word8)
55-- import Data.Word (Word8)
56-- import Foreign.ForeignPtr (withForeignPtr)
56-- import Foreign.ForeignPtr (withForeignPtr)
57-- import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
57-- import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
@@ -62,7 +62,6 @@ import Data.Either (isRight, isLeft)
62import Prelude hiding (read)
62import Prelude hiding (read)
63
63
64-- import Streamly.Data.Fold (Fold)
64-- import Streamly.Data.Fold (Fold)
65−import Streamly.Internal.BaseCompat (fromLeft, fromRight)
66import Streamly.Internal.Data.Unfold.Type (Unfold(..))
65import Streamly.Internal.Data.Unfold.Type (Unfold(..))
67-- import Streamly.Internal.Data.Array.Foreign.Type
66-- import Streamly.Internal.Data.Array.Foreign.Type
68-- (Array(..), writeNUnsafe, defaultChunkSize, shrinkToFit,
67-- (Array(..), writeNUnsafe, defaultChunkSize, shrinkToFit,
test/Streamly/Test/Unicode/Char.hs+1
@@ -16,6 +16,7 @@ module Streamly.Test.Unicode.Char (main) where
16import Control.Monad (when)
16import Control.Monad (when)
17import Data.Char (chr, isSpace, ord, toUpper)
17import Data.Char (chr, isSpace, ord, toUpper)
18import Data.List (intercalate, isPrefixOf)
18import Data.List (intercalate, isPrefixOf)
19+import Data.Function ((&))
19import Streamly.Internal.Unicode.Char
20import Streamly.Internal.Unicode.Char
20 ( NormalizationMode(NFC, NFD, NFKC, NFKD)
21 ( NormalizationMode(NFC, NFD, NFKC, NFKD)
21 , normalize
22 , normalize