Skip to content

Commit c433697

Browse files
Remove ReadOptions from read and reader
1 parent c1d7edb commit c433697

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

core/src/Streamly/Internal/FileSystem/Dir.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ pMapUnfoldE = fmap ePathMap . Unfold.lmapM Path.fromString
136136
--
137137
{-# INLINE reader #-}
138138
reader :: (MonadIO m, MonadCatch m) => Unfold m FilePath FilePath
139-
reader = fmap Path.toString $ Unfold.lmapM Path.fromString (DirIO.reader CONF)
139+
reader = fmap Path.toString $ Unfold.lmapM Path.fromString DirIO.reader
140140

141141
-- | Read directories as Left and files as Right. Filter out "." and ".."
142142
-- entries.

core/src/Streamly/Internal/FileSystem/DirIO.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,9 @@ dirReader f = fmap (fromLeft undefined) $ UF.filter isLeft (eitherReader f)
332332
--
333333
-- /Pre-release/
334334
{-# INLINE read #-}
335-
read :: (MonadIO m, MonadCatch m) => (ReadOptions -> ReadOptions) ->
335+
read :: (MonadIO m, MonadCatch m) =>
336336
Path -> Stream m Path
337-
read f = S.unfold (reader f)
337+
read = S.unfold reader
338338

339339
-- | Read directories as Left and files as Right. Filter out "." and ".."
340340
-- entries. The output contains the names of the directories and files.

core/src/Streamly/Internal/FileSystem/Posix/ReadDir.hsc

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -378,10 +378,8 @@ streamEitherReader confMod = Unfold step return
378378
Just x -> return $ Yield x s
379379

380380
{-# INLINE streamReader #-}
381-
streamReader
382-
:: MonadIO m
383-
=> (ReadOptions -> ReadOptions) -> Unfold m (PosixPath, DirStream) Path
384-
streamReader confMod = fmap (either id id) (streamEitherReader confMod)
381+
streamReader :: MonadIO m => Unfold m (PosixPath, DirStream) Path
382+
streamReader = fmap (either id id) (streamEitherReader id)
385383

386384
{-# INLINE before #-}
387385
before :: PosixPath -> IO (PosixPath, DirStream)
@@ -397,14 +395,13 @@ after (_, dirStream) = closeDirStream dirStream
397395
-- /Internal/
398396
--
399397
{-# INLINE reader #-}
400-
reader :: (MonadIO m, MonadCatch m)
401-
=> (ReadOptions -> ReadOptions) -> Unfold m Path Path
402-
reader confMod =
398+
reader :: (MonadIO m, MonadCatch m) => Unfold m Path Path
399+
reader =
403400
-- XXX Instead of using bracketIO for each iteration of the loop we should
404401
-- instead yield a buffer of dir entries in each iteration and then use an
405402
-- unfold and concat to flatten those entries. That should improve the
406403
-- performance.
407-
UF.bracketIO before after (streamReader confMod)
404+
UF.bracketIO before after (streamReader)
408405

409406
-- | Read directories as Left and files as Right. Filter out "." and ".."
410407
-- entries.

core/src/Streamly/Internal/FileSystem/Windows/ReadDir.hsc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,18 +240,16 @@ streamEitherReader f = Unfold step return
240240
Just x -> return $ Yield x strm
241241

242242
{-# INLINE streamReader #-}
243-
streamReader :: MonadIO m =>
244-
(ReadOptions -> ReadOptions) -> Unfold m DirStream Path
245-
streamReader f = fmap (either id id) (streamEitherReader f)
243+
streamReader :: MonadIO m => Unfold m DirStream Path
244+
streamReader = fmap (either id id) (streamEitherReader id)
246245

247246
-- | Read a directory emitting a stream with names of the children. Filter out
248247
-- "." and ".." entries.
249248
--
250249
-- /Internal/
251250

252251
{-# INLINE reader #-}
253-
reader :: (MonadIO m, MonadCatch m) =>
254-
(ReadOptions -> ReadOptions) -> Unfold m Path Path
252+
reader :: (MonadIO m, MonadCatch m) => Unfold m Path Path
255253
reader f =
256254
-- XXX Instead of using bracketIO for each iteration of the loop we should
257255
-- instead yield a buffer of dir entries in each iteration and then use an

0 commit comments

Comments
 (0)