Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
This module (and sub-hierarchy) provides logic that can be used by any backend (i.e. cbor, fdo, json) that has the following structure:
trashpaths (paths) trashinfo (info files)
The only difference is in the (de)serialization.
Synopsis
- delete :: forall m env pd k. (HasCallStack, Is k A_Getter, LabelOptic' "fileName" k pd (PathI TrashEntryFileName), LabelOptic' "originalPath" k pd (PathI TrashEntryOriginalPath), HasTrashHome env, MonadCatch m, MonadFileWriter m, MonadIORef m, MonadLoggerNS m, MonadPathWriter m, MonadReader env m, MonadTerminal m, MonadTime m, Serial pd, Show pd) => BackendArgs m pd -> UniqueSeqNE (PathI TrashEntryOriginalPath) -> m ()
- deletePostHook :: forall m env pd k. (HasCallStack, Is k A_Getter, LabelOptic' "fileName" k pd (PathI TrashEntryFileName), LabelOptic' "originalPath" k pd (PathI TrashEntryOriginalPath), HasTrashHome env, MonadCatch m, MonadFileWriter m, MonadIORef m, MonadLoggerNS m, MonadPathWriter m, MonadReader env m, MonadTerminal m, MonadTime m, Serial pd, Show pd) => BackendArgs m pd -> ((pd, PathTypeW, PathI TrashEntryPath) -> m ()) -> UniqueSeqNE (PathI TrashEntryOriginalPath) -> m ()
- permDelete :: forall m env pd k. (DecodeExtra pd ~ PathI TrashEntryFileName, HasCallStack, HasTrashHome env, Is k A_Getter, LabelOptic' "fileName" k pd (PathI TrashEntryFileName), MonadAsync m, MonadCatch m, MonadFileReader m, MonadHandleWriter m, MonadIORef m, MonadPathReader m, MonadPathWriter m, MonadLoggerNS m, MonadReader env m, MonadTerminal m, Serial pd, Show pd) => BackendArgs m pd -> Bool -> UniqueSeqNE (PathI TrashEntryFileName) -> m ()
- permDeletePostHook :: forall m env pd k. (DecodeExtra pd ~ PathI TrashEntryFileName, HasCallStack, HasTrashHome env, Is k A_Getter, LabelOptic' "fileName" k pd (PathI TrashEntryFileName), MonadAsync m, MonadCatch m, MonadFileReader m, MonadHandleWriter m, MonadIORef m, MonadPathReader m, MonadPathWriter m, MonadLoggerNS m, MonadReader env m, MonadTerminal m, Serial pd, Show pd) => BackendArgs m pd -> (PathData -> m ()) -> Bool -> UniqueSeqNE (PathI TrashEntryFileName) -> m ()
- emptyTrash :: forall m env pd k. (DecodeExtra pd ~ PathI TrashEntryFileName, HasCallStack, HasTrashHome env, Is k A_Getter, LabelOptic' "fileName" k pd (PathI TrashEntryFileName), MonadCatch m, MonadFileReader m, MonadHandleWriter m, MonadLoggerNS m, MonadPathReader m, MonadPathWriter m, MonadReader env m, MonadTerminal m, Serial pd) => BackendArgs m pd -> Bool -> m ()
- restore :: forall m env pd k. (DecodeExtra pd ~ PathI TrashEntryFileName, HasCallStack, HasTrashHome env, Is k A_Getter, LabelOptic' "fileName" k pd (PathI TrashEntryFileName), MonadCatch m, MonadFileReader m, MonadIORef m, MonadLoggerNS m, MonadPathReader m, MonadPathWriter m, MonadReader env m, MonadTerminal m, Serial pd, Show pd) => BackendArgs m pd -> UniqueSeqNE (PathI TrashEntryFileName) -> m ()
- restorePostHook :: forall m env pd k. (DecodeExtra pd ~ PathI TrashEntryFileName, HasCallStack, HasTrashHome env, Is k A_Getter, LabelOptic' "fileName" k pd (PathI TrashEntryFileName), MonadCatch m, MonadFileReader m, MonadIORef m, MonadLoggerNS m, MonadPathReader m, MonadPathWriter m, MonadReader env m, MonadTerminal m, Serial pd, Show pd) => BackendArgs m pd -> (PathData -> m ()) -> UniqueSeqNE (PathI TrashEntryFileName) -> m ()
- getIndex :: forall m env pd k. (DecodeExtra pd ~ PathI TrashEntryFileName, HasCallStack, HasTrashHome env, Is k A_Getter, LabelOptic' "fileName" k pd (PathI TrashEntryFileName), MonadCatch m, MonadFileReader m, MonadPathReader m, MonadLoggerNS m, MonadReader env m, Serial pd) => BackendArgs m pd -> m Index
- getMetadata :: forall m env pd k. (DecodeExtra pd ~ PathI TrashEntryFileName, HasCallStack, HasTrashHome env, Is k A_Getter, LabelOptic' "fileName" k pd (PathI TrashEntryFileName), MonadCatch m, MonadFileReader m, MonadLoggerNS m, MonadPathReader m, MonadReader env m, Serial pd) => BackendArgs m pd -> m Metadata
- merge :: (HasCallStack, MonadFileReader m, MonadIORef m, MonadLoggerNS m, MonadMask m, MonadPathReader m, MonadPathWriter m) => PathI TrashHome -> PathI TrashHome -> m ()
Delete
delete :: forall m env pd k. (HasCallStack, Is k A_Getter, LabelOptic' "fileName" k pd (PathI TrashEntryFileName), LabelOptic' "originalPath" k pd (PathI TrashEntryOriginalPath), HasTrashHome env, MonadCatch m, MonadFileWriter m, MonadIORef m, MonadLoggerNS m, MonadPathWriter m, MonadReader env m, MonadTerminal m, MonadTime m, Serial pd, Show pd) => BackendArgs m pd -> UniqueSeqNE (PathI TrashEntryOriginalPath) -> m () Source #
delete trash p
moves path p
to the given trash location trash
and
writes an entry in the trash index. If the trash location is not given,
defaults to XDG data e.g. ~/.localsharecharon/
.
deletePostHook :: forall m env pd k. (HasCallStack, Is k A_Getter, LabelOptic' "fileName" k pd (PathI TrashEntryFileName), LabelOptic' "originalPath" k pd (PathI TrashEntryOriginalPath), HasTrashHome env, MonadCatch m, MonadFileWriter m, MonadIORef m, MonadLoggerNS m, MonadPathWriter m, MonadReader env m, MonadTerminal m, MonadTime m, Serial pd, Show pd) => BackendArgs m pd -> ((pd, PathTypeW, PathI TrashEntryPath) -> m ()) -> UniqueSeqNE (PathI TrashEntryOriginalPath) -> m () Source #
delete
that takes a callback that runs on the created path data, assuming
the delete succeeded.
permDelete :: forall m env pd k. (DecodeExtra pd ~ PathI TrashEntryFileName, HasCallStack, HasTrashHome env, Is k A_Getter, LabelOptic' "fileName" k pd (PathI TrashEntryFileName), MonadAsync m, MonadCatch m, MonadFileReader m, MonadHandleWriter m, MonadIORef m, MonadPathReader m, MonadPathWriter m, MonadLoggerNS m, MonadReader env m, MonadTerminal m, Serial pd, Show pd) => BackendArgs m pd -> Bool -> UniqueSeqNE (PathI TrashEntryFileName) -> m () Source #
Permanently deletes the paths from the trash.
permDeletePostHook :: forall m env pd k. (DecodeExtra pd ~ PathI TrashEntryFileName, HasCallStack, HasTrashHome env, Is k A_Getter, LabelOptic' "fileName" k pd (PathI TrashEntryFileName), MonadAsync m, MonadCatch m, MonadFileReader m, MonadHandleWriter m, MonadIORef m, MonadPathReader m, MonadPathWriter m, MonadLoggerNS m, MonadReader env m, MonadTerminal m, Serial pd, Show pd) => BackendArgs m pd -> (PathData -> m ()) -> Bool -> UniqueSeqNE (PathI TrashEntryFileName) -> m () Source #
Permanently deletes the paths from the trash.
emptyTrash :: forall m env pd k. (DecodeExtra pd ~ PathI TrashEntryFileName, HasCallStack, HasTrashHome env, Is k A_Getter, LabelOptic' "fileName" k pd (PathI TrashEntryFileName), MonadCatch m, MonadFileReader m, MonadHandleWriter m, MonadLoggerNS m, MonadPathReader m, MonadPathWriter m, MonadReader env m, MonadTerminal m, Serial pd) => BackendArgs m pd -> Bool -> m () Source #
Empties the trash.
Restore
restore :: forall m env pd k. (DecodeExtra pd ~ PathI TrashEntryFileName, HasCallStack, HasTrashHome env, Is k A_Getter, LabelOptic' "fileName" k pd (PathI TrashEntryFileName), MonadCatch m, MonadFileReader m, MonadIORef m, MonadLoggerNS m, MonadPathReader m, MonadPathWriter m, MonadReader env m, MonadTerminal m, Serial pd, Show pd) => BackendArgs m pd -> UniqueSeqNE (PathI TrashEntryFileName) -> m () Source #
restore trash p
restores the trashed path <trash>/p
to its original
location.
restorePostHook :: forall m env pd k. (DecodeExtra pd ~ PathI TrashEntryFileName, HasCallStack, HasTrashHome env, Is k A_Getter, LabelOptic' "fileName" k pd (PathI TrashEntryFileName), MonadCatch m, MonadFileReader m, MonadIORef m, MonadLoggerNS m, MonadPathReader m, MonadPathWriter m, MonadReader env m, MonadTerminal m, Serial pd, Show pd) => BackendArgs m pd -> (PathData -> m ()) -> UniqueSeqNE (PathI TrashEntryFileName) -> m () Source #
restore trash p
restores the trashed path <trash>/p
to its original
location.
Information
getIndex :: forall m env pd k. (DecodeExtra pd ~ PathI TrashEntryFileName, HasCallStack, HasTrashHome env, Is k A_Getter, LabelOptic' "fileName" k pd (PathI TrashEntryFileName), MonadCatch m, MonadFileReader m, MonadPathReader m, MonadLoggerNS m, MonadReader env m, Serial pd) => BackendArgs m pd -> m Index Source #
Reads the index at either the specified or default location. If the file does not exist, returns empty.
getMetadata :: forall m env pd k. (DecodeExtra pd ~ PathI TrashEntryFileName, HasCallStack, HasTrashHome env, Is k A_Getter, LabelOptic' "fileName" k pd (PathI TrashEntryFileName), MonadCatch m, MonadFileReader m, MonadLoggerNS m, MonadPathReader m, MonadReader env m, Serial pd) => BackendArgs m pd -> m Metadata Source #
Retrieves metadata for the trash directory.
Transformations
merge :: (HasCallStack, MonadFileReader m, MonadIORef m, MonadLoggerNS m, MonadMask m, MonadPathReader m, MonadPathWriter m) => PathI TrashHome -> PathI TrashHome -> m () Source #