@@ -200,7 +200,7 @@ import qualified Streamly.Internal.Unicode.Stream as U
200-- | Watch configuration, used to specify the events of interest and the
200-- | Watch configuration, used to specify the events of interest and the
201-- behavior of the watch.
201-- behavior of the watch.
203−-- /Internal/
203+-- /Pre-release/
205data Config = Config
205data Config = Config
206 { watchRec :: Bool
206 { watchRec :: Bool
@@ -213,7 +213,7 @@ data Config = Config
214-- | Whether a setting is 'On' or 'Off'.
214-- | Whether a setting is 'On' or 'Off'.
216−-- /Internal/
216+-- /Pre-release/
218data Toggle = On | Off
218data Toggle = On | Off
@@ -238,7 +238,7 @@ setFlag mask status cfg@Config{..} =
239-- /default: Off/
239-- /default: Off/
241−-- /Internal/
241+-- /Pre-release/
243setRecursiveMode :: Bool -> Config -> Config
243setRecursiveMode :: Bool -> Config -> Config
244setRecursiveMode rec cfg@Config{} = cfg {watchRec = rec}
244setRecursiveMode rec cfg@Config{} = cfg {watchRec = rec}
@@ -251,7 +251,7 @@ foreign import capi
252-- /default: On/
252-- /default: On/
254−-- /Internal/
254+-- /Pre-release/
256setFollowSymLinks :: Toggle -> Config -> Config
256setFollowSymLinks :: Toggle -> Config -> Config
257setFollowSymLinks s = setFlag iN_DONT_FOLLOW (toggle s)
257setFollowSymLinks s = setFlag iN_DONT_FOLLOW (toggle s)
@@ -264,7 +264,7 @@ foreign import capi
265-- /default: On/
265-- /default: On/
267−-- /Internal/
267+-- /Pre-release/
269setUnwatchMoved :: Toggle -> Config -> Config
269setUnwatchMoved :: Toggle -> Config -> Config
270setUnwatchMoved = setFlag iN_EXCL_UNLINK
270setUnwatchMoved = setFlag iN_EXCL_UNLINK
@@ -280,7 +280,7 @@ foreign import capi
280-- | What to do if a watch already exists when 'openWatch' or 'addToWatch' is
280-- | What to do if a watch already exists when 'openWatch' or 'addToWatch' is
281-- called for a path.
281-- called for a path.
283−-- /Internal/
283+-- /Pre-release/
285data WhenExists =
285data WhenExists =
286 AddIfExists -- ^ Do not set an existing setting to 'Off' only set to 'On'
286 AddIfExists -- ^ Do not set an existing setting to 'Off' only set to 'On'
@@ -294,7 +294,7 @@ data WhenExists =
295-- /default: FailIfExists/
295-- /default: FailIfExists/
297−-- /Internal/
297+-- /Pre-release/
299setWhenExists :: WhenExists -> Config -> Config
299setWhenExists :: WhenExists -> Config -> Config
300setWhenExists val cfg =
300setWhenExists val cfg =
@@ -312,7 +312,7 @@ foreign import capi
313-- /default: Off/
313-- /default: Off/
315−-- /Internal/
315+-- /Pre-release/
317setOneShot :: Toggle -> Config -> Config
317setOneShot :: Toggle -> Config -> Config
318setOneShot = setFlag iN_ONESHOT
318setOneShot = setFlag iN_ONESHOT
@@ -325,7 +325,7 @@ foreign import capi
326-- /default: Off/
326-- /default: Off/
328−-- /Internal/
328+-- /Pre-release/
330setOnlyDir :: Toggle -> Config -> Config
330setOnlyDir :: Toggle -> Config -> Config
331setOnlyDir = setFlag iN_ONLYDIR
331setOnlyDir = setFlag iN_ONLYDIR
@@ -341,7 +341,7 @@ foreign import capi
342-- /default: On/
342-- /default: On/
344−-- /Internal/
344+-- /Pre-release/
346setRootDeleted :: Toggle -> Config -> Config
346setRootDeleted :: Toggle -> Config -> Config
347setRootDeleted = setFlag iN_DELETE_SELF
347setRootDeleted = setFlag iN_DELETE_SELF
@@ -353,7 +353,7 @@ foreign import capi
354-- /default: On/
354-- /default: On/
356−-- /Internal/
356+-- /Pre-release/
358setRootMoved :: Toggle -> Config -> Config
358setRootMoved :: Toggle -> Config -> Config
359setRootMoved = setFlag iN_MOVE_SELF
359setRootMoved = setFlag iN_MOVE_SELF
@@ -366,7 +366,7 @@ foreign import capi
367-- /default: On/
367-- /default: On/
369−-- /Internal/
369+-- /Pre-release/
371setMetadataChanged :: Toggle -> Config -> Config
371setMetadataChanged :: Toggle -> Config -> Config
372setMetadataChanged = setFlag iN_ATTRIB
372setMetadataChanged = setFlag iN_ATTRIB
@@ -378,7 +378,7 @@ foreign import capi
379-- /default: On/
379-- /default: On/
381−-- /Internal/
381+-- /Pre-release/
383setAccessed :: Toggle -> Config -> Config
383setAccessed :: Toggle -> Config -> Config
384setAccessed = setFlag iN_ACCESS
384setAccessed = setFlag iN_ACCESS
@@ -390,7 +390,7 @@ foreign import capi
391-- /default: On/
391-- /default: On/
393−-- /Internal/
393+-- /Pre-release/
395setOpened :: Toggle -> Config -> Config
395setOpened :: Toggle -> Config -> Config
396setOpened = setFlag iN_OPEN
396setOpened = setFlag iN_OPEN
@@ -402,7 +402,7 @@ foreign import capi
403-- /default: On/
403-- /default: On/
405−-- /Internal/
405+-- /Pre-release/
407setWriteClosed :: Toggle -> Config -> Config
407setWriteClosed :: Toggle -> Config -> Config
408setWriteClosed = setFlag iN_CLOSE_WRITE
408setWriteClosed = setFlag iN_CLOSE_WRITE
@@ -414,7 +414,7 @@ foreign import capi
415-- /default: On/
415-- /default: On/
417−-- /Internal/
417+-- /Pre-release/
419setNonWriteClosed :: Toggle -> Config -> Config
419setNonWriteClosed :: Toggle -> Config -> Config
420setNonWriteClosed = setFlag iN_CLOSE_NOWRITE
420setNonWriteClosed = setFlag iN_CLOSE_NOWRITE
@@ -426,7 +426,7 @@ foreign import capi
427-- /default: On/
427-- /default: On/
429−-- /Internal/
429+-- /Pre-release/
431setCreated :: Toggle -> Config -> Config
431setCreated :: Toggle -> Config -> Config
432setCreated = setFlag iN_CREATE
432setCreated = setFlag iN_CREATE
@@ -438,7 +438,7 @@ foreign import capi
439-- /default: On/
439-- /default: On/
441−-- /Internal/
441+-- /Pre-release/
443setDeleted :: Toggle -> Config -> Config
443setDeleted :: Toggle -> Config -> Config
444setDeleted = setFlag iN_DELETE
444setDeleted = setFlag iN_DELETE
@@ -450,7 +450,7 @@ foreign import capi
451-- /default: On/
451-- /default: On/
453−-- /Internal/
453+-- /Pre-release/
455setMovedFrom :: Toggle -> Config -> Config
455setMovedFrom :: Toggle -> Config -> Config
456setMovedFrom = setFlag iN_MOVED_FROM
456setMovedFrom = setFlag iN_MOVED_FROM
@@ -462,7 +462,7 @@ foreign import capi
463-- /default: On/
463-- /default: On/
465−-- /Internal/
465+-- /Pre-release/
467setMovedTo :: Toggle -> Config -> Config
467setMovedTo :: Toggle -> Config -> Config
468setMovedTo = setFlag iN_MOVED_TO
468setMovedTo = setFlag iN_MOVED_TO
@@ -474,7 +474,7 @@ foreign import capi
475-- /default: On/
475-- /default: On/
477−-- /Internal/
477+-- /Pre-release/
479setModified :: Toggle -> Config -> Config
479setModified :: Toggle -> Config -> Config
480setModified = setFlag iN_MODIFY
480setModified = setFlag iN_MODIFY
@@ -483,7 +483,7 @@ setModified = setFlag iN_MODIFY
484-- /default: On/
484-- /default: On/
486−-- /Internal/
486+-- /Pre-release/
488setAllEvents :: Toggle -> Config -> Config
488setAllEvents :: Toggle -> Config -> Config
489setAllEvents s cfg =
489setAllEvents s cfg =
@@ -517,7 +517,7 @@ setAllEvents s cfg =
517-- * 'setWhenExists' 'AddIfExists'
517-- * 'setWhenExists' 'AddIfExists'
518-- * 'setAllEvents' 'On'
518-- * 'setAllEvents' 'On'
520−-- /Internal/
520+-- /Pre-release/
522defaultConfig :: Config
522defaultConfig :: Config
523defaultConfig =
523defaultConfig =
@@ -556,7 +556,7 @@ foreign import ccall unsafe
556-- | Create a 'Watch' handle. 'addToWatch' can be used to add paths being
556-- | Create a 'Watch' handle. 'addToWatch' can be used to add paths being
557-- monitored by this watch.
557-- monitored by this watch.
559−-- /Internal/
559+-- /Pre-release/
561createWatch :: IO Watch
561createWatch :: IO Watch
562createWatch = do
562createWatch = do
@@ -634,7 +634,7 @@ ensureTrailingSlash path =
634-- being monitored under @root@ via the watch handle @watch@. @root@ must be
634-- being monitored under @root@ via the watch handle @watch@. @root@ must be
635-- an absolute path and @subpath@ must be relative to @root@.
635-- an absolute path and @subpath@ must be relative to @root@.
637−-- /Internal/
637+-- /Pre-release/
639addToWatch :: Config -> Watch -> Array Word8 -> Array Word8 -> IO ()
639addToWatch :: Config -> Watch -> Array Word8 -> Array Word8 -> IO ()
640addToWatch cfg@Config{..} watch@(Watch handle wdMap) root0 path0 = do
640addToWatch cfg@Config{..} watch@(Watch handle wdMap) root0 path0 = do
@@ -698,7 +698,7 @@ foreign import ccall unsafe
698-- adding you need to provide the original path which was used to add the
698-- adding you need to provide the original path which was used to add the
701−-- /Internal/
701+-- /Pre-release/
703removeFromWatch :: Watch -> Array Word8 -> IO ()
703removeFromWatch :: Watch -> Array Word8 -> IO ()
704removeFromWatch (Watch handle wdMap) path = do
704removeFromWatch (Watch handle wdMap) path = do
@@ -722,7 +722,7 @@ removeFromWatch (Watch handle wdMap) path = do
722-- monitoring the paths for file system events. Returns a 'Watch' handle which
722-- monitoring the paths for file system events. Returns a 'Watch' handle which
723-- can then be used to read the event stream or to close the watch.
723-- can then be used to read the event stream or to close the watch.
725−-- /Internal/
725+-- /Pre-release/
727openWatch :: Config -> NonEmpty (Array Word8) -> IO Watch
727openWatch :: Config -> NonEmpty (Array Word8) -> IO Watch
728openWatch cfg paths = do
728openWatch cfg paths = do
@@ -732,7 +732,7 @@ openWatch cfg paths = do
733-- | Close a 'Watch' handle.
733-- | Close a 'Watch' handle.
735−-- /Internal/
735+-- /Pre-release/
737closeWatch :: Watch -> IO ()
737closeWatch :: Watch -> IO ()
738closeWatch (Watch h _) = hClose h
738closeWatch (Watch h _) = hClose h
@@ -746,7 +746,7 @@ newtype Cookie = Cookie Word32 deriving (Show, Eq)
746-- | An Event generated by the file system. Use the accessor functions to
746-- | An Event generated by the file system. Use the accessor functions to
747-- examine the event.
747-- examine the event.
749−-- /Internal/
749+-- /Pre-release/
751data Event = Event
751data Event = Event
752 { eventWd :: CInt
752 { eventWd :: CInt
@@ -856,7 +856,7 @@ watchToStream cfg wt@(Watch handle _) = do
856-- [Array.fromCString\# "dir"#]
856-- [Array.fromCString\# "dir"#]
859−-- /Internal/
859+-- /Pre-release/
861watchPathsWith ::
861watchPathsWith ::
862 (Config -> Config) -> NonEmpty (Array Word8) -> SerialT IO Event
862 (Config -> Config) -> NonEmpty (Array Word8) -> SerialT IO Event
@@ -868,7 +868,7 @@ watchPathsWith f = watchTreesWith (f . setRecursiveMode False)
868-- watchPaths = watchPathsWith id
868-- watchPaths = watchPathsWith id
871−-- /Internal/
871+-- /Pre-release/
873watchPaths :: NonEmpty (Array Word8) -> SerialT IO Event
873watchPaths :: NonEmpty (Array Word8) -> SerialT IO Event
874watchPaths = watchPathsWith id
874watchPaths = watchPathsWith id
@@ -897,7 +897,7 @@ watchPaths = watchPathsWith id
898-- See the Linux __inotify__ man page for more details.
898-- See the Linux __inotify__ man page for more details.
900−-- /Internal/
900+-- /Pre-release/
902watchTreesWith ::
902watchTreesWith ::
903 (Config -> Config) -> NonEmpty (Array Word8) -> SerialT IO Event
903 (Config -> Config) -> NonEmpty (Array Word8) -> SerialT IO Event
@@ -929,7 +929,7 @@ watchTrees = watchTreesWith id
930-- TBD: we can possibly update the watch root on a move self event.
930-- TBD: we can possibly update the watch root on a move self event.
932−-- /Internal/
932+-- /Pre-release/
934getRoot :: Event -> Array Word8
934getRoot :: Event -> Array Word8
935getRoot Event{..} =
935getRoot Event{..} =
@@ -946,7 +946,7 @@ getRoot Event{..} =
946-- | Get the file system object path for which the event is generated, relative
946-- | Get the file system object path for which the event is generated, relative
947-- to the watched root. The path is a "/" separated array of bytes.
947-- to the watched root. The path is a "/" separated array of bytes.
949−-- /Internal/
949+-- /Pre-release/
951getRelPath :: Event -> Array Word8
951getRelPath :: Event -> Array Word8
952getRelPath Event{..} = eventRelPath
952getRelPath Event{..} = eventRelPath
@@ -955,7 +955,7 @@ getRelPath Event{..} = eventRelPath
955-- | Get the absolute file system object path for which the event is generated.
955-- | Get the absolute file system object path for which the event is generated.
956-- The path is a "/" separated array of bytes.
956-- The path is a "/" separated array of bytes.
958−-- /Internal/
958+-- /Pre-release/
960getAbsPath :: Event -> Array Word8
960getAbsPath :: Event -> Array Word8
961getAbsPath ev = getRoot ev <> getRelPath ev
961getAbsPath ev = getRoot ev <> getRelPath ev
@@ -965,7 +965,7 @@ getAbsPath ev = getRoot ev <> getRelPath ev
965-- connect the 'isMovedFrom' and 'isMovedTo' events, if both the events belong
965-- connect the 'isMovedFrom' and 'isMovedTo' events, if both the events belong
966-- to the same move operation then they will have the same cookie value.
966-- to the same move operation then they will have the same cookie value.
968−-- /Internal/
968+-- /Pre-release/
970getCookie :: Event -> Cookie
970getCookie :: Event -> Cookie
971getCookie Event{..} = Cookie eventCookie
971getCookie Event{..} = Cookie eventCookie
@@ -993,7 +993,7 @@ foreign import capi
993-- some events.. The user application must scan everything under the watched
993-- some events.. The user application must scan everything under the watched
994-- paths to know the current state.
994-- paths to know the current state.
996−-- /Internal/
996+-- /Pre-release/
998isOverflow :: Event -> Bool
998isOverflow :: Event -> Bool
999isOverflow = getFlag iN_Q_OVERFLOW
999isOverflow = getFlag iN_Q_OVERFLOW
@@ -1012,7 +1012,7 @@ foreign import capi
1013-- /Occurs only for a watched path/
1013-- /Occurs only for a watched path/
1015−-- /Internal/
1015+-- /Pre-release/
1017isRootUnwatched :: Event -> Bool
1017isRootUnwatched :: Event -> Bool
1018isRootUnwatched = getFlag iN_IGNORED
1018isRootUnwatched = getFlag iN_IGNORED
@@ -1025,7 +1025,7 @@ isRootUnwatched = getFlag iN_IGNORED
1026-- /Occurs only for a watched path/
1026-- /Occurs only for a watched path/
1028−-- /Internal/
1028+-- /Pre-release/
1030isRootDeleted :: Event -> Bool
1030isRootDeleted :: Event -> Bool
1031isRootDeleted = getFlag iN_DELETE_SELF
1031isRootDeleted = getFlag iN_DELETE_SELF
@@ -1034,7 +1034,7 @@ isRootDeleted = getFlag iN_DELETE_SELF
1035-- /Occurs only for a watched path/
1035-- /Occurs only for a watched path/
1037−-- /Internal/
1037+-- /Pre-release/
1039isRootMoved :: Event -> Bool
1039isRootMoved :: Event -> Bool
1040isRootMoved = getFlag iN_MOVE_SELF
1040isRootMoved = getFlag iN_MOVE_SELF
@@ -1048,7 +1048,7 @@ foreign import capi
1049-- /Occurs only for a watched path/
1049-- /Occurs only for a watched path/
1051−-- /Internal/
1051+-- /Pre-release/
1053isRootUnmounted :: Event -> Bool
1053isRootUnmounted :: Event -> Bool
1054isRootUnmounted = getFlag iN_UNMOUNT
1054isRootUnmounted = getFlag iN_UNMOUNT
@@ -1069,7 +1069,7 @@ isRootUnmounted = getFlag iN_UNMOUNT
1070-- /Can occur for watched path or a file inside it/
1070-- /Can occur for watched path or a file inside it/
1072−-- /Internal/
1072+-- /Pre-release/
1074isMetadataChanged :: Event -> Bool
1074isMetadataChanged :: Event -> Bool
1075isMetadataChanged = getFlag iN_ATTRIB
1075isMetadataChanged = getFlag iN_ATTRIB
@@ -1082,7 +1082,7 @@ isMetadataChanged = getFlag iN_ATTRIB
1083-- /Occurs only for a file inside the watched directory/
1083-- /Occurs only for a file inside the watched directory/
1085−-- /Internal/
1085+-- /Pre-release/
1087isAccessed :: Event -> Bool
1087isAccessed :: Event -> Bool
1088isAccessed = getFlag iN_ACCESS
1088isAccessed = getFlag iN_ACCESS
@@ -1091,7 +1091,7 @@ isAccessed = getFlag iN_ACCESS
1092-- /Occurs only for a file inside the watched directory/
1092-- /Occurs only for a file inside the watched directory/
1094−-- /Internal/
1094+-- /Pre-release/
1096isOpened :: Event -> Bool
1096isOpened :: Event -> Bool
1097isOpened = getFlag iN_OPEN
1097isOpened = getFlag iN_OPEN
@@ -1100,7 +1100,7 @@ isOpened = getFlag iN_OPEN
1101-- /Occurs only for a file inside the watched directory/
1101-- /Occurs only for a file inside the watched directory/
1103−-- /Internal/
1103+-- /Pre-release/
1105isWriteClosed :: Event -> Bool
1105isWriteClosed :: Event -> Bool
1106isWriteClosed = getFlag iN_CLOSE_WRITE
1106isWriteClosed = getFlag iN_CLOSE_WRITE
@@ -1112,7 +1112,7 @@ isWriteClosed = getFlag iN_CLOSE_WRITE
1113-- /Can occur for watched path or a file inside it/
1113-- /Can occur for watched path or a file inside it/
1115−-- /Internal/
1115+-- /Pre-release/
1117isNonWriteClosed :: Event -> Bool
1117isNonWriteClosed :: Event -> Bool
1118isNonWriteClosed = getFlag iN_CLOSE_NOWRITE
1118isNonWriteClosed = getFlag iN_CLOSE_NOWRITE
@@ -1128,7 +1128,7 @@ isNonWriteClosed = getFlag iN_CLOSE_NOWRITE
1129-- /Occurs only for an object inside the watched directory/
1129-- /Occurs only for an object inside the watched directory/
1131−-- /Internal/
1131+-- /Pre-release/
1133isCreated :: Event -> Bool
1133isCreated :: Event -> Bool
1134isCreated = getFlag iN_CREATE
1134isCreated = getFlag iN_CREATE
@@ -1137,7 +1137,7 @@ isCreated = getFlag iN_CREATE
1138-- /Occurs only for an object inside the watched directory/
1138-- /Occurs only for an object inside the watched directory/
1140−-- /Internal/
1140+-- /Pre-release/
1142isDeleted :: Event -> Bool
1142isDeleted :: Event -> Bool
1143isDeleted = getFlag iN_DELETE
1143isDeleted = getFlag iN_DELETE
@@ -1150,7 +1150,7 @@ isDeleted = getFlag iN_DELETE
1151-- /Occurs only for an object inside the watched directory/
1151-- /Occurs only for an object inside the watched directory/
1153−-- /Internal/
1153+-- /Pre-release/
1155isMovedFrom :: Event -> Bool
1155isMovedFrom :: Event -> Bool
1156isMovedFrom = getFlag iN_MOVED_FROM
1156isMovedFrom = getFlag iN_MOVED_FROM
@@ -1160,7 +1160,7 @@ isMovedFrom = getFlag iN_MOVED_FROM
1161-- /Occurs only for an object inside the watched directory/
1161-- /Occurs only for an object inside the watched directory/
1163−-- /Internal/
1163+-- /Pre-release/
1165isMovedTo :: Event -> Bool
1165isMovedTo :: Event -> Bool
1166isMovedTo = getFlag iN_MOVED_TO
1166isMovedTo = getFlag iN_MOVED_TO
@@ -1170,7 +1170,7 @@ isMovedTo = getFlag iN_MOVED_TO
1171-- /Occurs only for an object inside the watched directory/
1171-- /Occurs only for an object inside the watched directory/
1173−-- /Internal/
1173+-- /Pre-release/
1175isModified :: Event -> Bool
1175isModified :: Event -> Bool
1176isModified = getFlag iN_MODIFY
1176isModified = getFlag iN_MODIFY
@@ -1184,7 +1184,7 @@ foreign import capi
1185-- | Determine whether the event is for a directory path.
1185-- | Determine whether the event is for a directory path.
1187−-- /Internal/
1187+-- /Pre-release/
1189isDir :: Event -> Bool
1189isDir :: Event -> Bool
1190isDir = getFlag iN_ISDIR
1190isDir = getFlag iN_ISDIR