Copyright | (c) 2024 Illia Shkroba |
---|---|
License | BSD3 |
Maintainer | Illia Shkroba <is@pjwstk.edu.pl> |
Stability | unstable |
Portability | non-portable (Non-Unix systems are not supported) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
PFile.TrashCan
Description
Types and functions for trashing filesystem's objects.
Synopsis
- create :: (MonadError CreateError m, MonadIO m) => m TrashCan
- showCreateError :: CreateError -> Text
- data CreateError
- trash :: (MonadError TrashError m, MonadIO m) => Absolute -> TrashCan -> m ()
- showTrashError :: TrashError -> Text
- data TrashError
- restoreAll :: (MonadWriter [RestoreEntryError] m, MonadIO m) => TrashCan -> m ()
- restore :: (MonadError RestoreError m, MonadIO m) => TrashCan -> Absolute -> m ()
- showRestoreEntryError :: RestoreEntryError -> Text
- data RestoreEntryError = RestoreEntryError !Absolute !RestoreError
- showRestoreError :: RestoreError -> Text
- newtype RestoreError = UnmountError UnmountError
- remove :: (MonadError RemoveError m, MonadIO m) => TrashCan -> m ()
- showRemoveError :: RemoveError -> Text
- newtype RemoveError = TemporaryDirectoryRemoveError RemoveError
- dumpTrashed :: (MonadError DumpTrashedError m, MonadIO m) => TrashCan -> m Absolute
- showDumpTrashedError :: DumpTrashedError -> Text
- newtype DumpTrashedError = DumpTrashedError WriteFileError
- trashed :: MonadIO m => TrashCan -> m [Absolute]
- data TrashCan = TrashCan !Absolute !Absolute !(IORef [Absolute])
Documentation
create :: (MonadError CreateError m, MonadIO m) => m TrashCan Source #
Create a new trash can.
Since: 0.1.0.0
showCreateError :: CreateError -> Text Source #
data CreateError Source #
Error thrown by create
.
Since: 0.1.0.0
Constructors
TemporaryDirectoryResolveError !IOException |
|
TemporaryDirectoryCreateError !Absolute !IOException |
|
trash :: (MonadError TrashError m, MonadIO m) => Absolute -> TrashCan -> m () Source #
showTrashError :: TrashError -> Text Source #
data TrashError Source #
Error thrown by trash
.
Since: 0.1.0.0
Constructors
AlreadyTrashedError !Absolute !TrashCan |
|
MountError !MountError | Error was encountered during |
restoreAll :: (MonadWriter [RestoreEntryError] m, MonadIO m) => TrashCan -> m () Source #
restore
all trash
ed filesystem's objects back to their original
locations. When an error is encountered during restore
, restoreAll
terminates and provides successfully restore
ed entries via
a MonadWriter
.
Since: 0.1.0.0
restore :: (MonadError RestoreError m, MonadIO m) => TrashCan -> Absolute -> m () Source #
data RestoreEntryError Source #
Error provided via MonadWriter
by restoreAll
.
Since: 0.1.0.0
Constructors
RestoreEntryError !Absolute !RestoreError | Error was encountered during |
showRestoreError :: RestoreError -> Text Source #
newtype RestoreError Source #
Error thrown by restore
.
Since: 0.1.0.0
Constructors
UnmountError UnmountError | Error was encountered during |
remove :: (MonadError RemoveError m, MonadIO m) => TrashCan -> m () Source #
Remove a TrashCan
forcibly.
Since: 0.1.0.0
showRemoveError :: RemoveError -> Text Source #
newtype RemoveError Source #
Error thrown by remove
.
Since: 0.1.0.0
Constructors
TemporaryDirectoryRemoveError RemoveError | Error was encountered during temporary directory removal. |
dumpTrashed :: (MonadError DumpTrashedError m, MonadIO m) => TrashCan -> m Absolute Source #
newtype DumpTrashedError Source #
Error thrown by dumpTrashed
.
Since: 0.1.0.0
Constructors
DumpTrashedError WriteFileError | Error was encountered during writing to a "trashed.txt" file inside of
the |