Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data Directory = Directory {}
- writeLazy :: forall m. MonadIO m => Directory -> ByteString -> m WriteResult
- writeStream :: forall commit m. MonadIO m => Directory -> Producer ByteString IO commit -> m (commit, WriteResult)
- writeExcept :: forall abort commit m. (MonadIO m, MonadError abort m) => Directory -> Producer ByteString IO (Either abort commit) -> m (commit, WriteResult)
- data WriteResult = WriteResult {}
- data WriteType
Type
Specification of a hash-addressed directory
Note that the utilities in HashAddressed.Directory do not create the directory; ensure that it already exists before attempting to write.
See HashAddressed.HashFunction for examples of hash functions.
Directory | |
|
Write operations
:: forall m. MonadIO m | |
=> Directory | Where to write |
-> ByteString | What to write |
-> m WriteResult |
Write a lazy ByteString to a hash-addressed directory
This is a simplified variant of writeStream
.
:: forall commit m. MonadIO m | |
=> Directory | Where to write |
-> Producer ByteString IO commit | What to write |
-> m (commit, WriteResult) |
Write a stream of strict ByteStrings to a hash-addressed directory
If the producer throws an exception, nothing will be written and the exception will be re-thrown.
This is a simplified variant of writeExcept
.
:: forall abort commit m. (MonadIO m, MonadError abort m) | |
=> Directory | Where to write |
-> Producer ByteString IO (Either abort commit) | What to write |
-> m (commit, WriteResult) |
Write a stream of strict ByteStrings to a hash-addressed directory, possibly aborting mid-stream with an error value instead
If the producer throws abort
or an IO
exception, nothing will be written.
An abort
thrown via ExceptT
will be re-thrown via MonadError
,
and an exception thrown via IO
will be re-thrown via IO
.
data WriteResult Source #
WriteResult | |
|
AlreadyPresent | No action was taken because the content is already present in the directory |
NewContent | A new file was written into the directory |