@@ -43,6 +43,8 @@ import qualified Streamly.FileSystem.Handle as FH
4343import qualified Streamly.Memory.Array as A
4444import qualified Streamly.Prelude as S
4545import qualified Streamly.Data.String as SS
46+
47+import qualified Streamly.Internal.FileSystem.Handle as IFH
4648import qualified Streamly.Internal.Prelude as Internal
4749import qualified Streamly.Internal.Memory.Array as IA
4850import qualified Streamly.Internal.Memory.ArrayStream as AS
@@ -57,7 +59,7 @@ import Test.Inspection
5759{-# INLINE last #-}
5860last :: Handle -> IO (Maybe Word8)
5961last inh = do
60− let s = FH.readArrays inh
62+ let s = IFH.readArrays inh
6163 larr <- S.last s
6264 return $ case larr of
6365 Nothing -> Nothing
@@ -72,7 +74,7 @@ inspect $ 'last `hasNoType` ''Step
7274{-# INLINE countBytes #-}
7375countBytes :: Handle -> IO Int
7476countBytes inh =
75− let s = FH.readArrays inh
77+ let s = IFH.readArrays inh
7678 in S.sum (S.map A.length s)
7779
7880#ifdef INSPECTION
@@ -83,7 +85,7 @@ inspect $ 'countBytes `hasNoType` ''Step
8385-- | Count the number of lines in a file.
8486{-# INLINE countLines #-}
8587countLines :: Handle -> IO Int
86−countLines = S.length . AS.splitOnSuffix 10 . FH.readArrays
88+countLines = S.length . AS.splitOnSuffix 10 . IFH.readArrays
8789
8890#ifdef INSPECTION
8991inspect $ hasNoTypeClasses 'countLines
@@ -94,7 +96,7 @@ inspect $ 'countLines `hasNoType` ''Step
9496-- | Count the number of lines in a file.
9597{-# INLINE countWords #-}
9698countWords :: Handle -> IO Int
97−countWords = S.length . AS.splitOn 32 . FH.readArrays
99+countWords = S.length . AS.splitOn 32 . IFH.readArrays
98100
99101#ifdef INSPECTION
100102inspect $ hasNoTypeClasses 'countWords
@@ -106,7 +108,7 @@ inspect $ 'countWords `hasNoType` ''Step
106108sumBytes :: Handle -> IO Word8
107109sumBytes inh = do
108110 let foldlArr' f z = runIdentity . S.foldl' f z . IA.toStream
109− let s = FH.readArrays inh
111+ let s = IFH.readArrays inh
110112 S.foldl' (\acc arr -> acc + foldlArr' (+) 0 arr) 0 s
111113
112114#ifdef INSPECTION
@@ -118,7 +120,7 @@ inspect $ 'sumBytes `hasNoType` ''Step
118120{-# INLINE cat #-}
119121cat :: Handle -> Handle -> IO ()
120122cat devNull inh =
121− S.fold (FH.writeArrays devNull) $ FH.readArraysOf (256*1024) inh
123+ S.fold (IFH.writeArrays devNull) $ IFH.readArraysOf (256*1024) inh
122124
123125#ifdef INSPECTION
124126inspect $ hasNoTypeClasses 'cat
@@ -129,8 +131,8 @@ inspect $ 'cat `hasNoType` ''Step
129131{-# INLINE copy #-}
130132copy :: Handle -> Handle -> IO ()
131133copy inh outh =
132− let s = FH.readArrays inh
133− in S.fold (FH.writeArrays outh) s
134+ let s = IFH.readArrays inh
135+ in S.fold (IFH.writeArrays outh) s
134136
135137#ifdef INSPECTION
136138inspect $ hasNoTypeClasses 'copy
@@ -141,10 +143,10 @@ inspect $ 'copy `hasNoType` ''Step
141143{-# INLINE linesUnlinesCopy #-}
142144linesUnlinesCopy :: Handle -> Handle -> IO ()
143145linesUnlinesCopy inh outh =
144− S.fold (FH.writeArraysInChunksOf (1024*1024) outh)
146+ S.fold (IFH.writeArraysInChunksOf (1024*1024) outh)
145147 $ Internal.insertAfterEach (return $ A.fromList [10])
146148 $ AS.splitOnSuffix 10
147− $ FH.readArraysOf (1024*1024) inh
149+ $ IFH.readArraysOf (1024*1024) inh
148150
149151#ifdef INSPECTION
150152inspect $ hasNoTypeClassesExcept 'linesUnlinesCopy [''Storable]
@@ -155,11 +157,11 @@ inspect $ hasNoTypeClassesExcept 'linesUnlinesCopy [''Storable]
155157{-# INLINE wordsUnwordsCopy #-}
156158wordsUnwordsCopy :: Handle -> Handle -> IO ()
157159wordsUnwordsCopy inh outh =
158− S.fold (FH.writeArraysInChunksOf (1024*1024) outh)
160+ S.fold (IFH.writeArraysInChunksOf (1024*1024) outh)
159161 $ S.intersperse (A.fromList [32])
160162 -- XXX use a word splitting combinator
161163 $ AS.splitOn 32
162− $ FH.readArraysOf (1024*1024) inh
164+ $ IFH.readArraysOf (1024*1024) inh
163165
164166#ifdef INSPECTION
165167inspect $ hasNoTypeClassesExcept 'wordsUnwordsCopy [''Storable]
@@ -171,7 +173,7 @@ decodeUtf8Lenient :: Handle -> IO ()
171173decodeUtf8Lenient inh =
172174 S.drain
173175 $ SS.decodeUtf8ArraysLenient
174− $ FH.readArraysOf (1024*1024) inh
176+ $ IFH.readArraysOf (1024*1024) inh
175177
176178#ifdef INSPECTION
177179inspect $ hasNoTypeClasses 'decodeUtf8Lenient
@@ -187,7 +189,7 @@ copyCodecUtf8Lenient inh outh =
187189 S.fold (FH.write outh)
188190 $ SS.encodeUtf8
189191 $ SS.decodeUtf8ArraysLenient
190− $ FH.readArraysOf (1024*1024) inh
192+ $ IFH.readArraysOf (1024*1024) inh
191193
192194#ifdef INSPECTION
193195inspect $ hasNoTypeClasses 'copyCodecUtf8Lenient