@@ -156,8 +156,7 @@ import Data.Functor.Identity (runIdentity)
156156import Data.IntMap.Lazy (IntMap)
157157import Data.IORef (IORef, newIORef, readIORef, writeIORef, modifyIORef)
158158import Data.List.NonEmpty (NonEmpty)
159−
160−#if __GLASGOW_HASKELL__ < 808
159+#if !(MIN_VERSION_base(4,11,0))
161160import Data.Semigroup (Semigroup(..))
162161#endif
163162import Data.Word (Word8, Word32)
@@ -230,19 +229,9 @@ setFlag mask status cfg@Config{..} =
230229 in cfg {createFlags = flags}
231230
232231-------------------------------------------------------------------------------
233−-- Utilities
232+-- Settings
234233-------------------------------------------------------------------------------
235234
236−-- XXX we really do not know the path encoding, all we know is that it is "/"
237−-- separated bytes. So these may fail or convert the path in an unexpected
238−-- manner. We should ultimately remove all usage of these.
239−
240−toUtf8 :: MonadIO m => String -> m (Array Word8)
241−toUtf8 = A.fromStream . U.encodeUtf8 . S.fromList
242−
243−utf8ToString :: Array Word8 -> String
244−utf8ToString = runIdentity . S.toList . U.decodeUtf8' . A.toStream
245−
246235-- | Watch the whole directory tree recursively instead of watching just one
247236-- level of directory.
248237--
@@ -253,10 +242,6 @@ utf8ToString = runIdentity . S.toList . U.decodeUtf8' . A.toStream
253242setRecursiveMode :: Bool -> Config -> Config
254243setRecursiveMode rec cfg@Config{} = cfg {watchRec = rec}
255244
256−-------------------------------------------------------------------------------
257−-- Settings
258−-------------------------------------------------------------------------------
259−
260245foreign import capi
261246 "sys/inotify.h value IN_DONT_FOLLOW" iN_DONT_FOLLOW :: Word32
262247
@@ -537,7 +522,10 @@ defaultConfig :: Config
537522defaultConfig =
538523 setWhenExists AddIfExists
539524 $ setAllEvents On
540− $ Config {watchRec = True, createFlags = 0}
525+ $ Config
526+ { watchRec = True
527+ , createFlags = 0
528+ }
541529
542530-------------------------------------------------------------------------------
543531-- Open an event stream
@@ -597,6 +585,15 @@ foreign import ccall unsafe
597585 "sys/inotify.h inotify_add_watch" c_inotify_add_watch
598586 :: CInt -> CString -> CUInt -> IO CInt
599587
588+-- XXX we really do not know the path encoding, all we know is that it is "/"
589+-- separated bytes. So these may fail or convert the path in an unexpected
590+-- manner. We should ultimately remove all usage of these.
591+
592+toUtf8 :: MonadIO m => String -> m (Array Word8)
593+toUtf8 = A.fromStream . U.encodeUtf8 . S.fromList
594+
595+utf8ToString :: Array Word8 -> String
596+utf8ToString = runIdentity . S.toList . U.decodeUtf8' . A.toStream
600597
601598#if !MIN_VERSION_base(4,10,0)
602599-- | Turn an existing Handle into a file descriptor. This function throws an