on master help sign in
Drop GHC 8.x to 8.2.x Support
07bf70dRanjeet Kumar Ranjan
.circleci/config.yml+4−4
@@ -404,10 +404,10 @@ workflows:
404 #- cabal-ghc-8.6.5
404 #- cabal-ghc-8.6.5
405 #- cabal-ghc-8_4_4:
405 #- cabal-ghc-8_4_4:
406 # name: GHC 8.4.4 + x86 + debug
406 # name: GHC 8.4.4 + x86 + debug
407− - cabal-ghc-8_2_2:
407+ #- cabal-ghc-8_2_2:
408− name: GHC 8.2.2 + no-test + no-bench + no-docs
408+ # name: GHC 8.2.2 + no-test + no-bench + no-docs
409− - cabal-ghc-8_0_2:
409+ #- cabal-ghc-8_0_2:
410− name: GHC 8.0.2 + no-test + no-bench + no-docs
410+ # name: GHC 8.0.2 + no-test + no-bench + no-docs
411 #- cabal-ghc-7.10.3
411 #- cabal-ghc-7.10.3
412 - cabal-ghcjs-8_4:
412 - cabal-ghcjs-8_4:
413 name: GHCJS 8.4 + no-test + no-docs
413 name: GHCJS 8.4 + no-test + no-docs
benchmark/Streamly/Benchmark/Data/Parser.hs−4
@@ -20,11 +20,7 @@ import Data.Functor (($>))
20import Data.Maybe (fromMaybe)
20import Data.Maybe (fromMaybe)
21import Data.Monoid (Sum(..))
21import Data.Monoid (Sum(..))
22import GHC.Magic (inline)
22import GHC.Magic (inline)
23−#if __GLASGOW_HASKELL__ >= 802
24import GHC.Magic (noinline)
23import GHC.Magic (noinline)
25−#else
26−#define noinline
27−#endif
28import System.IO (Handle)
24import System.IO (Handle)
29import System.Random (randomRIO)
25import System.Random (randomRIO)
30import Prelude
26import Prelude
benchmark/Streamly/Benchmark/FileSystem/Handle.hs−4
@@ -17,10 +17,6 @@
17{-# LANGUAGE TemplateHaskell #-}
17{-# LANGUAGE TemplateHaskell #-}
18{-# OPTIONS_GHC -fplugin Test.Inspection.Plugin #-}
18{-# OPTIONS_GHC -fplugin Test.Inspection.Plugin #-}
19#endif
19#endif
20−
21−#if __GLASGOW_HASKELL__ >= 800
22−#endif
23−
24import Streamly.Benchmark.Common.Handle (mkHandleBenchEnv)
20import Streamly.Benchmark.Common.Handle (mkHandleBenchEnv)
25
21
26import qualified Handle.ReadWrite as RW
22import qualified Handle.ReadWrite as RW
benchmark/Streamly/Benchmark/FileSystem/Handle/Read.hs−4
@@ -24,11 +24,7 @@ where
24
24
25import Data.Word (Word8)
25import Data.Word (Word8)
26import GHC.Magic (inline)
26import GHC.Magic (inline)
27−#if __GLASGOW_HASKELL__ >= 802
28import GHC.Magic (noinline)
27import GHC.Magic (noinline)
29−#else
30−#define noinline
31−#endif
32import System.IO (Handle)
28import System.IO (Handle)
33
29
34import qualified Streamly.FileSystem.Handle as FH
30import qualified Streamly.FileSystem.Handle as FH
benchmark/lib/Streamly/Benchmark/Common.hs−2
@@ -1,7 +1,5 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE CPP #-}
2−#if __GLASGOW_HASKELL__ >= 800
3{-# OPTIONS_GHC -Wno-orphans #-}
2{-# OPTIONS_GHC -Wno-orphans #-}
4−#endif
5
3
6-- |
4-- |
7-- Module : Streamly.Benchmark.Common
5-- Module : Streamly.Benchmark.Common
benchmark/lib/Streamly/Benchmark/Prelude.hs−3
@@ -68,9 +68,6 @@ import Control.Applicative (liftA2)
68import Control.DeepSeq (NFData(..))
68import Control.DeepSeq (NFData(..))
69import Control.Exception (try)
69import Control.Exception (try)
70import Data.Functor.Identity (Identity)
70import Data.Functor.Identity (Identity)
71−#if !(MIN_VERSION_base(4,11,0))
72−import Data.Semigroup (Semigroup((<>)))
73−#endif
74import GHC.Exception (ErrorCall)
71import GHC.Exception (ErrorCall)
75import Prelude hiding (mapM)
72import Prelude hiding (mapM)
76import System.Random (randomRIO)
73import System.Random (randomRIO)
core/src/Streamly/Internal/BaseCompat.hs+3−23
@@ -19,38 +19,22 @@ module Streamly.Internal.BaseCompat
19where
19where
20
20
21import Data.Coerce (Coercible, coerce)
21import Data.Coerce (Coercible, coerce)
22−#if MIN_VERSION_base(4,10,0)
23import Data.Either (fromRight, fromLeft)
22import Data.Either (fromRight, fromLeft)
24−import qualified GHC.Exts as GHCExt
25−#endif
26import GHC.ForeignPtr (ForeignPtr(..))
23import GHC.ForeignPtr (ForeignPtr(..))
27import GHC.Ptr (Ptr(..))
24import GHC.Ptr (Ptr(..))
25+
26+import qualified GHC.Exts as GHCExt
28#if MIN_VERSION_base(4,15,0)
27#if MIN_VERSION_base(4,15,0)
29import qualified GHC.ForeignPtr as GHCForeignPtr
28import qualified GHC.ForeignPtr as GHCForeignPtr
30#else
29#else
31import Foreign.ForeignPtr (withForeignPtr)
30import Foreign.ForeignPtr (withForeignPtr)
32#endif
31#endif
33
32
33+
34{-# INLINE (#.) #-}
34{-# INLINE (#.) #-}
35(#.) :: Coercible b c => (b -> c) -> (a -> b) -> (a -> c)
35(#.) :: Coercible b c => (b -> c) -> (a -> b) -> (a -> c)
36(#.) _f = coerce
36(#.) _f = coerce
37
37
38−#if !(MIN_VERSION_base(4,9,0))
39−{-# NOINLINE errorWithoutStackTrace #-}
40−errorWithoutStackTrace :: String -> a
41−errorWithoutStackTrace = error
42−#endif
43−
44−#if !(MIN_VERSION_base(4,10,0))
45−fromLeft :: a -> Either a b -> a
46−fromLeft _ (Left a) = a
47−fromLeft a _ = a
48−
49−fromRight :: b -> Either a b -> b
50−fromRight _ (Right b) = b
51−fromRight b _ = b
52−#endif
53−
54unsafeWithForeignPtr :: ForeignPtr a -> (Ptr a -> IO b) -> IO b
38unsafeWithForeignPtr :: ForeignPtr a -> (Ptr a -> IO b) -> IO b
55#if MIN_VERSION_base(4,15,0)
39#if MIN_VERSION_base(4,15,0)
56unsafeWithForeignPtr = GHCForeignPtr.unsafeWithForeignPtr
40unsafeWithForeignPtr = GHCForeignPtr.unsafeWithForeignPtr
@@ -59,8 +43,4 @@ unsafeWithForeignPtr = withForeignPtr
59#endif
43#endif
60
44
61oneShot :: (a -> b) -> a -> b
45oneShot :: (a -> b) -> a -> b
62−#if MIN_VERSION_base(4,10,0)
63oneShot = GHCExt.oneShot
46oneShot = GHCExt.oneShot
64−#else
65−oneShot = id
66−#endif
core/src/Streamly/Internal/Data/Array/Foreign.hs−3
@@ -120,9 +120,6 @@ import Control.Exception (assert)
120import Control.Monad (when)
120import Control.Monad (when)
121import Control.Monad.IO.Class (MonadIO(..))
121import Control.Monad.IO.Class (MonadIO(..))
122import Data.Functor.Identity (Identity)
122import Data.Functor.Identity (Identity)
123−#if !(MIN_VERSION_base(4,11,0))
124−import Data.Semigroup ((<>))
125−#endif
126import Data.Word (Word8)
123import Data.Word (Word8)
127import Foreign.C.String (CString)
124import Foreign.C.String (CString)
128import Foreign.Ptr (plusPtr, castPtr)
125import Foreign.Ptr (plusPtr, castPtr)
core/src/Streamly/Internal/Data/Array/Foreign/Mut/Type.hs−4
@@ -231,11 +231,7 @@ import GHC.Base
231#ifndef USE_FOREIGN_PTR
231#ifndef USE_FOREIGN_PTR
232import GHC.Base (RealWorld, MutableByteArray#)
232import GHC.Base (RealWorld, MutableByteArray#)
233#endif
233#endif
234−#if __GLASGOW_HASKELL__ < 802
235−#define noinline
236−#else
237import GHC.Base (noinline)
234import GHC.Base (noinline)
238−#endif
239import GHC.Exts (unsafeCoerce#)
235import GHC.Exts (unsafeCoerce#)
240import GHC.ForeignPtr (ForeignPtr(..), ForeignPtrContents(..))
236import GHC.ForeignPtr (ForeignPtr(..), ForeignPtrContents(..))
241#ifdef USE_C_MALLOC
237#ifdef USE_C_MALLOC
core/src/Streamly/Internal/Data/Array/Stream/Fold/Foreign.hs−2
@@ -258,10 +258,8 @@ instance MonadThrow m => Applicative (Fold m a) where
258 {-# INLINE (*>) #-}
258 {-# INLINE (*>) #-}
259 (*>) = serial_
259 (*>) = serial_
260
260
261−#if MIN_VERSION_base(4,10,0)
262 {-# INLINE liftA2 #-}
261 {-# INLINE liftA2 #-}
263 liftA2 f x = (<*>) (fmap f x)
262 liftA2 f x = (<*>) (fmap f x)
264−#endif
265
263
266-------------------------------------------------------------------------------
264-------------------------------------------------------------------------------
267-- Monad
265-- Monad
core/src/Streamly/Internal/Data/Fold.hs−9
@@ -263,9 +263,6 @@ import 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−#if __GLASGOW_HASKELL__ < 804
267−import Data.Semigroup (Semigroup((<>)))
268−#endif
269import Streamly.Internal.BaseCompat (fromLeft, fromRight)
266import Streamly.Internal.BaseCompat (fromLeft, fromRight)
270import Streamly.Internal.Data.Either.Strict
267import Streamly.Internal.Data.Either.Strict
271 (Either'(..), fromLeft', fromRight', isLeft', isRight')
268 (Either'(..), fromLeft', fromRight', isLeft', isRight')
@@ -838,9 +835,6 @@ sconcat = foldl' (<>)
838{-# INLINE mconcat #-}
835{-# INLINE mconcat #-}
839mconcat ::
836mconcat ::
840 ( Monad m
837 ( Monad m
841−#if !MIN_VERSION_base(4,11,0)
842− , Semigroup a
843−#endif
844 , Monoid a) => Fold m a a
838 , Monoid a) => Fold m a a
845mconcat = sconcat mempty
839mconcat = sconcat mempty
846
840
@@ -856,9 +850,6 @@ mconcat = sconcat mempty
856-- @since 0.7.0
850-- @since 0.7.0
857{-# INLINE foldMap #-}
851{-# INLINE foldMap #-}
858foldMap :: (Monad m, Monoid b
852foldMap :: (Monad m, Monoid b
859−#if !MIN_VERSION_base(4,11,0)
860− , Semigroup b
861−#endif
862 ) => (a -> b) -> Fold m a b
853 ) => (a -> b) -> Fold m a b
863foldMap f = lmap f mconcat
854foldMap f = lmap f mconcat
864
855
core/src/Streamly/Internal/Data/List.hs+1−4
@@ -67,11 +67,10 @@ import Control.DeepSeq (NFData(..))
67import Control.DeepSeq (NFData1(..))
67import Control.DeepSeq (NFData1(..))
68#endif
68#endif
69import Data.Functor.Identity (Identity, runIdentity)
69import Data.Functor.Identity (Identity, runIdentity)
70+import GHC.Exts (IsList(..), IsString(..))
70#if __GLASGOW_HASKELL__ < 808
71#if __GLASGOW_HASKELL__ < 808
71import Data.Semigroup (Semigroup(..))
72import Data.Semigroup (Semigroup(..))
72#endif
73#endif
73−import GHC.Exts (IsList(..), IsString(..))
74−
75import Streamly.Internal.Data.Stream.Serial (SerialT(..))
74import Streamly.Internal.Data.Stream.Serial (SerialT(..))
76import Streamly.Internal.Data.Stream.Zip (ZipSerialM(..))
75import Streamly.Internal.Data.Stream.Zip (ZipSerialM(..))
77
76
@@ -148,9 +147,7 @@ pattern Cons x xs <-
148
147
149 Cons x xs = List $ Serial.cons x (toSerial xs)
148 Cons x xs = List $ Serial.cons x (toSerial xs)
150
149
151−#if __GLASGOW_HASKELL__ >= 802
152{-# COMPLETE Nil, Cons #-}
150{-# COMPLETE Nil, Cons #-}
153−#endif
154
151
155------------------------------------------------------------------------------
152------------------------------------------------------------------------------
156-- ZipList
153-- ZipList
core/src/Streamly/Internal/Data/Parser/ParserD/Type.hs+1−2
@@ -905,10 +905,9 @@ instance MonadThrow m => Applicative (Parser m a) where
905 {-# INLINE (*>) #-}
905 {-# INLINE (*>) #-}
906 (*>) = split_
906 (*>) = split_
907
907
908−#if MIN_VERSION_base(4,10,0)
909 {-# INLINE liftA2 #-}
908 {-# INLINE liftA2 #-}
910 liftA2 f x = (<*>) (fmap f x)
909 liftA2 f x = (<*>) (fmap f x)
911−#endif
910+
912
911
913-------------------------------------------------------------------------------
912-------------------------------------------------------------------------------
914-- Sequential Alternative
913-- Sequential Alternative
core/src/Streamly/Internal/Data/Parser/ParserK/Type.hs+1−10
@@ -36,12 +36,8 @@ import Control.Monad.Catch (MonadCatch, MonadThrow(..))
36import Control.Monad.IO.Class (MonadIO, liftIO)
36import Control.Monad.IO.Class (MonadIO, liftIO)
37import Control.Monad.Reader.Class (MonadReader, ask, local)
37import Control.Monad.Reader.Class (MonadReader, ask, local)
38import Control.Monad.State.Class (MonadState, get, put)
38import Control.Monad.State.Class (MonadState, get, put)
39−#if MIN_VERSION_base(4,9,0)
40import qualified Control.Monad.Fail as Fail
39import qualified Control.Monad.Fail as Fail
41−#endif
40+
42−#if !(MIN_VERSION_base(4,10,0))
43−import Data.Semigroup ((<>))
44−#endif
45
41
46-- | The parse driver result. The driver may stop with a final result, pause
42-- | The parse driver result. The driver may stop with a final result, pause
47-- with a continuation to resume, or fail with an error.
43-- with a continuation to resume, or fail with an error.
@@ -157,10 +153,8 @@ instance Monad m => Applicative (Parser m a) where
157 yield1 s (Error e) = yieldk s (Error e)
153 yield1 s (Error e) = yieldk s (Error e)
158 in runParser m1 lo st yield1
154 in runParser m1 lo st yield1
159
155
160−#if MIN_VERSION_base(4,10,0)
161 {-# INLINE liftA2 #-}
156 {-# INLINE liftA2 #-}
162 liftA2 f x = (<*>) (fmap f x)
157 liftA2 f x = (<*>) (fmap f x)
163−#endif
164
158
165-------------------------------------------------------------------------------
159-------------------------------------------------------------------------------
166-- Monad
160-- Monad
@@ -238,12 +232,9 @@ instance Monad m => Monad (Parser m a) where
238 {-# INLINE fail #-}
232 {-# INLINE fail #-}
239 fail = die
233 fail = die
240#endif
234#endif
241−
242−#if MIN_VERSION_base(4,9,0)
243instance Monad m => Fail.MonadFail (Parser m a) where
235instance Monad m => Fail.MonadFail (Parser m a) where
244 {-# INLINE fail #-}
236 {-# INLINE fail #-}
245 fail = die
237 fail = die
246−#endif
247
238
248instance (MonadThrow m, MonadReader r m, MonadCatch m) =>
239instance (MonadThrow m, MonadReader r m, MonadCatch m) =>
249 MonadReader r (Parser m a) where
240 MonadReader r (Parser m a) where
core/src/Streamly/Internal/Data/Stream/Serial.hs−2
@@ -234,10 +234,8 @@ instance Monad m => Applicative (SerialT m) where
234 (<*>) = apSerial
234 (<*>) = apSerial
235 -- (<*>) = K.apSerial
235 -- (<*>) = K.apSerial
236
236
237−#if MIN_VERSION_base(4,10,0)
238 {-# INLINE liftA2 #-}
237 {-# INLINE liftA2 #-}
239 liftA2 f x = (<*>) (fmap f x)
238 liftA2 f x = (<*>) (fmap f x)
240−#endif
241
239
242 {-# INLINE (*>) #-}
240 {-# INLINE (*>) #-}
243 (*>) = apSequence
241 (*>) = apSequence
core/src/Streamly/Internal/Data/Stream/StreamD/Nesting.hs−4
@@ -153,9 +153,7 @@ import Control.Exception (assert)
153import Control.Monad.Catch (MonadThrow, throwM)
153import Control.Monad.Catch (MonadThrow, throwM)
154import Control.Monad.IO.Class (MonadIO(..))
154import Control.Monad.IO.Class (MonadIO(..))
155import Data.Bits (shiftR, shiftL, (.|.), (.&.))
155import Data.Bits (shiftR, shiftL, (.|.), (.&.))
156−#if __GLASGOW_HASKELL__ >= 801
157import Data.Functor.Identity ( Identity )
156import Data.Functor.Identity ( Identity )
158−#endif
159import Data.Word (Word32)
157import Data.Word (Word32)
160import Foreign.Storable (Storable(..))
158import Foreign.Storable (Storable(..))
161import Fusion.Plugin.Types (Fuse(..))
159import Fusion.Plugin.Types (Fuse(..))
@@ -424,10 +422,8 @@ zipWithM f (Stream stepa ta) (Stream stepb tb) = Stream step (ta, tb, Nothing)
424 Skip sb' -> return $ Skip (sa, sb', Just x)
422 Skip sb' -> return $ Skip (sa, sb', Just x)
425 Stop -> return Stop
423 Stop -> return Stop
426
424
427−#if __GLASGOW_HASKELL__ >= 801
428{-# RULES "zipWithM xs xs"
425{-# RULES "zipWithM xs xs"
429 forall f xs. zipWithM @Identity f xs xs = mapM (\x -> f x x) xs #-}
426 forall f xs. zipWithM @Identity f xs xs = mapM (\x -> f x x) xs #-}
430−#endif
431
427
432{-# INLINE zipWith #-}
428{-# INLINE zipWith #-}
433zipWith :: Monad m => (a -> b -> c) -> Stream m a -> Stream m b -> Stream m c
429zipWith :: Monad m => (a -> b -> c) -> Stream m a -> Stream m b -> Stream m c
core/src/Streamly/Internal/Data/Stream/StreamD/Type.hs−4
@@ -128,9 +128,7 @@ pattern Stream :: (State K.Stream m a -> s -> m (Step s a)) -> s -> Stream m a
128pattern Stream step state <- (unShare -> UnStream step state)
128pattern Stream step state <- (unShare -> UnStream step state)
129 where Stream = UnStream
129 where Stream = UnStream
130
130
131−#if __GLASGOW_HASKELL__ >= 802
132{-# COMPLETE Stream #-}
131{-# COMPLETE Stream #-}
133−#endif
134
132
135------------------------------------------------------------------------------
133------------------------------------------------------------------------------
136-- Primitives
134-- Primitives
@@ -744,10 +742,8 @@ instance Applicative f => Applicative (Stream f) where
744 {-# INLINE (<*>) #-}
742 {-# INLINE (<*>) #-}
745 (<*>) = concatAp
743 (<*>) = concatAp
746
744
747−#if MIN_VERSION_base(4,10,0)
748 {-# INLINE liftA2 #-}
745 {-# INLINE liftA2 #-}
749 liftA2 f x = (<*>) (fmap f x)
746 liftA2 f x = (<*>) (fmap f x)
750−#endif
751
747
752 {-# INLINE (*>) #-}
748 {-# INLINE (*>) #-}
753 (*>) = apSequence
749 (*>) = apSequence
src/Streamly/Internal/Data/SmallArray/Type.hs+9−73
@@ -56,12 +56,8 @@ module Streamly.Internal.Data.SmallArray.Type
56
56
57import GHC.Exts hiding (toList)
57import GHC.Exts hiding (toList)
58import qualified GHC.Exts
58import qualified GHC.Exts
59−
60import Control.Applicative
59import Control.Applicative
61import Control.Monad
60import Control.Monad
62−#if MIN_VERSION_base(4,9,0)
63−import qualified Control.Monad.Fail as Fail
64−#endif
65import Control.Monad.Fix
61import Control.Monad.Fix
66import Control.Monad.Primitive
62import Control.Monad.Primitive
67import Control.Monad.ST
63import Control.Monad.ST
@@ -69,22 +65,12 @@ import Control.Monad.Zip
69import Data.Data
65import Data.Data
70import Data.Foldable as Foldable
66import Data.Foldable as Foldable
71import Data.Functor.Identity
67import Data.Functor.Identity
72−#if !(MIN_VERSION_base(4,10,0))
68+import Data.Functor.Classes (Eq1(..),Ord1(..),Show1(..),Read1(..))
73−import Data.Monoid
74−#endif
75−#if MIN_VERSION_base(4,9,0)
76−import qualified GHC.ST as GHCST
77−import qualified Data.Semigroup as Sem
78−#endif
79−import Text.ParserCombinators.ReadP
80
69
81−#if MIN_VERSION_base(4,9,0) && !MIN_VERSION_base(4,10,0)
70+import qualified Control.Monad.Fail as Fail
82−import GHC.Base (runRW#)
71+import qualified GHC.ST as GHCST
83−#endif
84
72
85−#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,4,0)
73+import Text.ParserCombinators.ReadP
86−import Data.Functor.Classes (Eq1(..),Ord1(..),Show1(..),Read1(..))
87−#endif
88
74
89data SmallArray a = SmallArray (SmallArray# a)
75data SmallArray a = SmallArray (SmallArray# a)
90 deriving Typeable
76 deriving Typeable
@@ -92,6 +78,7 @@ data SmallArray a = SmallArray (SmallArray# a)
92data SmallMutableArray s a = SmallMutableArray (SmallMutableArray# s a)
78data SmallMutableArray s a = SmallMutableArray (SmallMutableArray# s a)
93 deriving Typeable
79 deriving Typeable
94
80
81+
95-- | Create a new small mutable array.
82-- | Create a new small mutable array.
96newSmallArray
83newSmallArray
97 :: PrimMonad m
84 :: PrimMonad m
@@ -318,14 +305,6 @@ mapSmallArray' f sa = createSmallArray (length sa) (die "mapSmallArray'" "imposs
318 let !y = f x
305 let !y = f x
319 writeSmallArray smb i y *> go (i+1)
306 writeSmallArray smb i y *> go (i+1)
320{-# INLINE mapSmallArray' #-}
307{-# INLINE mapSmallArray' #-}
321−
322−#if !MIN_VERSION_base(4,9,0)
323−runSmallArray
324− :: (forall s. ST s (SmallMutableArray s a))
325− -> SmallArray a
326−runSmallArray m = runST $ m >>= unsafeFreezeSmallArray
327−
328−#else
329-- This low-level business is designed to work with GHC's worker-wrapper
308-- This low-level business is designed to work with GHC's worker-wrapper
330-- transformation. A lot of the time, we don't actually need an Array
309-- transformation. A lot of the time, we don't actually need an Array
331-- constructor. By putting it on the outside, and being careful about
310-- constructor. By putting it on the outside, and being careful about
@@ -348,8 +327,6 @@ runSmallArray# m = case runRW# $ \s ->
348unST :: ST s a -> State# s -> (# State# s, a #)
327unST :: ST s a -> State# s -> (# State# s, a #)
349unST (GHCST.ST f) = f
328unST (GHCST.ST f) = f
350
329
351−#endif
352−
353-- See the comment on runSmallArray for why we use emptySmallArray#.
330-- See the comment on runSmallArray for why we use emptySmallArray#.
354createSmallArray
331createSmallArray
355 :: Int
332 :: Int
@@ -393,20 +370,11 @@ smallArrayLiftEq p sa1 sa2 = length sa1 == length sa2 && loop (length sa1 - 1)
393 | (# x #) <- indexSmallArray## sa1 i
370 | (# x #) <- indexSmallArray## sa1 i
394 , (# y #) <- indexSmallArray## sa2 i
371 , (# y #) <- indexSmallArray## sa2 i
395 = p x y && loop (i-1)
372 = p x y && loop (i-1)
396−
397−#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,4,0)
398−-- | @since 0.6.4.0
399instance Eq1 SmallArray where
373instance Eq1 SmallArray where
400−#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,5,0)
401 liftEq = smallArrayLiftEq
374 liftEq = smallArrayLiftEq
402−#else
403− eq1 = smallArrayLiftEq (==)
404−#endif
405−#endif
406
375
407instance Eq a => Eq (SmallArray a) where
376instance Eq a => Eq (SmallArray a) where
408 sa1 == sa2 = smallArrayLiftEq (==) sa1 sa2
377 sa1 == sa2 = smallArrayLiftEq (==) sa1 sa2
409−
410instance Eq (SmallMutableArray s a) where
378instance Eq (SmallMutableArray s a) where
411 SmallMutableArray sma1# == SmallMutableArray sma2# =
379 SmallMutableArray sma1# == SmallMutableArray sma2# =
412 isTrue# (sameSmallMutableArray# sma1# sma2#)
380 isTrue# (sameSmallMutableArray# sma1# sma2#)
@@ -422,15 +390,8 @@ smallArrayLiftCompare elemCompare a1 a2 = loop 0
422 = elemCompare x1 x2 `mappend` loop (i+1)
390 = elemCompare x1 x2 `mappend` loop (i+1)
423 | otherwise = compare (length a1) (length a2)
391 | otherwise = compare (length a1) (length a2)
424
392
425−#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,4,0)
426−-- | @since 0.6.4.0
427instance Ord1 SmallArray where
393instance Ord1 SmallArray where
428−#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,5,0)
429 liftCompare = smallArrayLiftCompare
394 liftCompare = smallArrayLiftCompare
430−#else
431− compare1 = smallArrayLiftCompare compare
432−#endif
433−#endif
434
395
435-- | Lexicographic ordering. Subject to change between major versions.
396-- | Lexicographic ordering. Subject to change between major versions.
436instance Ord a => Ord (SmallArray a) where
397instance Ord a => Ord (SmallArray a) where
@@ -668,11 +629,8 @@ instance Monad SmallArray where
668#if !(MIN_VERSION_base(4,13,0)) && MIN_VERSION_base(4,9,0)
629#if !(MIN_VERSION_base(4,13,0)) && MIN_VERSION_base(4,9,0)
669 fail = Fail.fail
630 fail = Fail.fail
670#endif
631#endif
671−
672−#if MIN_VERSION_base(4,9,0)
673instance Fail.MonadFail SmallArray where
632instance Fail.MonadFail SmallArray where
674 fail _ = emptySmallArray
633 fail _ = emptySmallArray
675−#endif
676
634
677instance MonadPlus SmallArray where
635instance MonadPlus SmallArray where
678 mzero = empty
636 mzero = empty
@@ -715,24 +673,19 @@ instance MonadFix SmallArray where
715 sz = sizeofSmallArray (f err)
673 sz = sizeofSmallArray (f err)
716 err = error "mfix for Data.Primitive.SmallArray applied to strict function."
674 err = error "mfix for Data.Primitive.SmallArray applied to strict function."
717
675
718−#if MIN_VERSION_base(4,9,0)
719-- | @since 0.6.3.0
676-- | @since 0.6.3.0
720−instance Sem.Semigroup (SmallArray a) where
677+instance Semigroup (SmallArray a) where
721 (<>) = (<|>)
678 (<>) = (<|>)
722− sconcat = mconcat . toList
723−#endif
724
679
725instance Monoid (SmallArray a) where
680instance Monoid (SmallArray a) where
726 mempty = empty
681 mempty = empty
727−#if !(MIN_VERSION_base(4,11,0))
728− mappend = (<|>)
682+ mappend = (<>)
729−#endif
730 mconcat l = createSmallArray n (die "mconcat" "impossible") $ \ma ->
683 mconcat l = createSmallArray n (die "mconcat" "impossible") $ \ma ->
731 let go !_ [ ] = return ()
684 let go !_ [ ] = return ()
732 go off (a:as) =
685 go off (a:as) =
733 copySmallArray ma off a 0 (sizeofSmallArray a) >> go (off + sizeofSmallArray a) as
686 copySmallArray ma off a 0 (sizeofSmallArray a) >> go (off + sizeofSmallArray a) as
734− in go 0 l
687+ in go 0 l
735− where n = sum . fmap length $ l
688+ where n = sum . fmap length $ l
736
689
737instance IsList (SmallArray a) where
690instance IsList (SmallArray a) where
738 type Item (SmallArray a) = a
691 type Item (SmallArray a) = a
@@ -751,16 +704,8 @@ listLiftShowsPrec _ sl _ = sl
751
704
752instance Show a => Show (SmallArray a) where
705instance Show a => Show (SmallArray a) where
753 showsPrec = smallArrayLiftShowsPrec showsPrec showList
706 showsPrec = smallArrayLiftShowsPrec showsPrec showList
754−
755−#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,4,0)
756−-- | @since 0.6.4.0
757instance Show1 SmallArray where
707instance Show1 SmallArray where
758−#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,5,0)
759 liftShowsPrec = smallArrayLiftShowsPrec
708 liftShowsPrec = smallArrayLiftShowsPrec
760−#else
761− showsPrec1 = smallArrayLiftShowsPrec showsPrec showList
762−#endif
763−#endif
764
709
765smallArrayLiftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (SmallArray a)
710smallArrayLiftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (SmallArray a)
766smallArrayLiftReadsPrec _ listReadsPrec p = readParen (p > 10) . readP_to_S $ do
711smallArrayLiftReadsPrec _ listReadsPrec p = readParen (p > 10) . readP_to_S $ do
@@ -774,17 +719,8 @@ smallArrayLiftReadsPrec _ listReadsPrec p = readParen (p > 10) . readP_to_S $ do
774instance Read a => Read (SmallArray a) where
719instance Read a => Read (SmallArray a) where
775 readsPrec = smallArrayLiftReadsPrec readsPrec readList
720 readsPrec = smallArrayLiftReadsPrec readsPrec readList
776
721
777−#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,4,0)
778−-- | @since 0.6.4.0
779instance Read1 SmallArray where
722instance Read1 SmallArray where
780−#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,5,0)
781 liftReadsPrec = smallArrayLiftReadsPrec
723 liftReadsPrec = smallArrayLiftReadsPrec
782−#else
783− readsPrec1 = smallArrayLiftReadsPrec readsPrec readList
784−#endif
785−#endif
786−
787−
788
724
789smallArrayDataType :: DataType
725smallArrayDataType :: DataType
790smallArrayDataType =
726smallArrayDataType =
src/Streamly/Internal/Data/Stream/IsStream/Top.hs−3
@@ -58,9 +58,6 @@ import Data.Function ((&))
58import Data.IORef (newIORef, readIORef, modifyIORef')
58import Data.IORef (newIORef, readIORef, modifyIORef')
59import Data.Kind (Type)
59import Data.Kind (Type)
60import Data.Maybe (isJust)
60import Data.Maybe (isJust)
61−#if !(MIN_VERSION_base(4,11,0))
62−import Data.Semigroup (Semigroup(..))
63−#endif
64import Streamly.Internal.Control.Concurrent (MonadAsync)
61import Streamly.Internal.Control.Concurrent (MonadAsync)
65import Streamly.Internal.Data.Stream.IsStream.Common (concatM)
62import Streamly.Internal.Data.Stream.IsStream.Common (concatM)
66import Streamly.Internal.Data.Stream.IsStream.Type
63import Streamly.Internal.Data.Stream.IsStream.Type
src/Streamly/Internal/Data/Stream/IsStream/Transform.hs−9
@@ -257,9 +257,6 @@ import qualified Streamly.Internal.Data.Fold as FL
257import qualified Streamly.Internal.Data.Stream.Parallel as Par
257import qualified Streamly.Internal.Data.Stream.Parallel as Par
258import qualified Streamly.Internal.Data.Stream.Serial as Serial
258import qualified Streamly.Internal.Data.Stream.Serial as Serial
259import qualified Streamly.Internal.Data.Stream.StreamD as D
259import qualified Streamly.Internal.Data.Stream.StreamD as D
260−#if __GLASGOW_HASKELL__ == 802
261−import qualified Streamly.Internal.Data.Stream.StreamK as K
262−#endif
263import qualified Streamly.Internal.Data.Stream.StreamK.Type as K
260import qualified Streamly.Internal.Data.Stream.StreamK.Type as K
264#ifdef USE_STREAMK_ONLY
261#ifdef USE_STREAMK_ONLY
265import qualified Streamly.Internal.Data.Stream.StreamK as S
262import qualified Streamly.Internal.Data.Stream.StreamK as S
@@ -884,14 +881,8 @@ with f comb g = fmap snd . comb g . f
884--
881--
885-- @since 0.1.0
882-- @since 0.1.0
886{-# INLINE filter #-}
883{-# INLINE filter #-}
887−#if __GLASGOW_HASKELL__ != 802
888−-- GHC 8.2.2 crashes with this code, when used with "stack"
889filter :: (IsStream t, Monad m) => (a -> Bool) -> t m a -> t m a
884filter :: (IsStream t, Monad m) => (a -> Bool) -> t m a -> t m a
890filter p m = fromStreamS $ S.filter p $ toStreamS m
885filter p m = fromStreamS $ S.filter p $ toStreamS m
891−#else
892−filter :: IsStream t => (a -> Bool) -> t m a -> t m a
893−filter p m = fromStream $ K.filter p $ toStream m
894−#endif
895
886
896-- | Same as 'filter' but with a monadic predicate.
887-- | Same as 'filter' but with a monadic predicate.
897--
888--
src/Streamly/Internal/FileSystem/Event/Linux.hs−26
@@ -177,15 +177,7 @@ import Streamly.Internal.Data.Parser (Parser)
177import Streamly.Internal.Data.Array.Foreign.Type (Array(..), byteLength)
177import Streamly.Internal.Data.Array.Foreign.Type (Array(..), byteLength)
178import System.Directory (doesDirectoryExist)
178import System.Directory (doesDirectoryExist)
179import System.IO (Handle, hClose, IOMode(ReadMode))
179import System.IO (Handle, hClose, IOMode(ReadMode))
180−#if !MIN_VERSION_base(4,10,0)
181−import Control.Concurrent.MVar (readMVar)
182−import Data.Typeable (cast)
183−import GHC.IO.Exception (IOException(..), IOErrorType(..), ioException)
184−import GHC.IO.FD (FD)
185−import GHC.IO.Handle.Types (Handle__(..), Handle(FileHandle, DuplexHandle))
186−#else
187import GHC.IO.Handle.FD (handleToFd)
180import GHC.IO.Handle.FD (handleToFd)
188−#endif
189
181
190import qualified Data.IntMap.Lazy as Map
182import qualified Data.IntMap.Lazy as Map
191import qualified Data.List.NonEmpty as NonEmpty
183import qualified Data.List.NonEmpty as NonEmpty
@@ -633,24 +625,6 @@ toUtf8 = A.fromStream . U.encodeUtf8 . S.fromList
633utf8ToString :: Array Word8 -> String
625utf8ToString :: Array Word8 -> String
634utf8ToString = runIdentity . S.toList . U.decodeUtf8' . A.toStream
626utf8ToString = runIdentity . S.toList . U.decodeUtf8' . A.toStream
635
627
636−#if !MIN_VERSION_base(4,10,0)
637−-- | Turn an existing Handle into a file descriptor. This function throws an
638−-- IOError if the Handle does not reference a file descriptor.
639−handleToFd :: Handle -> IO FD
640−handleToFd h = case h of
641− FileHandle _ mv -> do
642− Handle__{haDevice = dev} <- readMVar mv
643− case cast dev of
644− Just fd -> return fd
645− Nothing -> throwErr "not a file descriptor"
646− DuplexHandle{} -> throwErr "not a file handle"
647−
648− where
649−
650− throwErr msg = ioException $ IOError (Just h)
651− InappropriateType "handleToFd" msg Nothing Nothing
652−#endif
653−
654-- | Add a trailing "/" at the end of the path if there is none. Do not add a
628-- | Add a trailing "/" at the end of the path if there is none. Do not add a
655-- "/" if the path is empty.
629-- "/" if the path is empty.
656--
630--
src/Streamly/Internal/FileSystem/FDIO.hs−2
@@ -27,9 +27,7 @@ import Streamly.Internal.System.IOVec.Type (IOVec)
27import Control.Concurrent (threadWaitWrite)
27import Control.Concurrent (threadWaitWrite)
28import Data.Int (Int64)
28import Data.Int (Int64)
29import Foreign.C.Error (throwErrnoIfMinus1RetryMayBlock)
29import Foreign.C.Error (throwErrnoIfMinus1RetryMayBlock)
30−#if __GLASGOW_HASKELL__ >= 802
31import Foreign.C.Types (CBool(..))
30import Foreign.C.Types (CBool(..))
32−#endif
33import System.Posix.Internals (c_write, c_safe_write)
31import System.Posix.Internals (c_write, c_safe_write)
34import Streamly.Internal.System.IOVec.Type (c_writev, c_safe_writev)
32import Streamly.Internal.System.IOVec.Type (c_writev, c_safe_writev)
35#endif
33#endif
streamly.cabal+1−2
@@ -31,8 +31,7 @@ homepage: https://streamly.composewell.com
31bug-reports: https://github.com/composewell/streamly/issues
31bug-reports: https://github.com/composewell/streamly/issues
32license: BSD-3-Clause
32license: BSD-3-Clause
33license-file: LICENSE
33license-file: LICENSE
34−tested-with: GHC==8.0.2
34+tested-with: GHC==8.4.4
35− , GHC==8.4.4
36 , GHC==8.6.5
35 , GHC==8.6.5
37 , GHC==8.8.4
36 , GHC==8.8.4
38 , GHC==8.10.7
37 , GHC==8.10.7
test/Streamly/Test/Data/List.hs−7
@@ -4,9 +4,6 @@
4
4
5module Main (main) where
5module Main (main) where
6
6
7−#if !(MIN_VERSION_base(4,11,0))
8−import Data.Semigroup ((<>))
9−#endif
10import Test.Hspec
7import Test.Hspec
11import qualified GHC.Exts as GHC
8import qualified GHC.Exts as GHC
12
9
@@ -148,11 +145,7 @@ main = hspec $
148 ("hello" :: List Char) `shouldBe` GHC.fromList "hello"
145 ("hello" :: List Char) `shouldBe` GHC.fromList "hello"
149
146
150 it "pattern matches" $ do
147 it "pattern matches" $ do
151−#if __GLASGOW_HASKELL__ >= 802
152 case "" of
148 case "" of
153−#else
154− case "" :: List Char of
155−#endif
156 Nil -> return ()
149 Nil -> return ()
157 _ -> expectationFailure "not reached"
150 _ -> expectationFailure "not reached"
158
151
test/Streamly/Test/Prelude.hs−3
@@ -15,9 +15,6 @@ import Control.Monad.Catch (throwM)
15import Control.Monad.Error.Class (throwError, MonadError)
15import Control.Monad.Error.Class (throwError, MonadError)
16import Control.Monad.Trans.Except (runExceptT, ExceptT)
16import Control.Monad.Trans.Except (runExceptT, ExceptT)
17import Data.List (sort)
17import Data.List (sort)
18−#if !(MIN_VERSION_base(4,11,0))
19−import Data.Semigroup (Semigroup(..))
20−#endif
21import System.IO (stdout, hSetBuffering, BufferMode(LineBuffering))
18import System.IO (stdout, hSetBuffering, BufferMode(LineBuffering))
22import System.Random (randomIO)
19import System.Random (randomIO)
23import Test.Hspec as H
20import Test.Hspec as H
test/Streamly/Test/Prelude/Concurrent.hs−3
@@ -21,9 +21,6 @@ import Control.Monad.State (MonadState, get, modify, runStateT
21 , StateT(..), evalStateT)
21 , StateT(..), evalStateT)
22import Data.Foldable (fold)
22import Data.Foldable (fold)
23import Data.IORef (readIORef, modifyIORef, newIORef)
23import Data.IORef (readIORef, modifyIORef, newIORef)
24−#if !(MIN_VERSION_base(4,11,0))
25−import Data.Semigroup (Semigroup, (<>))
26−#endif
27import GHC.Word (Word8)
24import GHC.Word (Word8)
28import Test.Hspec.QuickCheck
25import Test.Hspec.QuickCheck
29import Test.Hspec as H
26import Test.Hspec as H
test/Streamly/Test/Prelude/Parallel.hs−3
@@ -10,9 +10,6 @@
10module Streamly.Test.Prelude.Parallel (main) where
10module Streamly.Test.Prelude.Parallel (main) where
11
11
12import Data.List (sort)
12import Data.List (sort)
13−#if !(MIN_VERSION_base(4,11,0))
14−import Data.Semigroup ((<>))
15−#endif
16import Test.Hspec.QuickCheck
13import Test.Hspec.QuickCheck
17import Test.Hspec as H
14import Test.Hspec as H
18
15
test/Streamly/Test/Prelude/WAsync.hs−3
@@ -13,9 +13,6 @@ module Streamly.Test.Prelude.WAsync (main) where
13import Control.Concurrent ( threadDelay )
13import Control.Concurrent ( threadDelay )
14#endif
14#endif
15import Data.List (sort)
15import Data.List (sort)
16−#if !(MIN_VERSION_base(4,11,0))
17−import Data.Semigroup ((<>))
18−#endif
19import Test.Hspec.QuickCheck
16import Test.Hspec.QuickCheck
20import Test.QuickCheck (Property, withMaxSuccess)
17import Test.QuickCheck (Property, withMaxSuccess)
21import Test.QuickCheck.Monadic (monadicIO, run)
18import Test.QuickCheck.Monadic (monadicIO, run)
test/Streamly/Test/Unicode/Char.hs−8
@@ -16,9 +16,6 @@ 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−#if MIN_VERSION_base(4,8,0)
20−import Data.Function ((&))
21−#endif
22import Streamly.Internal.Unicode.Char
19import Streamly.Internal.Unicode.Char
23 ( NormalizationMode(NFC, NFD, NFKC, NFKD)
20 ( NormalizationMode(NFC, NFD, NFKC, NFKD)
24 , normalize
21 , normalize
@@ -31,11 +28,6 @@ import qualified Streamly.Internal.Data.Stream.IsStream as S
31import qualified Streamly.Internal.Data.Fold as FL
28import qualified Streamly.Internal.Data.Fold as FL
32import qualified System.Directory as Dir
29import qualified System.Directory as Dir
33
30
34−#if !MIN_VERSION_base(4,8,0)
35−(&) :: a -> (a -> b) -> b
36−x & f = f x
37−#endif
38−
39chrToHex :: Char -> [Char]
31chrToHex :: Char -> [Char]
40chrToHex = map toUpper . printf "%.4x" . ord
32chrToHex = map toUpper . printf "%.4x" . ord
41
33
test/lib/Streamly/Test/Prelude/Common.hs−6
@@ -117,9 +117,6 @@ import Data.List
117 , unfoldr
117 , unfoldr
118 )
118 )
119import Data.Maybe (mapMaybe)
119import Data.Maybe (mapMaybe)
120−#if !(MIN_VERSION_base(4,11,0))
121−import Data.Semigroup (Semigroup, (<>))
122−#endif
123import GHC.Word (Word8)
120import GHC.Word (Word8)
124import System.Mem (performMajorGC)
121import System.Mem (performMajorGC)
125import Test.Hspec.QuickCheck
122import Test.Hspec.QuickCheck
@@ -972,9 +969,6 @@ nestTwoStreamsApp desc streamListT listT t =
972composeAndComposeSimple
969composeAndComposeSimple
973 :: ( IsStream t1, Semigroup (t1 IO Int)
970 :: ( IsStream t1, Semigroup (t1 IO Int)
974 , IsStream t2, Monoid (t2 IO Int), Monad (t2 IO)
971 , IsStream t2, Monoid (t2 IO Int), Monad (t2 IO)
975−#if !(MIN_VERSION_base(4,11,0))
976− , Semigroup (t2 IO Int)
977−#endif
978 )
972 )
979 => (t1 IO Int -> SerialT IO Int)
973 => (t1 IO Int -> SerialT IO Int)
980 -> (t2 IO Int -> t2 IO Int)
974 -> (t2 IO Int -> t2 IO Int)