Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- mountOnLVar :: forall model m b. (MonadIO m, MonadUnliftIO m, MonadLogger m, Show b, Ord b) => FilePath -> [(b, FilePattern)] -> [FilePattern] -> LVar model -> model -> (b -> FilePath -> FileAction () -> m (model -> model)) -> m (Maybe Cmd)
- unionMountOnLVar :: forall source tag model m. (MonadIO m, MonadUnliftIO m, MonadLogger m, Ord source, Ord tag) => Set (source, FilePath) -> [(tag, FilePattern)] -> [FilePattern] -> LVar model -> model -> (Change source tag -> m (model -> model)) -> m (Maybe Cmd)
- interceptExceptions :: (MonadIO m, MonadUnliftIO m, MonadLogger m) => a -> m a -> m a
- data Evt source tag
- = Evt_Change (Change source tag)
- | Evt_Unhandled
- data Cmd = Cmd_Remount
- unionMount :: forall source tag m. (MonadIO m, MonadUnliftIO m, MonadLogger m, Ord source, Ord tag) => Set (source, FilePath) -> [(tag, FilePattern)] -> [FilePattern] -> (Change source tag -> m (Maybe Cmd)) -> m (Maybe Cmd)
- filesMatching :: (MonadIO m, MonadLogger m) => FilePath -> [FilePattern] -> [FilePattern] -> m [FilePath]
- filesMatchingWithTag :: (MonadIO m, MonadLogger m, Ord b) => FilePath -> [(b, FilePattern)] -> [FilePattern] -> m [(b, [FilePath])]
- getTag :: [(b, FilePattern)] -> FilePath -> Maybe b
- data RefreshAction
- data FileAction a
- = Refresh RefreshAction a
- | Delete
- newtype FolderAction a = FolderAction a
- refreshAction :: FileAction a -> Maybe RefreshAction
- onChange :: forall x m. (MonadIO m, MonadLogger m, MonadUnliftIO m) => TBQueue (x, FilePath, Either (FolderAction ()) (FileAction ())) -> [(x, FilePath)] -> m ()
- withManagerM :: (MonadIO m, MonadUnliftIO m) => WatchConfig -> (WatchManager -> m a) -> m a
- watchTreeM :: forall m. (MonadIO m, MonadUnliftIO m) => WatchManager -> FilePath -> ActionPredicate -> (Event -> m ()) -> m StopListening
- log :: MonadLogger m => LogLevel -> Text -> m ()
- newtype OverlayFs source = OverlayFs {
- unOverlayFs :: Map FilePath (Set source)
- emptyOverlayFs :: Ord source => OverlayFs source
- overlayFsModify :: FilePath -> (Set src -> Set src) -> OverlayFs src -> OverlayFs src
- overlayFsAdd :: Ord src => FilePath -> src -> OverlayFs src -> OverlayFs src
- overlayFsRemove :: Ord src => FilePath -> src -> OverlayFs src -> OverlayFs src
- overlayFsLookup :: FilePath -> OverlayFs source -> Maybe (NonEmpty (source, FilePath))
- type Change source tag = Map tag (Map FilePath (FileAction (NonEmpty (source, FilePath))))
- changeInsert :: (Ord source, Ord tag, MonadState (OverlayFs source) m) => source -> tag -> FilePath -> FileAction () -> Change source tag -> m (Change source tag)
Documentation
:: forall model m b. (MonadIO m, MonadUnliftIO m, MonadLogger m, Show b, Ord b) | |
=> FilePath | The directory to mount. |
-> [(b, FilePattern)] | Only include these files (exclude everything else) |
-> [FilePattern] | Ignore these patterns |
-> LVar model | The NOTE: It must not be set already. Otherwise, the value will be overriden with the initial value argument (next). |
-> model | Initial value of model, onto which to apply updates. |
-> (b -> FilePath -> FileAction () -> m (model -> model)) | How to update the model given a file action.
If the action throws an exception, it will be logged and ignored. |
-> m (Maybe Cmd) |
Simplified variation of unionMountOnLVar
with exactly one source.
unionMountOnLVar :: forall source tag model m. (MonadIO m, MonadUnliftIO m, MonadLogger m, Ord source, Ord tag) => Set (source, FilePath) -> [(tag, FilePattern)] -> [FilePattern] -> LVar model -> model -> (Change source tag -> m (model -> model)) -> m (Maybe Cmd) Source #
Like unionMount
but updates a LVar
as well handles exceptions (and
unhandled events) by logging them.
interceptExceptions :: (MonadIO m, MonadUnliftIO m, MonadLogger m) => a -> m a -> m a Source #
Evt_Change (Change source tag) | |
Evt_Unhandled |
unionMount :: forall source tag m. (MonadIO m, MonadUnliftIO m, MonadLogger m, Ord source, Ord tag) => Set (source, FilePath) -> [(tag, FilePattern)] -> [FilePattern] -> (Change source tag -> m (Maybe Cmd)) -> m (Maybe Cmd) Source #
filesMatching :: (MonadIO m, MonadLogger m) => FilePath -> [FilePattern] -> [FilePattern] -> m [FilePath] Source #
filesMatchingWithTag :: (MonadIO m, MonadLogger m, Ord b) => FilePath -> [(b, FilePattern)] -> [FilePattern] -> m [(b, [FilePath])] Source #
Like filesMatching
but with a tag associated with a pattern so as to be
able to tell which pattern a resulting filepath is associated with.
data RefreshAction Source #
Existing | No recent change. Just notifying of file's existance |
New | New file got created |
Update | The already existing file was updated. |
Instances
Eq RefreshAction Source # | |
Defined in System.UnionMount (==) :: RefreshAction -> RefreshAction -> Bool # (/=) :: RefreshAction -> RefreshAction -> Bool # | |
Show RefreshAction Source # | |
Defined in System.UnionMount showsPrec :: Int -> RefreshAction -> ShowS # show :: RefreshAction -> String # showList :: [RefreshAction] -> ShowS # |
data FileAction a Source #
Refresh RefreshAction a | A new file, or updated file, is available |
Delete | The file just got deleted. |
Instances
Functor FileAction Source # | |
Defined in System.UnionMount fmap :: (a -> b) -> FileAction a -> FileAction b # (<$) :: a -> FileAction b -> FileAction a # | |
Eq a => Eq (FileAction a) Source # | |
Defined in System.UnionMount (==) :: FileAction a -> FileAction a -> Bool # (/=) :: FileAction a -> FileAction a -> Bool # | |
Show a => Show (FileAction a) Source # | |
Defined in System.UnionMount showsPrec :: Int -> FileAction a -> ShowS # show :: FileAction a -> String # showList :: [FileAction a] -> ShowS # |
newtype FolderAction a Source #
This is not an action on file, rather an action on a directory (which may contain files, which would be outside the scope of this fsnotify event, and so the user must manually deal with them.)
Instances
Functor FolderAction Source # | |
Defined in System.UnionMount fmap :: (a -> b) -> FolderAction a -> FolderAction b # (<$) :: a -> FolderAction b -> FolderAction a # | |
Eq a => Eq (FolderAction a) Source # | |
Defined in System.UnionMount (==) :: FolderAction a -> FolderAction a -> Bool # (/=) :: FolderAction a -> FolderAction a -> Bool # | |
Show a => Show (FolderAction a) Source # | |
Defined in System.UnionMount showsPrec :: Int -> FolderAction a -> ShowS # show :: FolderAction a -> String # showList :: [FolderAction a] -> ShowS # |
refreshAction :: FileAction a -> Maybe RefreshAction Source #
:: forall x m. (MonadIO m, MonadLogger m, MonadUnliftIO m) | |
=> TBQueue (x, FilePath, Either (FolderAction ()) (FileAction ())) | |
-> [(x, FilePath)] | |
-> m () | The filepath is relative to the folder being monitored, unless if its ancestor is a symlink. |
withManagerM :: (MonadIO m, MonadUnliftIO m) => WatchConfig -> (WatchManager -> m a) -> m a Source #
watchTreeM :: forall m. (MonadIO m, MonadUnliftIO m) => WatchManager -> FilePath -> ActionPredicate -> (Event -> m ()) -> m StopListening Source #
emptyOverlayFs :: Ord source => OverlayFs source Source #
changeInsert :: (Ord source, Ord tag, MonadState (OverlayFs source) m) => source -> tag -> FilePath -> FileAction () -> Change source tag -> m (Change source tag) Source #
Report a change to overlay fs