mirror of
https://github.com/ilyakooo0/streamly.git
synced 2024-10-26 01:48:03 +03:00
Drop GHC 8.x to 8.2.x Support
This commit is contained in:
parent
1b8043f6ef
commit
07bf70d5f8
@ -404,10 +404,10 @@ workflows:
|
||||
#- cabal-ghc-8.6.5
|
||||
#- cabal-ghc-8_4_4:
|
||||
# name: GHC 8.4.4 + x86 + debug
|
||||
- cabal-ghc-8_2_2:
|
||||
name: GHC 8.2.2 + no-test + no-bench + no-docs
|
||||
- cabal-ghc-8_0_2:
|
||||
name: GHC 8.0.2 + no-test + no-bench + no-docs
|
||||
#- cabal-ghc-8_2_2:
|
||||
# name: GHC 8.2.2 + no-test + no-bench + no-docs
|
||||
#- cabal-ghc-8_0_2:
|
||||
# name: GHC 8.0.2 + no-test + no-bench + no-docs
|
||||
#- cabal-ghc-7.10.3
|
||||
- cabal-ghcjs-8_4:
|
||||
name: GHCJS 8.4 + no-test + no-docs
|
||||
|
@ -20,11 +20,7 @@ import Data.Functor (($>))
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Data.Monoid (Sum(..))
|
||||
import GHC.Magic (inline)
|
||||
#if __GLASGOW_HASKELL__ >= 802
|
||||
import GHC.Magic (noinline)
|
||||
#else
|
||||
#define noinline
|
||||
#endif
|
||||
import System.IO (Handle)
|
||||
import System.Random (randomRIO)
|
||||
import Prelude
|
||||
|
@ -17,10 +17,6 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# OPTIONS_GHC -fplugin Test.Inspection.Plugin #-}
|
||||
#endif
|
||||
|
||||
#if __GLASGOW_HASKELL__ >= 800
|
||||
#endif
|
||||
|
||||
import Streamly.Benchmark.Common.Handle (mkHandleBenchEnv)
|
||||
|
||||
import qualified Handle.ReadWrite as RW
|
||||
|
@ -24,11 +24,7 @@ where
|
||||
|
||||
import Data.Word (Word8)
|
||||
import GHC.Magic (inline)
|
||||
#if __GLASGOW_HASKELL__ >= 802
|
||||
import GHC.Magic (noinline)
|
||||
#else
|
||||
#define noinline
|
||||
#endif
|
||||
import System.IO (Handle)
|
||||
|
||||
import qualified Streamly.FileSystem.Handle as FH
|
||||
|
@ -1,7 +1,5 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
#if __GLASGOW_HASKELL__ >= 800
|
||||
{-# OPTIONS_GHC -Wno-orphans #-}
|
||||
#endif
|
||||
|
||||
-- |
|
||||
-- Module : Streamly.Benchmark.Common
|
||||
|
@ -68,9 +68,6 @@ import Control.Applicative (liftA2)
|
||||
import Control.DeepSeq (NFData(..))
|
||||
import Control.Exception (try)
|
||||
import Data.Functor.Identity (Identity)
|
||||
#if !(MIN_VERSION_base(4,11,0))
|
||||
import Data.Semigroup (Semigroup((<>)))
|
||||
#endif
|
||||
import GHC.Exception (ErrorCall)
|
||||
import Prelude hiding (mapM)
|
||||
import System.Random (randomRIO)
|
||||
|
@ -19,38 +19,22 @@ module Streamly.Internal.BaseCompat
|
||||
where
|
||||
|
||||
import Data.Coerce (Coercible, coerce)
|
||||
#if MIN_VERSION_base(4,10,0)
|
||||
import Data.Either (fromRight, fromLeft)
|
||||
import qualified GHC.Exts as GHCExt
|
||||
#endif
|
||||
import GHC.ForeignPtr (ForeignPtr(..))
|
||||
import GHC.Ptr (Ptr(..))
|
||||
|
||||
import qualified GHC.Exts as GHCExt
|
||||
#if MIN_VERSION_base(4,15,0)
|
||||
import qualified GHC.ForeignPtr as GHCForeignPtr
|
||||
#else
|
||||
import Foreign.ForeignPtr (withForeignPtr)
|
||||
#endif
|
||||
|
||||
|
||||
{-# INLINE (#.) #-}
|
||||
(#.) :: Coercible b c => (b -> c) -> (a -> b) -> (a -> c)
|
||||
(#.) _f = coerce
|
||||
|
||||
#if !(MIN_VERSION_base(4,9,0))
|
||||
{-# NOINLINE errorWithoutStackTrace #-}
|
||||
errorWithoutStackTrace :: String -> a
|
||||
errorWithoutStackTrace = error
|
||||
#endif
|
||||
|
||||
#if !(MIN_VERSION_base(4,10,0))
|
||||
fromLeft :: a -> Either a b -> a
|
||||
fromLeft _ (Left a) = a
|
||||
fromLeft a _ = a
|
||||
|
||||
fromRight :: b -> Either a b -> b
|
||||
fromRight _ (Right b) = b
|
||||
fromRight b _ = b
|
||||
#endif
|
||||
|
||||
unsafeWithForeignPtr :: ForeignPtr a -> (Ptr a -> IO b) -> IO b
|
||||
#if MIN_VERSION_base(4,15,0)
|
||||
unsafeWithForeignPtr = GHCForeignPtr.unsafeWithForeignPtr
|
||||
@ -59,8 +43,4 @@ unsafeWithForeignPtr = withForeignPtr
|
||||
#endif
|
||||
|
||||
oneShot :: (a -> b) -> a -> b
|
||||
#if MIN_VERSION_base(4,10,0)
|
||||
oneShot = GHCExt.oneShot
|
||||
#else
|
||||
oneShot = id
|
||||
#endif
|
||||
|
@ -120,9 +120,6 @@ import Control.Exception (assert)
|
||||
import Control.Monad (when)
|
||||
import Control.Monad.IO.Class (MonadIO(..))
|
||||
import Data.Functor.Identity (Identity)
|
||||
#if !(MIN_VERSION_base(4,11,0))
|
||||
import Data.Semigroup ((<>))
|
||||
#endif
|
||||
import Data.Word (Word8)
|
||||
import Foreign.C.String (CString)
|
||||
import Foreign.Ptr (plusPtr, castPtr)
|
||||
|
@ -231,11 +231,7 @@ import GHC.Base
|
||||
#ifndef USE_FOREIGN_PTR
|
||||
import GHC.Base (RealWorld, MutableByteArray#)
|
||||
#endif
|
||||
#if __GLASGOW_HASKELL__ < 802
|
||||
#define noinline
|
||||
#else
|
||||
import GHC.Base (noinline)
|
||||
#endif
|
||||
import GHC.Exts (unsafeCoerce#)
|
||||
import GHC.ForeignPtr (ForeignPtr(..), ForeignPtrContents(..))
|
||||
#ifdef USE_C_MALLOC
|
||||
|
@ -258,10 +258,8 @@ instance MonadThrow m => Applicative (Fold m a) where
|
||||
{-# INLINE (*>) #-}
|
||||
(*>) = serial_
|
||||
|
||||
#if MIN_VERSION_base(4,10,0)
|
||||
{-# INLINE liftA2 #-}
|
||||
liftA2 f x = (<*>) (fmap f x)
|
||||
#endif
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Monad
|
||||
|
@ -263,9 +263,6 @@ import Data.Functor.Identity (Identity(..))
|
||||
import Data.Int (Int64)
|
||||
import Data.Map.Strict (Map)
|
||||
import Data.Maybe (isJust, fromJust)
|
||||
#if __GLASGOW_HASKELL__ < 804
|
||||
import Data.Semigroup (Semigroup((<>)))
|
||||
#endif
|
||||
import Streamly.Internal.BaseCompat (fromLeft, fromRight)
|
||||
import Streamly.Internal.Data.Either.Strict
|
||||
(Either'(..), fromLeft', fromRight', isLeft', isRight')
|
||||
@ -838,9 +835,6 @@ sconcat = foldl' (<>)
|
||||
{-# INLINE mconcat #-}
|
||||
mconcat ::
|
||||
( Monad m
|
||||
#if !MIN_VERSION_base(4,11,0)
|
||||
, Semigroup a
|
||||
#endif
|
||||
, Monoid a) => Fold m a a
|
||||
mconcat = sconcat mempty
|
||||
|
||||
@ -856,9 +850,6 @@ mconcat = sconcat mempty
|
||||
-- @since 0.7.0
|
||||
{-# INLINE foldMap #-}
|
||||
foldMap :: (Monad m, Monoid b
|
||||
#if !MIN_VERSION_base(4,11,0)
|
||||
, Semigroup b
|
||||
#endif
|
||||
) => (a -> b) -> Fold m a b
|
||||
foldMap f = lmap f mconcat
|
||||
|
||||
|
@ -67,11 +67,10 @@ import Control.DeepSeq (NFData(..))
|
||||
import Control.DeepSeq (NFData1(..))
|
||||
#endif
|
||||
import Data.Functor.Identity (Identity, runIdentity)
|
||||
import GHC.Exts (IsList(..), IsString(..))
|
||||
#if __GLASGOW_HASKELL__ < 808
|
||||
import Data.Semigroup (Semigroup(..))
|
||||
#endif
|
||||
import GHC.Exts (IsList(..), IsString(..))
|
||||
|
||||
import Streamly.Internal.Data.Stream.Serial (SerialT(..))
|
||||
import Streamly.Internal.Data.Stream.Zip (ZipSerialM(..))
|
||||
|
||||
@ -148,9 +147,7 @@ pattern Cons x xs <-
|
||||
|
||||
Cons x xs = List $ Serial.cons x (toSerial xs)
|
||||
|
||||
#if __GLASGOW_HASKELL__ >= 802
|
||||
{-# COMPLETE Nil, Cons #-}
|
||||
#endif
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- ZipList
|
||||
|
@ -905,10 +905,9 @@ instance MonadThrow m => Applicative (Parser m a) where
|
||||
{-# INLINE (*>) #-}
|
||||
(*>) = split_
|
||||
|
||||
#if MIN_VERSION_base(4,10,0)
|
||||
{-# INLINE liftA2 #-}
|
||||
liftA2 f x = (<*>) (fmap f x)
|
||||
#endif
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Sequential Alternative
|
||||
|
@ -36,12 +36,8 @@ import Control.Monad.Catch (MonadCatch, MonadThrow(..))
|
||||
import Control.Monad.IO.Class (MonadIO, liftIO)
|
||||
import Control.Monad.Reader.Class (MonadReader, ask, local)
|
||||
import Control.Monad.State.Class (MonadState, get, put)
|
||||
#if MIN_VERSION_base(4,9,0)
|
||||
import qualified Control.Monad.Fail as Fail
|
||||
#endif
|
||||
#if !(MIN_VERSION_base(4,10,0))
|
||||
import Data.Semigroup ((<>))
|
||||
#endif
|
||||
|
||||
|
||||
-- | The parse driver result. The driver may stop with a final result, pause
|
||||
-- with a continuation to resume, or fail with an error.
|
||||
@ -157,10 +153,8 @@ instance Monad m => Applicative (Parser m a) where
|
||||
yield1 s (Error e) = yieldk s (Error e)
|
||||
in runParser m1 lo st yield1
|
||||
|
||||
#if MIN_VERSION_base(4,10,0)
|
||||
{-# INLINE liftA2 #-}
|
||||
liftA2 f x = (<*>) (fmap f x)
|
||||
#endif
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Monad
|
||||
@ -238,12 +232,9 @@ instance Monad m => Monad (Parser m a) where
|
||||
{-# INLINE fail #-}
|
||||
fail = die
|
||||
#endif
|
||||
|
||||
#if MIN_VERSION_base(4,9,0)
|
||||
instance Monad m => Fail.MonadFail (Parser m a) where
|
||||
{-# INLINE fail #-}
|
||||
fail = die
|
||||
#endif
|
||||
|
||||
instance (MonadThrow m, MonadReader r m, MonadCatch m) =>
|
||||
MonadReader r (Parser m a) where
|
||||
|
@ -234,10 +234,8 @@ instance Monad m => Applicative (SerialT m) where
|
||||
(<*>) = apSerial
|
||||
-- (<*>) = K.apSerial
|
||||
|
||||
#if MIN_VERSION_base(4,10,0)
|
||||
{-# INLINE liftA2 #-}
|
||||
liftA2 f x = (<*>) (fmap f x)
|
||||
#endif
|
||||
|
||||
{-# INLINE (*>) #-}
|
||||
(*>) = apSequence
|
||||
|
@ -153,9 +153,7 @@ import Control.Exception (assert)
|
||||
import Control.Monad.Catch (MonadThrow, throwM)
|
||||
import Control.Monad.IO.Class (MonadIO(..))
|
||||
import Data.Bits (shiftR, shiftL, (.|.), (.&.))
|
||||
#if __GLASGOW_HASKELL__ >= 801
|
||||
import Data.Functor.Identity ( Identity )
|
||||
#endif
|
||||
import Data.Word (Word32)
|
||||
import Foreign.Storable (Storable(..))
|
||||
import Fusion.Plugin.Types (Fuse(..))
|
||||
@ -424,10 +422,8 @@ zipWithM f (Stream stepa ta) (Stream stepb tb) = Stream step (ta, tb, Nothing)
|
||||
Skip sb' -> return $ Skip (sa, sb', Just x)
|
||||
Stop -> return Stop
|
||||
|
||||
#if __GLASGOW_HASKELL__ >= 801
|
||||
{-# RULES "zipWithM xs xs"
|
||||
forall f xs. zipWithM @Identity f xs xs = mapM (\x -> f x x) xs #-}
|
||||
#endif
|
||||
|
||||
{-# INLINE zipWith #-}
|
||||
zipWith :: Monad m => (a -> b -> c) -> Stream m a -> Stream m b -> Stream m c
|
||||
|
@ -128,9 +128,7 @@ pattern Stream :: (State K.Stream m a -> s -> m (Step s a)) -> s -> Stream m a
|
||||
pattern Stream step state <- (unShare -> UnStream step state)
|
||||
where Stream = UnStream
|
||||
|
||||
#if __GLASGOW_HASKELL__ >= 802
|
||||
{-# COMPLETE Stream #-}
|
||||
#endif
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- Primitives
|
||||
@ -744,10 +742,8 @@ instance Applicative f => Applicative (Stream f) where
|
||||
{-# INLINE (<*>) #-}
|
||||
(<*>) = concatAp
|
||||
|
||||
#if MIN_VERSION_base(4,10,0)
|
||||
{-# INLINE liftA2 #-}
|
||||
liftA2 f x = (<*>) (fmap f x)
|
||||
#endif
|
||||
|
||||
{-# INLINE (*>) #-}
|
||||
(*>) = apSequence
|
||||
|
@ -56,12 +56,8 @@ module Streamly.Internal.Data.SmallArray.Type
|
||||
|
||||
import GHC.Exts hiding (toList)
|
||||
import qualified GHC.Exts
|
||||
|
||||
import Control.Applicative
|
||||
import Control.Monad
|
||||
#if MIN_VERSION_base(4,9,0)
|
||||
import qualified Control.Monad.Fail as Fail
|
||||
#endif
|
||||
import Control.Monad.Fix
|
||||
import Control.Monad.Primitive
|
||||
import Control.Monad.ST
|
||||
@ -69,22 +65,12 @@ import Control.Monad.Zip
|
||||
import Data.Data
|
||||
import Data.Foldable as Foldable
|
||||
import Data.Functor.Identity
|
||||
#if !(MIN_VERSION_base(4,10,0))
|
||||
import Data.Monoid
|
||||
#endif
|
||||
#if MIN_VERSION_base(4,9,0)
|
||||
import qualified GHC.ST as GHCST
|
||||
import qualified Data.Semigroup as Sem
|
||||
#endif
|
||||
import Text.ParserCombinators.ReadP
|
||||
|
||||
#if MIN_VERSION_base(4,9,0) && !MIN_VERSION_base(4,10,0)
|
||||
import GHC.Base (runRW#)
|
||||
#endif
|
||||
|
||||
#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,4,0)
|
||||
import Data.Functor.Classes (Eq1(..),Ord1(..),Show1(..),Read1(..))
|
||||
#endif
|
||||
|
||||
import qualified Control.Monad.Fail as Fail
|
||||
import qualified GHC.ST as GHCST
|
||||
|
||||
import Text.ParserCombinators.ReadP
|
||||
|
||||
data SmallArray a = SmallArray (SmallArray# a)
|
||||
deriving Typeable
|
||||
@ -92,6 +78,7 @@ data SmallArray a = SmallArray (SmallArray# a)
|
||||
data SmallMutableArray s a = SmallMutableArray (SmallMutableArray# s a)
|
||||
deriving Typeable
|
||||
|
||||
|
||||
-- | Create a new small mutable array.
|
||||
newSmallArray
|
||||
:: PrimMonad m
|
||||
@ -318,14 +305,6 @@ mapSmallArray' f sa = createSmallArray (length sa) (die "mapSmallArray'" "imposs
|
||||
let !y = f x
|
||||
writeSmallArray smb i y *> go (i+1)
|
||||
{-# INLINE mapSmallArray' #-}
|
||||
|
||||
#if !MIN_VERSION_base(4,9,0)
|
||||
runSmallArray
|
||||
:: (forall s. ST s (SmallMutableArray s a))
|
||||
-> SmallArray a
|
||||
runSmallArray m = runST $ m >>= unsafeFreezeSmallArray
|
||||
|
||||
#else
|
||||
-- This low-level business is designed to work with GHC's worker-wrapper
|
||||
-- transformation. A lot of the time, we don't actually need an Array
|
||||
-- constructor. By putting it on the outside, and being careful about
|
||||
@ -348,8 +327,6 @@ runSmallArray# m = case runRW# $ \s ->
|
||||
unST :: ST s a -> State# s -> (# State# s, a #)
|
||||
unST (GHCST.ST f) = f
|
||||
|
||||
#endif
|
||||
|
||||
-- See the comment on runSmallArray for why we use emptySmallArray#.
|
||||
createSmallArray
|
||||
:: Int
|
||||
@ -393,20 +370,11 @@ smallArrayLiftEq p sa1 sa2 = length sa1 == length sa2 && loop (length sa1 - 1)
|
||||
| (# x #) <- indexSmallArray## sa1 i
|
||||
, (# y #) <- indexSmallArray## sa2 i
|
||||
= p x y && loop (i-1)
|
||||
|
||||
#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,4,0)
|
||||
-- | @since 0.6.4.0
|
||||
instance Eq1 SmallArray where
|
||||
#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,5,0)
|
||||
liftEq = smallArrayLiftEq
|
||||
#else
|
||||
eq1 = smallArrayLiftEq (==)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
instance Eq a => Eq (SmallArray a) where
|
||||
sa1 == sa2 = smallArrayLiftEq (==) sa1 sa2
|
||||
|
||||
instance Eq (SmallMutableArray s a) where
|
||||
SmallMutableArray sma1# == SmallMutableArray sma2# =
|
||||
isTrue# (sameSmallMutableArray# sma1# sma2#)
|
||||
@ -422,15 +390,8 @@ smallArrayLiftCompare elemCompare a1 a2 = loop 0
|
||||
= elemCompare x1 x2 `mappend` loop (i+1)
|
||||
| otherwise = compare (length a1) (length a2)
|
||||
|
||||
#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,4,0)
|
||||
-- | @since 0.6.4.0
|
||||
instance Ord1 SmallArray where
|
||||
#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,5,0)
|
||||
liftCompare = smallArrayLiftCompare
|
||||
#else
|
||||
compare1 = smallArrayLiftCompare compare
|
||||
#endif
|
||||
#endif
|
||||
|
||||
-- | Lexicographic ordering. Subject to change between major versions.
|
||||
instance Ord a => Ord (SmallArray a) where
|
||||
@ -668,11 +629,8 @@ instance Monad SmallArray where
|
||||
#if !(MIN_VERSION_base(4,13,0)) && MIN_VERSION_base(4,9,0)
|
||||
fail = Fail.fail
|
||||
#endif
|
||||
|
||||
#if MIN_VERSION_base(4,9,0)
|
||||
instance Fail.MonadFail SmallArray where
|
||||
fail _ = emptySmallArray
|
||||
#endif
|
||||
|
||||
instance MonadPlus SmallArray where
|
||||
mzero = empty
|
||||
@ -715,24 +673,19 @@ instance MonadFix SmallArray where
|
||||
sz = sizeofSmallArray (f err)
|
||||
err = error "mfix for Data.Primitive.SmallArray applied to strict function."
|
||||
|
||||
#if MIN_VERSION_base(4,9,0)
|
||||
-- | @since 0.6.3.0
|
||||
instance Sem.Semigroup (SmallArray a) where
|
||||
instance Semigroup (SmallArray a) where
|
||||
(<>) = (<|>)
|
||||
sconcat = mconcat . toList
|
||||
#endif
|
||||
|
||||
instance Monoid (SmallArray a) where
|
||||
mempty = empty
|
||||
#if !(MIN_VERSION_base(4,11,0))
|
||||
mappend = (<|>)
|
||||
#endif
|
||||
mappend = (<>)
|
||||
mconcat l = createSmallArray n (die "mconcat" "impossible") $ \ma ->
|
||||
let go !_ [ ] = return ()
|
||||
go off (a:as) =
|
||||
copySmallArray ma off a 0 (sizeofSmallArray a) >> go (off + sizeofSmallArray a) as
|
||||
in go 0 l
|
||||
where n = sum . fmap length $ l
|
||||
in go 0 l
|
||||
where n = sum . fmap length $ l
|
||||
|
||||
instance IsList (SmallArray a) where
|
||||
type Item (SmallArray a) = a
|
||||
@ -751,16 +704,8 @@ listLiftShowsPrec _ sl _ = sl
|
||||
|
||||
instance Show a => Show (SmallArray a) where
|
||||
showsPrec = smallArrayLiftShowsPrec showsPrec showList
|
||||
|
||||
#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,4,0)
|
||||
-- | @since 0.6.4.0
|
||||
instance Show1 SmallArray where
|
||||
#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,5,0)
|
||||
liftShowsPrec = smallArrayLiftShowsPrec
|
||||
#else
|
||||
showsPrec1 = smallArrayLiftShowsPrec showsPrec showList
|
||||
#endif
|
||||
#endif
|
||||
|
||||
smallArrayLiftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (SmallArray a)
|
||||
smallArrayLiftReadsPrec _ listReadsPrec p = readParen (p > 10) . readP_to_S $ do
|
||||
@ -774,17 +719,8 @@ smallArrayLiftReadsPrec _ listReadsPrec p = readParen (p > 10) . readP_to_S $ do
|
||||
instance Read a => Read (SmallArray a) where
|
||||
readsPrec = smallArrayLiftReadsPrec readsPrec readList
|
||||
|
||||
#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,4,0)
|
||||
-- | @since 0.6.4.0
|
||||
instance Read1 SmallArray where
|
||||
#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,5,0)
|
||||
liftReadsPrec = smallArrayLiftReadsPrec
|
||||
#else
|
||||
readsPrec1 = smallArrayLiftReadsPrec readsPrec readList
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
smallArrayDataType :: DataType
|
||||
smallArrayDataType =
|
||||
|
@ -58,9 +58,6 @@ import Data.Function ((&))
|
||||
import Data.IORef (newIORef, readIORef, modifyIORef')
|
||||
import Data.Kind (Type)
|
||||
import Data.Maybe (isJust)
|
||||
#if !(MIN_VERSION_base(4,11,0))
|
||||
import Data.Semigroup (Semigroup(..))
|
||||
#endif
|
||||
import Streamly.Internal.Control.Concurrent (MonadAsync)
|
||||
import Streamly.Internal.Data.Stream.IsStream.Common (concatM)
|
||||
import Streamly.Internal.Data.Stream.IsStream.Type
|
||||
|
@ -257,9 +257,6 @@ import qualified Streamly.Internal.Data.Fold as FL
|
||||
import qualified Streamly.Internal.Data.Stream.Parallel as Par
|
||||
import qualified Streamly.Internal.Data.Stream.Serial as Serial
|
||||
import qualified Streamly.Internal.Data.Stream.StreamD as D
|
||||
#if __GLASGOW_HASKELL__ == 802
|
||||
import qualified Streamly.Internal.Data.Stream.StreamK as K
|
||||
#endif
|
||||
import qualified Streamly.Internal.Data.Stream.StreamK.Type as K
|
||||
#ifdef USE_STREAMK_ONLY
|
||||
import qualified Streamly.Internal.Data.Stream.StreamK as S
|
||||
@ -884,14 +881,8 @@ with f comb g = fmap snd . comb g . f
|
||||
--
|
||||
-- @since 0.1.0
|
||||
{-# INLINE filter #-}
|
||||
#if __GLASGOW_HASKELL__ != 802
|
||||
-- GHC 8.2.2 crashes with this code, when used with "stack"
|
||||
filter :: (IsStream t, Monad m) => (a -> Bool) -> t m a -> t m a
|
||||
filter p m = fromStreamS $ S.filter p $ toStreamS m
|
||||
#else
|
||||
filter :: IsStream t => (a -> Bool) -> t m a -> t m a
|
||||
filter p m = fromStream $ K.filter p $ toStream m
|
||||
#endif
|
||||
|
||||
-- | Same as 'filter' but with a monadic predicate.
|
||||
--
|
||||
|
@ -177,15 +177,7 @@ import Streamly.Internal.Data.Parser (Parser)
|
||||
import Streamly.Internal.Data.Array.Foreign.Type (Array(..), byteLength)
|
||||
import System.Directory (doesDirectoryExist)
|
||||
import System.IO (Handle, hClose, IOMode(ReadMode))
|
||||
#if !MIN_VERSION_base(4,10,0)
|
||||
import Control.Concurrent.MVar (readMVar)
|
||||
import Data.Typeable (cast)
|
||||
import GHC.IO.Exception (IOException(..), IOErrorType(..), ioException)
|
||||
import GHC.IO.FD (FD)
|
||||
import GHC.IO.Handle.Types (Handle__(..), Handle(FileHandle, DuplexHandle))
|
||||
#else
|
||||
import GHC.IO.Handle.FD (handleToFd)
|
||||
#endif
|
||||
|
||||
import qualified Data.IntMap.Lazy as Map
|
||||
import qualified Data.List.NonEmpty as NonEmpty
|
||||
@ -633,24 +625,6 @@ toUtf8 = A.fromStream . U.encodeUtf8 . S.fromList
|
||||
utf8ToString :: Array Word8 -> String
|
||||
utf8ToString = runIdentity . S.toList . U.decodeUtf8' . A.toStream
|
||||
|
||||
#if !MIN_VERSION_base(4,10,0)
|
||||
-- | Turn an existing Handle into a file descriptor. This function throws an
|
||||
-- IOError if the Handle does not reference a file descriptor.
|
||||
handleToFd :: Handle -> IO FD
|
||||
handleToFd h = case h of
|
||||
FileHandle _ mv -> do
|
||||
Handle__{haDevice = dev} <- readMVar mv
|
||||
case cast dev of
|
||||
Just fd -> return fd
|
||||
Nothing -> throwErr "not a file descriptor"
|
||||
DuplexHandle{} -> throwErr "not a file handle"
|
||||
|
||||
where
|
||||
|
||||
throwErr msg = ioException $ IOError (Just h)
|
||||
InappropriateType "handleToFd" msg Nothing Nothing
|
||||
#endif
|
||||
|
||||
-- | Add a trailing "/" at the end of the path if there is none. Do not add a
|
||||
-- "/" if the path is empty.
|
||||
--
|
||||
|
@ -27,9 +27,7 @@ import Streamly.Internal.System.IOVec.Type (IOVec)
|
||||
import Control.Concurrent (threadWaitWrite)
|
||||
import Data.Int (Int64)
|
||||
import Foreign.C.Error (throwErrnoIfMinus1RetryMayBlock)
|
||||
#if __GLASGOW_HASKELL__ >= 802
|
||||
import Foreign.C.Types (CBool(..))
|
||||
#endif
|
||||
import System.Posix.Internals (c_write, c_safe_write)
|
||||
import Streamly.Internal.System.IOVec.Type (c_writev, c_safe_writev)
|
||||
#endif
|
||||
|
@ -31,8 +31,7 @@ homepage: https://streamly.composewell.com
|
||||
bug-reports: https://github.com/composewell/streamly/issues
|
||||
license: BSD-3-Clause
|
||||
license-file: LICENSE
|
||||
tested-with: GHC==8.0.2
|
||||
, GHC==8.4.4
|
||||
tested-with: GHC==8.4.4
|
||||
, GHC==8.6.5
|
||||
, GHC==8.8.4
|
||||
, GHC==8.10.7
|
||||
|
@ -4,9 +4,6 @@
|
||||
|
||||
module Main (main) where
|
||||
|
||||
#if !(MIN_VERSION_base(4,11,0))
|
||||
import Data.Semigroup ((<>))
|
||||
#endif
|
||||
import Test.Hspec
|
||||
import qualified GHC.Exts as GHC
|
||||
|
||||
@ -148,11 +145,7 @@ main = hspec $
|
||||
("hello" :: List Char) `shouldBe` GHC.fromList "hello"
|
||||
|
||||
it "pattern matches" $ do
|
||||
#if __GLASGOW_HASKELL__ >= 802
|
||||
case "" of
|
||||
#else
|
||||
case "" :: List Char of
|
||||
#endif
|
||||
Nil -> return ()
|
||||
_ -> expectationFailure "not reached"
|
||||
|
||||
|
@ -15,9 +15,6 @@ import Control.Monad.Catch (throwM)
|
||||
import Control.Monad.Error.Class (throwError, MonadError)
|
||||
import Control.Monad.Trans.Except (runExceptT, ExceptT)
|
||||
import Data.List (sort)
|
||||
#if !(MIN_VERSION_base(4,11,0))
|
||||
import Data.Semigroup (Semigroup(..))
|
||||
#endif
|
||||
import System.IO (stdout, hSetBuffering, BufferMode(LineBuffering))
|
||||
import System.Random (randomIO)
|
||||
import Test.Hspec as H
|
||||
|
@ -21,9 +21,6 @@ import Control.Monad.State (MonadState, get, modify, runStateT
|
||||
, StateT(..), evalStateT)
|
||||
import Data.Foldable (fold)
|
||||
import Data.IORef (readIORef, modifyIORef, newIORef)
|
||||
#if !(MIN_VERSION_base(4,11,0))
|
||||
import Data.Semigroup (Semigroup, (<>))
|
||||
#endif
|
||||
import GHC.Word (Word8)
|
||||
import Test.Hspec.QuickCheck
|
||||
import Test.Hspec as H
|
||||
|
@ -10,9 +10,6 @@
|
||||
module Streamly.Test.Prelude.Parallel (main) where
|
||||
|
||||
import Data.List (sort)
|
||||
#if !(MIN_VERSION_base(4,11,0))
|
||||
import Data.Semigroup ((<>))
|
||||
#endif
|
||||
import Test.Hspec.QuickCheck
|
||||
import Test.Hspec as H
|
||||
|
||||
|
@ -13,9 +13,6 @@ module Streamly.Test.Prelude.WAsync (main) where
|
||||
import Control.Concurrent ( threadDelay )
|
||||
#endif
|
||||
import Data.List (sort)
|
||||
#if !(MIN_VERSION_base(4,11,0))
|
||||
import Data.Semigroup ((<>))
|
||||
#endif
|
||||
import Test.Hspec.QuickCheck
|
||||
import Test.QuickCheck (Property, withMaxSuccess)
|
||||
import Test.QuickCheck.Monadic (monadicIO, run)
|
||||
|
@ -16,9 +16,6 @@ module Streamly.Test.Unicode.Char (main) where
|
||||
import Control.Monad (when)
|
||||
import Data.Char (chr, isSpace, ord, toUpper)
|
||||
import Data.List (intercalate, isPrefixOf)
|
||||
#if MIN_VERSION_base(4,8,0)
|
||||
import Data.Function ((&))
|
||||
#endif
|
||||
import Streamly.Internal.Unicode.Char
|
||||
( NormalizationMode(NFC, NFD, NFKC, NFKD)
|
||||
, normalize
|
||||
@ -31,11 +28,6 @@ import qualified Streamly.Internal.Data.Stream.IsStream as S
|
||||
import qualified Streamly.Internal.Data.Fold as FL
|
||||
import qualified System.Directory as Dir
|
||||
|
||||
#if !MIN_VERSION_base(4,8,0)
|
||||
(&) :: a -> (a -> b) -> b
|
||||
x & f = f x
|
||||
#endif
|
||||
|
||||
chrToHex :: Char -> [Char]
|
||||
chrToHex = map toUpper . printf "%.4x" . ord
|
||||
|
||||
|
@ -117,9 +117,6 @@ import Data.List
|
||||
, unfoldr
|
||||
)
|
||||
import Data.Maybe (mapMaybe)
|
||||
#if !(MIN_VERSION_base(4,11,0))
|
||||
import Data.Semigroup (Semigroup, (<>))
|
||||
#endif
|
||||
import GHC.Word (Word8)
|
||||
import System.Mem (performMajorGC)
|
||||
import Test.Hspec.QuickCheck
|
||||
@ -972,9 +969,6 @@ nestTwoStreamsApp desc streamListT listT t =
|
||||
composeAndComposeSimple
|
||||
:: ( IsStream t1, Semigroup (t1 IO Int)
|
||||
, IsStream t2, Monoid (t2 IO Int), Monad (t2 IO)
|
||||
#if !(MIN_VERSION_base(4,11,0))
|
||||
, Semigroup (t2 IO Int)
|
||||
#endif
|
||||
)
|
||||
=> (t1 IO Int -> SerialT IO Int)
|
||||
-> (t2 IO Int -> t2 IO Int)
|
||||
|
Loading…
Reference in New Issue
Block a user