on master help sign in
Use Bool instead of Switch
64aa13dAdithya Kumar
src/Streamly/Internal/FileSystem/Event/Darwin.hs+48−55
@@ -92,7 +92,6 @@ module Streamly.Internal.FileSystem.Event.Darwin
92
92
93 -- ** Default configuration
93 -- ** Default configuration
94 Config (..)
94 Config (..)
95− , Switch (..)
96 , defaultConfig
95 , defaultConfig
97
96
98 -- ** Watch Behavior
97 -- ** Watch Behavior
@@ -192,7 +191,7 @@ import qualified Streamly.Internal.Data.Array.Unboxed as A
192-------------------------------------------------------------------------------
191-------------------------------------------------------------------------------
193
192
194-- XXX Add a recursive option to Config
193-- XXX Add a recursive option to Config
195−-- Keep setRecursiveMode Off as undefined for now until we implement it.
194+-- Keep setRecursiveMode False as undefined for now until we implement it.
196--
195--
197-- | Watch configuration, used to specify the events of interest and the
196-- | Watch configuration, used to specify the events of interest and the
198-- behavior of the watch.
197-- behavior of the watch.
@@ -233,28 +232,22 @@ setEventBatching :: BatchInfo -> Config -> Config
233setEventBatching batchInfo cfg =
232setEventBatching batchInfo cfg =
234 let (t, status) =
233 let (t, status) =
235 case batchInfo of
234 case batchInfo of
236− Throttle sec | sec < 0 -> (0, On)
235+ Throttle sec | sec < 0 -> (0, True)
237− Throttle sec -> (sec, On)
236+ Throttle sec -> (sec, True)
238− Batch sec | sec < 0 -> (0, Off)
237+ Batch sec | sec < 0 -> (0, False)
239− Batch sec -> (sec, Off)
238+ Batch sec -> (sec, False)
240 in setFlag kFSEventStreamCreateFlagNoDefer status $ cfg {latency = t}
239 in setFlag kFSEventStreamCreateFlagNoDefer status $ cfg {latency = t}
241
240
242-------------------------------------------------------------------------------
241-------------------------------------------------------------------------------
243-- Boolean settings
242-- Boolean settings
244-------------------------------------------------------------------------------
243-------------------------------------------------------------------------------
245
244
246−-- | Whether a setting is 'On' or 'Off'.
247−--
248−-- /Pre-release/
249−--
250−data Switch = On | Off
251−
252−setFlag :: Word32 -> Switch -> Config -> Config
245+setFlag :: Word32 -> Bool -> Config -> Config
253setFlag mask status cfg@Config{..} =
246setFlag mask status cfg@Config{..} =
254 let flags =
247 let flags =
255− case status of
248+ if status
256− On -> createFlags .|. mask
249+ then createFlags .|. mask
257− Off -> createFlags .&. complement mask
250+ else createFlags .&. complement mask
258 in cfg {createFlags = flags}
251 in cfg {createFlags = flags}
259
252
260foreign import ccall safe
253foreign import ccall safe
@@ -267,26 +260,26 @@ foreign import ccall safe
267-- | Any changes to the path (delete, rename, or create) of an object are
260-- | Any changes to the path (delete, rename, or create) of an object are
268-- reported as events for its parent directory. Such events are not reported
261-- reported as events for its parent directory. Such events are not reported
269-- for the watch root itself because its parent is not being watched. When
262-- for the watch root itself because its parent is not being watched. When
270−-- 'setRootPathEvents' is 'On', an 'isRootPathEvent' event is generated with an
263+-- 'setRootPathEvents' is 'True', an 'isRootPathEvent' event is generated with an
271-- eventId 0 if the watch root is deleted, renamed or created.
264-- eventId 0 if the watch root is deleted, renamed or created.
272--
265--
273-- Note: We have observed that an 'isDeleted' event occurs for the root path
266-- Note: We have observed that an 'isDeleted' event occurs for the root path
274-- (when it is a regular dir and not symlink) even when this option is off.
267-- (when it is a regular dir and not symlink) even when this option is off.
275--
268--
276−-- /default: Off/
269+-- /default: False/
277--
270--
278-- /macOS 10.5+/
271-- /macOS 10.5+/
279--
272--
280-- /Pre-release/
273-- /Pre-release/
281--
274--
282−setRootPathEvents :: Switch -> Config -> Config
275+setRootPathEvents :: Bool -> Config -> Config
283setRootPathEvents = setFlag kFSEventStreamCreateFlagWatchRoot
276setRootPathEvents = setFlag kFSEventStreamCreateFlagWatchRoot
284
277
285foreign import ccall safe
278foreign import ccall safe
286 "FSEventStreamCreateFlagFileEvents"
279 "FSEventStreamCreateFlagFileEvents"
287 kFSEventStreamCreateFlagFileEvents :: Word32
280 kFSEventStreamCreateFlagFileEvents :: Word32
288
281
289−-- | When this is 'Off' only events for the watched directories are reported.
282+-- | When this is 'False' only events for the watched directories are reported.
290-- For example, when a file is created inside a directory it is reported as an
283-- For example, when a file is created inside a directory it is reported as an
291-- event, the path name in the event is the path of the directory being watched
284-- event, the path name in the event is the path of the directory being watched
292-- and not of the specific item for which the event occurred. Events cannot be
285-- and not of the specific item for which the event occurred. Events cannot be
@@ -294,33 +287,33 @@ foreign import ccall safe
294-- if an event is a "create" or "delete", we only know that some event ocurred
287-- if an event is a "create" or "delete", we only know that some event ocurred
295-- under the watched directory hierarchy.
288-- under the watched directory hierarchy.
296--
289--
297−-- When it is 'On' the path reported in the event is the path of the item and
290+-- When it is 'True' the path reported in the event is the path of the item and
298-- not the of the directory in which it is contained. We can use the event
291-- not the of the directory in which it is contained. We can use the event
299-- accessor functions to determine the event type and the path type etc.
292-- accessor functions to determine the event type and the path type etc.
300--
293--
301−-- /default: On/
294+-- /default: True/
302--
295--
303-- /macOS 10.7+/
296-- /macOS 10.7+/
304--
297--
305-- /Pre-release/
298-- /Pre-release/
306--
299--
307−setFileEvents :: Switch -> Config -> Config
300+setFileEvents :: Bool -> Config -> Config
308setFileEvents = setFlag kFSEventStreamCreateFlagFileEvents
301setFileEvents = setFlag kFSEventStreamCreateFlagFileEvents
309
302
310foreign import ccall safe
303foreign import ccall safe
311 "FSEventStreamCreateFlagIgnoreSelf"
304 "FSEventStreamCreateFlagIgnoreSelf"
312 kFSEventStreamCreateFlagIgnoreSelf :: Word32
305 kFSEventStreamCreateFlagIgnoreSelf :: Word32
313
306
314−-- | When this is 'On' events generated by the current process are not
307+-- | When this is 'True' events generated by the current process are not
315-- reported.
308-- reported.
316--
309--
317−-- /default: Off/
310+-- /default: False/
318--
311--
319-- /macOS 10.6+/
312-- /macOS 10.6+/
320--
313--
321-- /Pre-release/
314-- /Pre-release/
322--
315--
323−setIgnoreSelf :: Switch -> Config -> Config
316+setIgnoreSelf :: Bool -> Config -> Config
324setIgnoreSelf = setFlag kFSEventStreamCreateFlagIgnoreSelf
317setIgnoreSelf = setFlag kFSEventStreamCreateFlagIgnoreSelf
325
318
326#if HAVE_DECL_KFSEVENTSTREAMCREATEFLAGFULLHISTORY
319#if HAVE_DECL_KFSEVENTSTREAMCREATEFLAGFULLHISTORY
@@ -328,26 +321,26 @@ foreign import ccall safe
328 "FSEventStreamCreateFlagFullHistory"
321 "FSEventStreamCreateFlagFullHistory"
329 kFSEventStreamCreateFlagFullHistory :: Word32
322 kFSEventStreamCreateFlagFullHistory :: Word32
330
323
331−-- | When this is 'On' all events since the beginning of time are reported.
324+-- | When this is 'True' all events since the beginning of time are reported.
332--
325--
333−-- /default: Off/
326+-- /default: False/
334--
327--
335-- /macOS 10.15+/
328-- /macOS 10.15+/
336--
329--
337-- /Pre-release/
330-- /Pre-release/
338--
331--
339−setFullHistory :: Switch -> Config -> Config
332+setFullHistory :: Bool -> Config -> Config
340setFullHistory = setFlag kFSEventStreamCreateFlagFullHistory
333setFullHistory = setFlag kFSEventStreamCreateFlagFullHistory
341#endif
334#endif
342
335
343−-- | Set all tunable events 'On' or 'Off'. Equivalent to setting:
336+-- | Set all tunable events 'True' or 'False'. Equivalent to setting:
344--
337--
345-- * setRootPathEvents
338-- * setRootPathEvents
346-- * setFileEvents
339-- * setFileEvents
347--
340--
348-- /Pre-release/
341-- /Pre-release/
349--
342--
350−setAllEvents :: Switch -> Config -> Config
343+setAllEvents :: Bool -> Config -> Config
351setAllEvents s =
344setAllEvents s =
352 setRootPathEvents s
345 setRootPathEvents s
353 . setFileEvents s
346 . setFileEvents s
@@ -359,17 +352,17 @@ setAllEvents s =
359-- | The default settings are:
352-- | The default settings are:
360--
353--
361-- * 'setEventBatching' ('Batch' 0.0)
354-- * 'setEventBatching' ('Batch' 0.0)
362−-- * 'setFileEvents' 'On'
355+-- * 'setFileEvents' 'True'
363−-- * 'setRootPathEvents' 'Off'
356+-- * 'setRootPathEvents' 'False'
364−-- * 'setIgnoreSelf' 'Off'
357+-- * 'setIgnoreSelf' 'False'
365#if HAVE_DECL_KFSEVENTSTREAMCREATEFLAGFULLHISTORY
358#if HAVE_DECL_KFSEVENTSTREAMCREATEFLAGFULLHISTORY
366−-- * 'setFullHistory' 'Off'
359+-- * 'setFullHistory' 'False'
367#endif
360#endif
368--
361--
369-- /Pre-release/
362-- /Pre-release/
370--
363--
371defaultConfig :: Config
364defaultConfig :: Config
372−defaultConfig = setFileEvents On $ Config
365+defaultConfig = setFileEvents True $ Config
373 { latency = 0.0
366 { latency = 0.0
374 , createFlags = 0
367 , createFlags = 0
375 }
368 }
@@ -559,7 +552,7 @@ watchToStream (Watch handle _ _) =
559-- @
552-- @
560-- {-\# LANGUAGE MagicHash #-}
553-- {-\# LANGUAGE MagicHash #-}
561-- watchWith
554-- watchWith
562−-- ('setIgnoreSelf' 'On' . 'setRootPathEvents' 'On')
555+-- ('setIgnoreSelf' 'True' . 'setRootPathEvents' 'True')
563-- [Array.fromList "path"]
556-- [Array.fromList "path"]
564-- @
557-- @
565--
558--
@@ -719,7 +712,7 @@ foreign import ccall safe
719-- object itself. Note that the object may become unreachable or deleted after
712-- object itself. Note that the object may become unreachable or deleted after
720-- a change of path.
713-- a change of path.
721--
714--
722−-- /Applicable only when 'setRootPathEvents' is 'On'/
715+-- /Applicable only when 'setRootPathEvents' is 'True'/
723--
716--
724-- /Occurs only for the watched path/
717-- /Occurs only for the watched path/
725--
718--
@@ -763,7 +756,7 @@ isUnmounted :: Event -> Bool
763isUnmounted = getFlag kFSEventStreamEventFlagUnmount
756isUnmounted = getFlag kFSEventStreamEventFlagUnmount
764
757
765-------------------------------------------------------------------------------
758-------------------------------------------------------------------------------
766−-- Metadata change Events (applicable only when 'setFileEvents' is 'On')
759+-- Metadata change Events (applicable only when 'setFileEvents' is 'True')
767-------------------------------------------------------------------------------
760-------------------------------------------------------------------------------
768
761
769foreign import ccall safe
762foreign import ccall safe
@@ -776,7 +769,7 @@ foreign import ccall safe
776-- Note that this event may be generated even if the metadata is changed to the
769-- Note that this event may be generated even if the metadata is changed to the
777-- same value again.
770-- same value again.
778--
771--
779−-- /Applicable only when 'setFileEvents' is 'On'/
772+-- /Applicable only when 'setFileEvents' is 'True'/
780--
773--
781-- /Can occur for watched path or a file inside it/
774-- /Can occur for watched path or a file inside it/
782--
775--
@@ -797,7 +790,7 @@ foreign import ccall safe
797-- modification time. It does not occur when the link count of a file changes
790-- modification time. It does not occur when the link count of a file changes
798-- (as of macOS 10.15.1).
791-- (as of macOS 10.15.1).
799--
792--
800−-- /Applicable only when 'setFileEvents' is 'On'/
793+-- /Applicable only when 'setFileEvents' is 'True'/
801--
794--
802-- /Can occur for watched path or a file inside it/
795-- /Can occur for watched path or a file inside it/
803--
796--
@@ -815,7 +808,7 @@ foreign import ccall safe
815-- | Determine whether the event indicates finder information metadata change
808-- | Determine whether the event indicates finder information metadata change
816-- for an object contained within the monitored path.
809-- for an object contained within the monitored path.
817--
810--
818−-- /Applicable only when 'setFileEvents' is 'On'/
811+-- /Applicable only when 'setFileEvents' is 'True'/
819--
812--
820-- /macOS 10.7+/
813-- /macOS 10.7+/
821--
814--
@@ -831,7 +824,7 @@ foreign import ccall safe
831-- | Determine whether the event indicates extended attributes metadata change
824-- | Determine whether the event indicates extended attributes metadata change
832-- for an object contained within the monitored path.
825-- for an object contained within the monitored path.
833--
826--
834−-- /Applicable only when 'setFileEvents' is 'On'/
827+-- /Applicable only when 'setFileEvents' is 'True'/
835--
828--
836-- /Can occur for watched path or a file inside it/
829-- /Can occur for watched path or a file inside it/
837--
830--
@@ -843,7 +836,7 @@ isXAttrsModified :: Event -> Bool
843isXAttrsModified = getFlag kFSEventStreamEventFlagItemXattrMod
836isXAttrsModified = getFlag kFSEventStreamEventFlagItemXattrMod
844
837
845-------------------------------------------------------------------------------
838-------------------------------------------------------------------------------
846−-- CRUD Events (applicable only when 'setFileEvents' is 'On')
839+-- CRUD Events (applicable only when 'setFileEvents' is 'True')
847-------------------------------------------------------------------------------
840-------------------------------------------------------------------------------
848
841
849foreign import ccall safe
842foreign import ccall safe
@@ -865,7 +858,7 @@ foreign import ccall safe
865-- only an 'isAttrsModified' event occurs and there is no 'isCreated'
858-- only an 'isAttrsModified' event occurs and there is no 'isCreated'
866-- event. However, this seems to have been fixed on 10.15.6.
859-- event. However, this seems to have been fixed on 10.15.6.
867--
860--
868−-- /Applicable only when 'setFileEvents' is 'On'/
861+-- /Applicable only when 'setFileEvents' is 'True'/
869--
862--
870-- /Can occur for watched path or a file inside it/
863-- /Can occur for watched path or a file inside it/
871--
864--
@@ -883,7 +876,7 @@ foreign import ccall safe
883-- | Determine whether the event indicates deletion of an object within the
876-- | Determine whether the event indicates deletion of an object within the
884-- monitored path. This is true when a file or a hardlink is deleted.
877-- monitored path. This is true when a file or a hardlink is deleted.
885--
878--
886−-- Applicable only when 'setFileEvents' is 'On'.
879+-- Applicable only when 'setFileEvents' is 'True'.
887--
880--
888-- /Can occur for watched path or a file inside it/
881-- /Can occur for watched path or a file inside it/
889--
882--
@@ -902,7 +895,7 @@ foreign import ccall safe
902-- monitored path. This event is generated when a file is renamed within the
895-- monitored path. This event is generated when a file is renamed within the
903-- watched directory or if it is moved out of or in the watched directory.
896-- watched directory or if it is moved out of or in the watched directory.
904--
897--
905−-- /Applicable only when 'setFileEvents' is 'On'/
898+-- /Applicable only when 'setFileEvents' is 'True'/
906--
899--
907-- /Can occur for watched path or a file inside it/
900-- /Can occur for watched path or a file inside it/
908--
901--
@@ -920,7 +913,7 @@ foreign import ccall safe
920-- | Determine whether the event indicates modification of an object within the
913-- | Determine whether the event indicates modification of an object within the
921-- monitored path. This event is generated only for files and not directories.
914-- monitored path. This event is generated only for files and not directories.
922--
915--
923−-- Applicable only when 'setFileEvents' is 'On'.
916+-- Applicable only when 'setFileEvents' is 'True'.
924--
917--
925-- /macOS 10.7+/
918-- /macOS 10.7+/
926--
919--
@@ -938,7 +931,7 @@ foreign import ccall safe
938-- monitored path. The "Duplicate" command in the "File" menu of the "Finder"
931-- monitored path. The "Duplicate" command in the "File" menu of the "Finder"
939-- application generates a "clone" event.
932-- application generates a "clone" event.
940--
933--
941−-- Applicable only when 'setFileEvents' is 'On'.
934+-- Applicable only when 'setFileEvents' is 'True'.
942--
935--
943-- /macOS 10.13+/
936-- /macOS 10.13+/
944--
937--
@@ -949,7 +942,7 @@ isCloned = getFlag kFSEventStreamEventFlagItemCloned
949#endif
942#endif
950
943
951-------------------------------------------------------------------------------
944-------------------------------------------------------------------------------
952−-- Information about path type (applicable only when 'setFileEvents' is 'On')
945+-- Information about path type (applicable only when 'setFileEvents' is 'True')
953-------------------------------------------------------------------------------
946-------------------------------------------------------------------------------
954
947
955foreign import ccall safe
948foreign import ccall safe
@@ -958,7 +951,7 @@ foreign import ccall safe
958
951
959-- | Determine whether the event is for a directory path.
952-- | Determine whether the event is for a directory path.
960--
953--
961−-- Applicable only when 'setFileEvents' is 'On'.
954+-- Applicable only when 'setFileEvents' is 'True'.
962--
955--
963-- /macOS 10.7+/
956-- /macOS 10.7+/
964--
957--
@@ -973,7 +966,7 @@ foreign import ccall safe
973
966
974-- | Determine whether the event is for a file path.
967-- | Determine whether the event is for a file path.
975--
968--
976−-- Applicable only when 'setFileEvents' is 'On'.
969+-- Applicable only when 'setFileEvents' is 'True'.
977--
970--
978-- /macOS 10.7+/
971-- /macOS 10.7+/
979--
972--
@@ -988,7 +981,7 @@ foreign import ccall safe
988
981
989-- | Determine whether the event is for a symbolic link path.
982-- | Determine whether the event is for a symbolic link path.
990--
983--
991−-- Applicable only when 'setFileEvents' is 'On'.
984+-- Applicable only when 'setFileEvents' is 'True'.
992--
985--
993-- /macOS 10.7+/
986-- /macOS 10.7+/
994--
987--
@@ -1008,7 +1001,7 @@ foreign import ccall safe
1008-- which has or had more than one link in the past is removed. This is not true
1001-- which has or had more than one link in the past is removed. This is not true
1009-- if a file never had more than one link.
1002-- if a file never had more than one link.
1010--
1003--
1011−-- Applicable only when 'setFileEvents' is 'On'.
1004+-- Applicable only when 'setFileEvents' is 'True'.
1012--
1005--
1013-- /macOS 10.10+/
1006-- /macOS 10.10+/
1014--
1007--
@@ -1026,7 +1019,7 @@ foreign import ccall safe
1026-- is true when a file has had more than one link and now the last link is
1019-- is true when a file has had more than one link and now the last link is
1027-- removed. In that case both 'isHardLink' and 'isLastHardLink" would be true.
1020-- removed. In that case both 'isHardLink' and 'isLastHardLink" would be true.
1028--
1021--
1029−-- Applicable only when 'setFileEvents' is 'On'.
1022+-- Applicable only when 'setFileEvents' is 'True'.
1030--
1023--
1031-- /macOS 10.10+/
1024-- /macOS 10.10+/
1032--
1025--
src/Streamly/Internal/FileSystem/Event/Linux.hs+66−77
@@ -64,7 +64,6 @@ module Streamly.Internal.FileSystem.Event.Linux
64
64
65 -- ** Default configuration
65 -- ** Default configuration
66 Config (..)
66 Config (..)
67− , Switch (..)
68 , defaultConfig
67 , defaultConfig
69
68
70 -- ** Watch Behavior
69 -- ** Watch Behavior
@@ -208,22 +207,12 @@ data Config = Config
208-- Boolean settings
207-- Boolean settings
209-------------------------------------------------------------------------------
208-------------------------------------------------------------------------------
210
209
211−-- | Whether a setting is 'On' or 'Off'.
212−--
213−-- /Pre-release/
214−--
215−data Switch = On | Off deriving (Show, Eq)
216−
217−toggle :: Switch -> Switch
218−toggle On = Off
219−toggle Off = On
220−
221−setFlag :: Word32 -> Switch -> Config -> Config
210+setFlag :: Word32 -> Bool -> Config -> Config
222setFlag mask status cfg@Config{..} =
211setFlag mask status cfg@Config{..} =
223 let flags =
212 let flags =
224− case status of
213+ if status
225− On -> createFlags .|. mask
214+ then createFlags .|. mask
226− Off -> createFlags .&. complement mask
215+ else createFlags .&. complement mask
227 in cfg {createFlags = flags}
216 in cfg {createFlags = flags}
228
217
229-------------------------------------------------------------------------------
218-------------------------------------------------------------------------------
@@ -233,12 +222,12 @@ setFlag mask status cfg@Config{..} =
233-- | Watch the whole directory tree recursively instead of watching just one
222-- | Watch the whole directory tree recursively instead of watching just one
234-- level of directory.
223-- level of directory.
235--
224--
236−-- /default: Off/
225+-- /default: False/
237--
226--
238-- /Pre-release/
227-- /Pre-release/
239--
228--
240−setRecursiveMode :: Switch -> Config -> Config
229+setRecursiveMode :: Bool -> Config -> Config
241−setRecursiveMode rec cfg@Config{} = cfg {watchRec = rec == On}
230+setRecursiveMode recursive cfg@Config{} = cfg {watchRec = recursive}
242
231
243foreign import capi
232foreign import capi
244 "sys/inotify.h value IN_DONT_FOLLOW" iN_DONT_FOLLOW :: Word32
233 "sys/inotify.h value IN_DONT_FOLLOW" iN_DONT_FOLLOW :: Word32
@@ -249,12 +238,12 @@ foreign import capi
249-- Note that the path location in the events is through the original symbolic
238-- Note that the path location in the events is through the original symbolic
250-- link path rather than the resolved path.
239-- link path rather than the resolved path.
251--
240--
252−-- /default: On/
241+-- /default: True/
253--
242--
254-- /Pre-release/
243-- /Pre-release/
255--
244--
256−setFollowSymLinks :: Switch -> Config -> Config
245+setFollowSymLinks :: Bool -> Config -> Config
257−setFollowSymLinks s = setFlag iN_DONT_FOLLOW (toggle s)
246+setFollowSymLinks s = setFlag iN_DONT_FOLLOW (not s)
258
247
259foreign import capi
248foreign import capi
260 "sys/inotify.h value IN_EXCL_UNLINK" iN_EXCL_UNLINK :: Word32
249 "sys/inotify.h value IN_EXCL_UNLINK" iN_EXCL_UNLINK :: Word32
@@ -262,11 +251,11 @@ foreign import capi
262-- | If an object moves out of the directory being watched then stop watching
251-- | If an object moves out of the directory being watched then stop watching
263-- it.
252-- it.
264--
253--
265−-- /default: On/
254+-- /default: True/
266--
255--
267-- /Pre-release/
256-- /Pre-release/
268--
257--
269−setUnwatchMoved :: Switch -> Config -> Config
258+setUnwatchMoved :: Bool -> Config -> Config
270setUnwatchMoved = setFlag iN_EXCL_UNLINK
259setUnwatchMoved = setFlag iN_EXCL_UNLINK
271
260
272#if HAVE_DECL_IN_MASK_CREATE
261#if HAVE_DECL_IN_MASK_CREATE
@@ -283,7 +272,7 @@ foreign import capi
283-- /Pre-release/
272-- /Pre-release/
284--
273--
285data WhenExists =
274data WhenExists =
286− AddIfExists -- ^ Do not set an existing setting to 'Off' only set to 'On'
275+ AddIfExists -- ^ Do not set an existing setting to 'False' only set to 'True'
287 | ReplaceIfExists -- ^ Replace the existing settings with new settings
276 | ReplaceIfExists -- ^ Replace the existing settings with new settings
288#if HAVE_DECL_IN_MASK_CREATE
277#if HAVE_DECL_IN_MASK_CREATE
289 | FailIfExists -- ^ Fail the API
278 | FailIfExists -- ^ Fail the API
@@ -299,10 +288,10 @@ data WhenExists =
299setWhenExists :: WhenExists -> Config -> Config
288setWhenExists :: WhenExists -> Config -> Config
300setWhenExists val cfg =
289setWhenExists val cfg =
301 case val of
290 case val of
302− AddIfExists -> setFlag iN_MASK_ADD On cfg
291+ AddIfExists -> setFlag iN_MASK_ADD True cfg
303− ReplaceIfExists -> setFlag iN_MASK_ADD Off cfg
292+ ReplaceIfExists -> setFlag iN_MASK_ADD False cfg
304#if HAVE_DECL_IN_MASK_CREATE
293#if HAVE_DECL_IN_MASK_CREATE
305− FailIfExists -> setFlag iN_MASK_CREATE On cfg
294+ FailIfExists -> setFlag iN_MASK_CREATE True cfg
306#endif
295#endif
307
296
308foreign import capi
297foreign import capi
@@ -310,11 +299,11 @@ foreign import capi
310
299
311-- | Watch the object only for one event and then remove it from the watch.
300-- | Watch the object only for one event and then remove it from the watch.
312--
301--
313−-- /default: Off/
302+-- /default: False/
314--
303--
315-- /Pre-release/
304-- /Pre-release/
316--
305--
317−setOneShot :: Switch -> Config -> Config
306+setOneShot :: Bool -> Config -> Config
318setOneShot = setFlag iN_ONESHOT
307setOneShot = setFlag iN_ONESHOT
319
308
320foreign import capi
309foreign import capi
@@ -323,11 +312,11 @@ foreign import capi
323-- | Watch the object only if it is a directory. This provides a race-free way
312-- | Watch the object only if it is a directory. This provides a race-free way
324-- to ensure that the watched object is a directory.
313-- to ensure that the watched object is a directory.
325--
314--
326−-- /default: Off/
315+-- /default: False/
327--
316--
328-- /Pre-release/
317-- /Pre-release/
329--
318--
330−setOnlyDir :: Switch -> Config -> Config
319+setOnlyDir :: Bool -> Config -> Config
331setOnlyDir = setFlag iN_ONLYDIR
320setOnlyDir = setFlag iN_ONLYDIR
332
321
333-------------------------------------------------------------------------------
322-------------------------------------------------------------------------------
@@ -339,11 +328,11 @@ foreign import capi
339
328
340-- | Report when the watched path itself gets deleted.
329-- | Report when the watched path itself gets deleted.
341--
330--
342−-- /default: On/
331+-- /default: True/
343--
332--
344-- /Pre-release/
333-- /Pre-release/
345--
334--
346−setRootDeleted :: Switch -> Config -> Config
335+setRootDeleted :: Bool -> Config -> Config
347setRootDeleted = setFlag iN_DELETE_SELF
336setRootDeleted = setFlag iN_DELETE_SELF
348
337
349foreign import capi
338foreign import capi
@@ -351,20 +340,20 @@ foreign import capi
351
340
352-- | Report when the watched root path itself gets renamed.
341-- | Report when the watched root path itself gets renamed.
353--
342--
354−-- /default: On/
343+-- /default: True/
355--
344--
356-- /Pre-release/
345-- /Pre-release/
357--
346--
358−setRootMoved :: Switch -> Config -> Config
347+setRootMoved :: Bool -> Config -> Config
359setRootMoved = setFlag iN_MOVE_SELF
348setRootMoved = setFlag iN_MOVE_SELF
360
349
361-- | Report when the watched root path itself gets deleted or renamed.
350-- | Report when the watched root path itself gets deleted or renamed.
362--
351--
363−-- /default: On/
352+-- /default: True/
364--
353--
365-- /Pre-release/
354-- /Pre-release/
366--
355--
367−setRootPathEvents :: Switch -> Config -> Config
356+setRootPathEvents :: Bool -> Config -> Config
368setRootPathEvents = setFlag (iN_DELETE_SELF .|. iN_MOVE_SELF)
357setRootPathEvents = setFlag (iN_DELETE_SELF .|. iN_MOVE_SELF)
369
358
370foreign import capi
359foreign import capi
@@ -373,11 +362,11 @@ foreign import capi
373-- | Report when the metadata e.g. owner, permission modes, modifications times
362-- | Report when the metadata e.g. owner, permission modes, modifications times
374-- of an object changes.
363-- of an object changes.
375--
364--
376−-- /default: On/
365+-- /default: True/
377--
366--
378-- /Pre-release/
367-- /Pre-release/
379--
368--
380−setAttrsModified :: Switch -> Config -> Config
369+setAttrsModified :: Bool -> Config -> Config
381setAttrsModified = setFlag iN_ATTRIB
370setAttrsModified = setFlag iN_ATTRIB
382
371
383foreign import capi
372foreign import capi
@@ -385,11 +374,11 @@ foreign import capi
385
374
386-- | Report when a file is accessed.
375-- | Report when a file is accessed.
387--
376--
388−-- /default: On/
377+-- /default: True/
389--
378--
390-- /Pre-release/
379-- /Pre-release/
391--
380--
392−setAccessed :: Switch -> Config -> Config
381+setAccessed :: Bool -> Config -> Config
393setAccessed = setFlag iN_ACCESS
382setAccessed = setFlag iN_ACCESS
394
383
395foreign import capi
384foreign import capi
@@ -397,11 +386,11 @@ foreign import capi
397
386
398-- | Report when a file is opened.
387-- | Report when a file is opened.
399--
388--
400−-- /default: On/
389+-- /default: True/
401--
390--
402-- /Pre-release/
391-- /Pre-release/
403--
392--
404−setOpened :: Switch -> Config -> Config
393+setOpened :: Bool -> Config -> Config
405setOpened = setFlag iN_OPEN
394setOpened = setFlag iN_OPEN
406
395
407foreign import capi
396foreign import capi
@@ -409,11 +398,11 @@ foreign import capi
409
398
410-- | Report when a file that was opened for writes is closed.
399-- | Report when a file that was opened for writes is closed.
411--
400--
412−-- /default: On/
401+-- /default: True/
413--
402--
414-- /Pre-release/
403-- /Pre-release/
415--
404--
416−setWriteClosed :: Switch -> Config -> Config
405+setWriteClosed :: Bool -> Config -> Config
417setWriteClosed = setFlag iN_CLOSE_WRITE
406setWriteClosed = setFlag iN_CLOSE_WRITE
418
407
419foreign import capi
408foreign import capi
@@ -421,11 +410,11 @@ foreign import capi
421
410
422-- | Report when a file that was opened for not writing is closed.
411-- | Report when a file that was opened for not writing is closed.
423--
412--
424−-- /default: On/
413+-- /default: True/
425--
414--
426-- /Pre-release/
415-- /Pre-release/
427--
416--
428−setNonWriteClosed :: Switch -> Config -> Config
417+setNonWriteClosed :: Bool -> Config -> Config
429setNonWriteClosed = setFlag iN_CLOSE_NOWRITE
418setNonWriteClosed = setFlag iN_CLOSE_NOWRITE
430
419
431foreign import capi
420foreign import capi
@@ -433,11 +422,11 @@ foreign import capi
433
422
434-- | Report when a file is created.
423-- | Report when a file is created.
435--
424--
436−-- /default: On/
425+-- /default: True/
437--
426--
438-- /Pre-release/
427-- /Pre-release/
439--
428--
440−setCreated :: Switch -> Config -> Config
429+setCreated :: Bool -> Config -> Config
441setCreated = setFlag iN_CREATE
430setCreated = setFlag iN_CREATE
442
431
443foreign import capi
432foreign import capi
@@ -445,11 +434,11 @@ foreign import capi
445
434
446-- | Report when a file is deleted.
435-- | Report when a file is deleted.
447--
436--
448−-- /default: On/
437+-- /default: True/
449--
438--
450-- /Pre-release/
439-- /Pre-release/
451--
440--
452−setDeleted :: Switch -> Config -> Config
441+setDeleted :: Bool -> Config -> Config
453setDeleted = setFlag iN_DELETE
442setDeleted = setFlag iN_DELETE
454
443
455foreign import capi
444foreign import capi
@@ -457,11 +446,11 @@ foreign import capi
457
446
458-- | Report the source of a move.
447-- | Report the source of a move.
459--
448--
460−-- /default: On/
449+-- /default: True/
461--
450--
462-- /Pre-release/
451-- /Pre-release/
463--
452--
464−setMovedFrom :: Switch -> Config -> Config
453+setMovedFrom :: Bool -> Config -> Config
465setMovedFrom = setFlag iN_MOVED_FROM
454setMovedFrom = setFlag iN_MOVED_FROM
466
455
467foreign import capi
456foreign import capi
@@ -469,11 +458,11 @@ foreign import capi
469
458
470-- | Report the target of a move.
459-- | Report the target of a move.
471--
460--
472−-- /default: On/
461+-- /default: True/
473--
462--
474-- /Pre-release/
463-- /Pre-release/
475--
464--
476−setMovedTo :: Switch -> Config -> Config
465+setMovedTo :: Bool -> Config -> Config
477setMovedTo = setFlag iN_MOVED_TO
466setMovedTo = setFlag iN_MOVED_TO
478
467
479foreign import capi
468foreign import capi
@@ -481,14 +470,14 @@ foreign import capi
481
470
482-- | Report when a file is modified.
471-- | Report when a file is modified.
483--
472--
484−-- /default: On/
473+-- /default: True/
485--
474--
486-- /Pre-release/
475-- /Pre-release/
487--
476--
488−setModified :: Switch -> Config -> Config
477+setModified :: Bool -> Config -> Config
489setModified = setFlag iN_MODIFY
478setModified = setFlag iN_MODIFY
490
479
491−-- | Set all tunable events 'On' or 'Off'. Equivalent to setting:
480+-- | Set all tunable events 'True' or 'False'. Equivalent to setting:
492--
481--
493-- * setRootDeleted
482-- * setRootDeleted
494-- * setRootMoved
483-- * setRootMoved
@@ -505,7 +494,7 @@ setModified = setFlag iN_MODIFY
505--
494--
506-- /Pre-release/
495-- /Pre-release/
507--
496--
508−setAllEvents :: Switch -> Config -> Config
497+setAllEvents :: Bool -> Config -> Config
509setAllEvents s =
498setAllEvents s =
510 setRootDeleted s
499 setRootDeleted s
511 . setRootMoved s
500 . setRootMoved s
@@ -529,30 +518,30 @@ setAllEvents s =
529--
518--
530-- | The default configuration settings are:
519-- | The default configuration settings are:
531--
520--
532−-- * 'setFollowSymLinks' 'On'
521+-- * 'setFollowSymLinks' 'True'
533−-- * 'setUnwatchMoved' 'On'
522+-- * 'setUnwatchMoved' 'True'
534−-- * 'setOneShot' 'Off'
523+-- * 'setOneShot' 'False'
535−-- * 'setOnlyDir' 'Off'
524+-- * 'setOnlyDir' 'False'
536-- * 'setWhenExists' 'AddIfExists'
525-- * 'setWhenExists' 'AddIfExists'
537--
526--
538-- The tunable events enabled by default are:
527-- The tunable events enabled by default are:
539--
528--
540−-- * setCreated On
529+-- * setCreated True
541−-- * setDeleted On
530+-- * setDeleted True
542−-- * setMovedFrom On
531+-- * setMovedFrom True
543−-- * setMovedTo On
532+-- * setMovedTo True
544−-- * setModified On
533+-- * setModified True
545--
534--
546-- /Pre-release/
535-- /Pre-release/
547--
536--
548defaultConfig :: Config
537defaultConfig :: Config
549defaultConfig =
538defaultConfig =
550 setWhenExists AddIfExists
539 setWhenExists AddIfExists
551− $ setCreated On
540+ $ setCreated True
552− $ setDeleted On
541+ $ setDeleted True
553− $ setMovedFrom On
542+ $ setMovedFrom True
554− $ setMovedTo On
543+ $ setMovedTo True
555− $ setModified On
544+ $ setModified True
556 $ Config
545 $ Config
557 { watchRec = False
546 { watchRec = False
558 , createFlags = 0
547 , createFlags = 0
@@ -911,7 +900,7 @@ watchToStream cfg wt@(Watch handle _) = do
911--
900--
912-- @
901-- @
913-- watchwith
902-- watchwith
914−-- ('setFollowSymLinks' On . 'setUnwatchMoved' Off)
903+-- ('setFollowSymLinks' True . 'setUnwatchMoved' False)
915-- [Array.fromList "dir"]
904-- [Array.fromList "dir"]
916-- @
905-- @
917--
906--
@@ -928,14 +917,14 @@ watchWith f paths = S.bracketIO before after (watchToStream cfg)
928
917
929-- | Same as 'watchWith' using 'defaultConfig' and recursive mode.
918-- | Same as 'watchWith' using 'defaultConfig' and recursive mode.
930--
919--
931−-- >>> watchRecursive = watchWith (setRecursiveMode On)
920+-- >>> watchRecursive = watchWith (setRecursiveMode True)
932--
921--
933-- See 'watchWith' for pitfalls and bugs when using recursive watch on Linux.
922-- See 'watchWith' for pitfalls and bugs when using recursive watch on Linux.
934--
923--
935-- /Pre-release/
924-- /Pre-release/
936--
925--
937watchRecursive :: NonEmpty (Array Word8) -> Stream IO Event
926watchRecursive :: NonEmpty (Array Word8) -> Stream IO Event
938−watchRecursive = watchWith (setRecursiveMode On)
927+watchRecursive = watchWith (setRecursiveMode True)
939
928
940-- | Same as 'watchWith' using defaultConfig and non-recursive mode.
929-- | Same as 'watchWith' using defaultConfig and non-recursive mode.
941--
930--
@@ -1242,7 +1231,7 @@ isModified :: Event -> Bool
1242isModified = getFlag iN_MODIFY
1231isModified = getFlag iN_MODIFY
1243
1232
1244-------------------------------------------------------------------------------
1233-------------------------------------------------------------------------------
1245−-- Information about path type (applicable only when 'setFileEvents' is 'On')
1234+-- Information about path type (applicable only when 'setFileEvents' is 'True')
1246-------------------------------------------------------------------------------
1235-------------------------------------------------------------------------------
1247
1236
1248foreign import capi
1237foreign import capi
src/Streamly/Internal/FileSystem/Event/Windows.hs+32−39
@@ -48,7 +48,6 @@ module Streamly.Internal.FileSystem.Event.Windows
48
48
49 -- ** Default configuration
49 -- ** Default configuration
50 Config
50 Config
51− , Switch (..)
52 , defaultConfig
51 , defaultConfig
53
52
54 -- ** Watch Behavior
53 -- ** Watch Behavior
@@ -142,28 +141,22 @@ data Config = Config
142-- Boolean settings
141-- Boolean settings
143-------------------------------------------------------------------------------
142-------------------------------------------------------------------------------
144
143
145−-- | Whether a setting is 'On' or 'Off'.
146−--
147−-- /Pre-release/
148−--
149−data Switch = On | Off deriving (Show, Eq)
150−
151−setFlag :: DWORD -> Switch -> Config -> Config
144+setFlag :: DWORD -> Bool -> Config -> Config
152setFlag mask status cfg@Config{..} =
145setFlag mask status cfg@Config{..} =
153 let flags =
146 let flags =
154− case status of
147+ if status
155− On -> createFlags .|. mask
148+ then createFlags .|. mask
156− Off -> createFlags .&. complement mask
149+ else createFlags .&. complement mask
157 in cfg {createFlags = flags}
150 in cfg {createFlags = flags}
158
151
159-- | Set watch event on directory recursively.
152-- | Set watch event on directory recursively.
160--
153--
161−-- /default: Off/
154+-- /default: False/
162--
155--
163-- /Pre-release/
156-- /Pre-release/
164--
157--
165−setRecursiveMode :: Switch -> Config -> Config
158+setRecursiveMode :: Bool -> Config -> Config
166−setRecursiveMode rec cfg@Config{} = cfg {watchRec = rec == On}
159+setRecursiveMode recursive cfg@Config{} = cfg {watchRec = recursive}
167
160
168-- | Generate notify events on file create, rename or delete.
161-- | Generate notify events on file create, rename or delete.
169--
162--
@@ -171,11 +164,11 @@ setRecursiveMode rec cfg@Config{} = cfg {watchRec = rec == On}
171-- directory or subtree causes a change notification wait operation to return.
164-- directory or subtree causes a change notification wait operation to return.
172-- Changes include renaming, creating, or deleting a file.
165-- Changes include renaming, creating, or deleting a file.
173--
166--
174−-- /default: On/
167+-- /default: True/
175--
168--
176-- /Pre-release/
169-- /Pre-release/
177--
170--
178−setFileNameEvents :: Switch -> Config -> Config
171+setFileNameEvents :: Bool -> Config -> Config
179setFileNameEvents = setFlag fILE_NOTIFY_CHANGE_FILE_NAME
172setFileNameEvents = setFlag fILE_NOTIFY_CHANGE_FILE_NAME
180
173
181-- | Generate notify events on directory create, rename or delete.
174-- | Generate notify events on directory create, rename or delete.
@@ -184,21 +177,21 @@ setFileNameEvents = setFlag fILE_NOTIFY_CHANGE_FILE_NAME
184-- directory or subtree causes a change notification wait operation to return.
177-- directory or subtree causes a change notification wait operation to return.
185-- Changes include creating or deleting a directory.
178-- Changes include creating or deleting a directory.
186--
179--
187−-- /default: On/
180+-- /default: True/
188--
181--
189-- /Pre-release/
182-- /Pre-release/
190--
183--
191−setDirNameEvents :: Switch -> Config -> Config
184+setDirNameEvents :: Bool -> Config -> Config
192setDirNameEvents = setFlag fILE_NOTIFY_CHANGE_DIR_NAME
185setDirNameEvents = setFlag fILE_NOTIFY_CHANGE_DIR_NAME
193
186
194-- | Generate an 'isModified' event on any attribute change in the watched
187-- | Generate an 'isModified' event on any attribute change in the watched
195-- directory or subtree.
188-- directory or subtree.
196--
189--
197−-- /default: Off/
190+-- /default: False/
198--
191--
199-- /Pre-release/
192-- /Pre-release/
200--
193--
201−setAttrsModified :: Switch -> Config -> Config
194+setAttrsModified :: Bool -> Config -> Config
202setAttrsModified = setFlag fILE_NOTIFY_CHANGE_ATTRIBUTES
195setAttrsModified = setFlag fILE_NOTIFY_CHANGE_ATTRIBUTES
203
196
204-- | Generate an 'isModified' event when the file size is changed.
197-- | Generate an 'isModified' event when the file size is changed.
@@ -209,11 +202,11 @@ setAttrsModified = setFlag fILE_NOTIFY_CHANGE_ATTRIBUTES
209-- written to the disk. For operating systems that use extensive caching,
202-- written to the disk. For operating systems that use extensive caching,
210-- detection occurs only when the cache is sufficiently flushed.
203-- detection occurs only when the cache is sufficiently flushed.
211--
204--
212−-- /default: Off/
205+-- /default: False/
213--
206--
214-- /Pre-release/
207-- /Pre-release/
215--
208--
216−setSizeModified :: Switch -> Config -> Config
209+setSizeModified :: Bool -> Config -> Config
217setSizeModified = setFlag fILE_NOTIFY_CHANGE_SIZE
210setSizeModified = setFlag fILE_NOTIFY_CHANGE_SIZE
218
211
219-- | Generate an 'isModified' event when the last write timestamp of the file
212-- | Generate an 'isModified' event when the last write timestamp of the file
@@ -226,24 +219,24 @@ setSizeModified = setFlag fILE_NOTIFY_CHANGE_SIZE
226-- that use extensive caching, detection occurs only when the cache is
219-- that use extensive caching, detection occurs only when the cache is
227-- sufficiently flushed.
220-- sufficiently flushed.
228--
221--
229−-- /default: Off/
222+-- /default: False/
230--
223--
231-- /Pre-release/
224-- /Pre-release/
232--
225--
233−setLastWriteTimeModified :: Switch -> Config -> Config
226+setLastWriteTimeModified :: Bool -> Config -> Config
234setLastWriteTimeModified = setFlag fILE_NOTIFY_CHANGE_LAST_WRITE
227setLastWriteTimeModified = setFlag fILE_NOTIFY_CHANGE_LAST_WRITE
235
228
236-- | Generate an 'isModified' event when any security-descriptor change occurs
229-- | Generate an 'isModified' event when any security-descriptor change occurs
237-- in the watched directory or subtree.
230-- in the watched directory or subtree.
238--
231--
239−-- /default: Off/
232+-- /default: False/
240--
233--
241-- /Pre-release/
234-- /Pre-release/
242--
235--
243−setSecurityModified :: Switch -> Config -> Config
236+setSecurityModified :: Bool -> Config -> Config
244setSecurityModified = setFlag fILE_NOTIFY_CHANGE_SECURITY
237setSecurityModified = setFlag fILE_NOTIFY_CHANGE_SECURITY
245
238
246−-- | Set all tunable events 'On' or 'Off'. Equivalent to setting:
239+-- | Set all tunable events 'True' or 'False'. Equivalent to setting:
247--
240--
248-- * setFileNameEvents
241-- * setFileNameEvents
249-- * setDirNameEvents
242-- * setDirNameEvents
@@ -254,7 +247,7 @@ setSecurityModified = setFlag fILE_NOTIFY_CHANGE_SECURITY
254--
247--
255-- /Pre-release/
248-- /Pre-release/
256--
249--
257−setAllEvents :: Switch -> Config -> Config
250+setAllEvents :: Bool -> Config -> Config
258setAllEvents s =
251setAllEvents s =
259 setFileNameEvents s
252 setFileNameEvents s
260 . setDirNameEvents s
253 . setDirNameEvents s
@@ -265,19 +258,19 @@ setAllEvents s =
265
258
266-- | The tunable events that are enabled by default are:
259-- | The tunable events that are enabled by default are:
267--
260--
268−-- * setFileNameEvents On
261+-- * setFileNameEvents True
269−-- * setDirNameEvents On
262+-- * setDirNameEvents True
270−-- * setSizeModified On
263+-- * setSizeModified True
271−-- * setLastWriteTimeModified On
264+-- * setLastWriteTimeModified True
272--
265--
273-- /Pre-release/
266-- /Pre-release/
274--
267--
275defaultConfig :: Config
268defaultConfig :: Config
276defaultConfig =
269defaultConfig =
277− setFileNameEvents On
270+ setFileNameEvents True
278− $ setDirNameEvents On
271+ $ setDirNameEvents True
279− $ setSizeModified On
272+ $ setSizeModified True
280− $ setLastWriteTimeModified On
273+ $ setLastWriteTimeModified True
281 $ Config {watchRec = False, createFlags = 0}
274 $ Config {watchRec = False, createFlags = 0}
282
275
283getConfigFlag :: Config -> DWORD
276getConfigFlag :: Config -> DWORD
@@ -470,7 +463,7 @@ closePathHandleStream =
470--
463--
471-- @
464-- @
472-- watchWith
465-- watchWith
473−-- ('setAttrsModified' On . 'setLastWriteTimeModified' Off)
466+-- ('setAttrsModified' True . 'setLastWriteTimeModified' False)
474-- [Array.fromList "dir"]
467-- [Array.fromList "dir"]
475-- @
468-- @
476--
469--
@@ -487,12 +480,12 @@ watchWith f paths =
487
480
488-- | Same as 'watchWith' using 'defaultConfig' and recursive mode.
481-- | Same as 'watchWith' using 'defaultConfig' and recursive mode.
489--
482--
490−-- >>> watchRecursive = watchWith (setRecursiveMode On)
483+-- >>> watchRecursive = watchWith (setRecursiveMode True)
491--
484--
492-- /Pre-release/
485-- /Pre-release/
493--
486--
494watchRecursive :: NonEmpty (Array Word8) -> Stream IO Event
487watchRecursive :: NonEmpty (Array Word8) -> Stream IO Event
495−watchRecursive = watchWith (setRecursiveMode On)
488+watchRecursive = watchWith (setRecursiveMode True)
496
489
497-- | Same as 'watchWith' using defaultConfig and non-recursive mode.
490-- | Same as 'watchWith' using defaultConfig and non-recursive mode.
498--
491--
test/Streamly/Test/FileSystem/Event/Darwin.hs+1−1
@@ -78,7 +78,7 @@ main = do
78 , fileModify "" (const [])
78 , fileModify "" (const [])
79 ]
79 ]
80
80
81− let w = Event.watchWith (Event.setAllEvents Event.On)
81+ let w = Event.watchWith (Event.setAllEvents True)
82 run = runTests moduleName "recursive" w
82 run = runTests moduleName "recursive" w
83
83
84 run DirType regularRootTests
84 run DirType regularRootTests
test/Streamly/Test/FileSystem/Event/Linux.hs+2−2
@@ -96,7 +96,7 @@ main = do
96 -- No events occur when a symlink root is moved
96 -- No events occur when a symlink root is moved
97 : regSymTests
97 : regSymTests
98
98
99− let w = Event.watchWith (Event.setAllEvents Event.On)
99+ let w = Event.watchWith (Event.setAllEvents True)
100 run = runTests moduleName "non-recursive" w
100 run = runTests moduleName "non-recursive" w
101
101
102 run DirType regTests
102 run DirType regTests
@@ -142,7 +142,7 @@ main = do
142 recSymTests = symTests ++ regSymRecTests
142 recSymTests = symTests ++ regSymRecTests
143
143
144 let recw = Event.watchWith
144 let recw = Event.watchWith
145− (Event.setAllEvents Event.On . Event.setRecursiveMode Event.On)
145+ (Event.setAllEvents True . Event.setRecursiveMode True)
146 runRec = runTests moduleName "recursive" recw
146 runRec = runTests moduleName "recursive" recw
147
147
148 runRec DirType recRegTests
148 runRec DirType recRegTests
test/Streamly/Test/FileSystem/Event/Windows.hs+2−2
@@ -30,7 +30,7 @@ main = do
30 --
30 --
31 -- ++ dirDelete "" (\dir -> [(dir, Event.isDeleted)])
31 -- ++ dirDelete "" (\dir -> [(dir, Event.isDeleted)])
32
32
33− let w = Event.watchWith (Event.setAllEvents Event.On)
33+ let w = Event.watchWith (Event.setAllEvents True)
34 run = runTests moduleName "non-recursive" w
34 run = runTests moduleName "non-recursive" w
35
35
36 run DirType regularRootTests
36 run DirType regularRootTests
@@ -44,7 +44,7 @@ main = do
44 ] ++ commonRecTests
44 ] ++ commonRecTests
45
45
46 let recw = Event.watchWith
46 let recw = Event.watchWith
47− (Event.setAllEvents Event.On . Event.setRecursiveMode Event.On)
47+ (Event.setAllEvents True . Event.setRecursiveMode True)
48 runRec = runTests moduleName "recursive" recw
48 runRec = runTests moduleName "recursive" recw
49
49
50 runRec DirType (regularRootTests ++ recTests)
50 runRec DirType (regularRootTests ++ recTests)