@@ -149,6 +149,7 @@ import Data.Bits ((.|.), (.&.), complement)
149import Data.Foldable (foldlM)
149import Data.Foldable (foldlM)
150import Data.Functor.Identity (runIdentity)
150import Data.Functor.Identity (runIdentity)
151import Data.IntMap.Lazy (IntMap)
151import Data.IntMap.Lazy (IntMap)
152+import Data.List.NonEmpty (NonEmpty)
152import Data.Word (Word8, Word32)
153import Data.Word (Word8, Word32)
153import Foreign.C.Error (throwErrnoIfMinus1)
154import Foreign.C.Error (throwErrnoIfMinus1)
154import Foreign.C.String (CString)
155import Foreign.C.String (CString)
@@ -172,8 +173,8 @@ import GHC.IO.Handle.Types (Handle__(..), Handle(FileHandle, DuplexHandle))
172import GHC.IO.Handle.FD (handleToFd)
173import GHC.IO.Handle.FD (handleToFd)
176import qualified Data.IntMap.Lazy as Map
176import qualified Data.IntMap.Lazy as Map
177+import qualified Data.List.NonEmpty as NonEmpty
177import qualified Streamly.Internal.Data.Fold as FL
178import qualified Streamly.Internal.Data.Fold as FL
178import qualified Streamly.Internal.Data.Parser as PR
179import qualified Streamly.Internal.Data.Parser as PR
179import qualified Streamly.Internal.Data.Stream.IsStream as S
180import qualified Streamly.Internal.Data.Stream.IsStream as S
@@ -619,10 +620,10 @@ removeFromWatch (Watch handle wdMap) path = do
620-- /Internal/
621-- /Internal/
622−openWatch :: Config -> [Array Word8] -> IO Watch
623+openWatch :: Config -> NonEmpty (Array Word8) -> IO Watch
623openWatch cfg paths = do
624openWatch cfg paths = do
624 w <- createWatch
625 w <- createWatch
625− foldlM (\w1 pth -> addToWatch cfg w1 pth) w paths
626+ foldlM (\w1 pth -> addToWatch cfg w1 pth) w (NonEmpty.toList paths)
627-- | Close a 'Watch' handle.
628-- | Close a 'Watch' handle.
@@ -731,7 +732,8 @@ watchToStream (Watch handle wdMap) =
732-- /Internal/
733-- /Internal/
734−watchPathsWith :: (Config -> Config) -> [Array Word8] -> SerialT IO Event
736+ (Config -> Config) -> NonEmpty (Array Word8) -> SerialT IO Event
735watchPathsWith f paths = S.bracket before after watchToStream
737watchPathsWith f paths = S.bracket before after watchToStream
@@ -747,7 +749,7 @@ watchPathsWith f paths = S.bracket before after watchToStream
748-- /Internal/
750-- /Internal/
750−watchPaths :: [Array Word8] -> SerialT IO Event
752+watchPaths :: NonEmpty (Array Word8) -> SerialT IO Event
751watchPaths = watchPathsWith id
753watchPaths = watchPathsWith id
753-------------------------------------------------------------------------------
755-------------------------------------------------------------------------------