@@ -121,7 +121,8 @@ import System.Win32.File
121121 )
122122import System.Win32.Types (BOOL, DWORD, HANDLE, LPVOID, LPDWORD, failIfFalse_)
123123import qualified Data.List.NonEmpty as NonEmpty
124−import qualified Streamly.Internal.Data.Stream.IsStream as S
124+import qualified Streamly.Data.Fold as Fold
125+import qualified Streamly.Internal.Data.Stream as S
125126import qualified Streamly.Internal.Unicode.Stream as U
126127import qualified Streamly.Internal.Unicode.Utf8 as UTF8
127128import qualified Streamly.Internal.Data.Array.Unboxed as A
@@ -416,7 +417,8 @@ eventStreamAggr :: (HANDLE, FilePath, Config) -> Stream IO Event
416417eventStreamAggr (handle, rootPath, cfg) = do
417418 let recMode = getConfigRecMode cfg
418419 flagMasks = getConfigFlag cfg
419− S.concatMap S.fromList $ S.repeatM
420+ repeatM = S.sequence . S.repeat
421+ S.concatMap S.fromList $ repeatM
420422 $ readDirectoryChanges rootPath handle recMode flagMasks
421423
422424pathsToHandles ::
@@ -424,14 +426,14 @@ pathsToHandles ::
424426pathsToHandles paths cfg = do
425427 let pathStream = S.fromList (NonEmpty.toList paths)
426428 st2 = S.mapM getWatchHandle pathStream
427− S.map (\(h, f) -> (h, f, cfg)) st2
429+ fmap (\(h, f) -> (h, f, cfg)) st2
428430
429431-------------------------------------------------------------------------------
430432-- Utilities
431433-------------------------------------------------------------------------------
432434
433435utf8ToString :: Array Word8 -> FilePath
434−utf8ToString = runIdentity . S.toList . U.decodeUtf8 . A.toStream
436+utf8ToString = runIdentity . S.fold Fold.toList . U.decodeUtf8 . A.toStream
435437
436438utf8ToStringList :: NonEmpty (Array Word8) -> NonEmpty FilePath
437439utf8ToStringList = NonEmpty.map utf8ToString
@@ -439,7 +441,9 @@ utf8ToStringList = NonEmpty.map utf8ToString
439441-- | Close a Directory handle.
440442--
441443closePathHandleStream :: Stream IO (HANDLE, FilePath, Config) -> IO ()
442−closePathHandleStream = S.mapM_ (\(h, _, _) -> closeHandle h)
444+closePathHandleStream =
445+ let f (h, _, _) = closeHandle h
446+ in S.fold (Fold.drainBy f)
443447
444448-- XXX
445449-- Document the path treatment for Linux/Windows/macOS modules.