@@ -56,7 +56,7 @@ module Streamly.Internal.FileSystem.Dir
5656where
5757
5858import Control.Monad.IO.Class (MonadIO(..))
59−import Data.Either (isRight, fromRight, isLeft, fromLeft)
59+import Data.Either (isRight, isLeft)
6060-- import Data.Word (Word8)
6161-- import Foreign.ForeignPtr (withForeignPtr)
6262-- import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
@@ -84,6 +84,18 @@ import qualified Streamly.Internal.Prelude as S
8484-- import qualified Streamly.Internal.Data.Stream.StreamD.Type as D
8585import qualified System.Directory as Dir
8686
87+#if MIN_VERSION_base(4,10,0)
88+import Data.Either (fromRight, fromLeft)
89+#else
90+fromLeft :: a -> Either a b -> a
91+fromLeft _ (Left a) = a
92+fromLeft a _ = a
93+
94+fromRight :: b -> Either a b -> b
95+fromRight _ (Right b) = b
96+fromRight b _ = b
97+#endif
98+
8799{-
88100{-# INLINABLE readArrayUpto #-}
89101readArrayUpto :: Int -> Handle -> IO (Array Word8)