Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- mount :: forall model m b. (MonadIO m, MonadUnliftIO m, MonadLogger m, Show b, Ord b) => FilePath -> [(b, FilePattern)] -> [FilePattern] -> model -> (b -> FilePath -> FileAction () -> m (model -> model)) -> m (model, (model -> m ()) -> m ())
- unionMount :: forall source tag model m. (MonadIO m, MonadUnliftIO m, MonadLogger m, Ord source, Ord tag) => Set (source, FilePath) -> [(tag, FilePattern)] -> [FilePattern] -> model -> (Change source tag -> m (model -> model)) -> m (model, (model -> m ()) -> m ())
- unionMount' :: forall source tag m m1. (MonadIO m, MonadUnliftIO m, MonadLogger m, MonadLogger m1, MonadIO m1, Ord source, Ord tag) => Set (source, FilePath) -> [(tag, FilePattern)] -> [FilePattern] -> m1 (Change source tag, (Change source tag -> m ()) -> m Cmd)
- data FileAction a
- = Refresh RefreshAction a
- | Delete
- data RefreshAction
- type Change source tag = Map tag (Map FilePath (FileAction (NonEmpty (source, FilePath))))
Mount endpoints
:: 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 |
-> 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 (model, (model -> m ()) -> m ()) |
Simplified version of unionMount
with exactly one layer.
unionMount :: forall source tag model m. (MonadIO m, MonadUnliftIO m, MonadLogger m, Ord source, Ord tag) => Set (source, FilePath) -> [(tag, FilePattern)] -> [FilePattern] -> model -> (Change source tag -> m (model -> model)) -> m (model, (model -> m ()) -> m ()) Source #
Union mount a set of sources (directories) into a model.
unionMount' :: forall source tag m m1. (MonadIO m, MonadUnliftIO m, MonadLogger m, MonadLogger m1, MonadIO m1, Ord source, Ord tag) => Set (source, FilePath) -> [(tag, FilePattern)] -> [FilePattern] -> m1 (Change source tag, (Change source tag -> m ()) -> m Cmd) Source #
Like unionMount
but without exception interrupting or re-mounting.
Types
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 # | |
Show a => Show (FileAction a) Source # | |
Defined in System.UnionMount showsPrec :: Int -> FileAction a -> ShowS # show :: FileAction a -> String # showList :: [FileAction a] -> ShowS # | |
Eq a => Eq (FileAction a) Source # | |
Defined in System.UnionMount (==) :: FileAction a -> FileAction a -> Bool # (/=) :: FileAction a -> FileAction a -> Bool # |
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
Show RefreshAction Source # | |
Defined in System.UnionMount showsPrec :: Int -> RefreshAction -> ShowS # show :: RefreshAction -> String # showList :: [RefreshAction] -> ShowS # | |
Eq RefreshAction Source # | |
Defined in System.UnionMount (==) :: RefreshAction -> RefreshAction -> Bool # (/=) :: RefreshAction -> RefreshAction -> Bool # |