packages feed

hash-addressed 0.1.0.0 → 0.2.0.0

raw patch · 3 files changed

+32/−5 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- HashAddressed.Directory: writeExcept :: forall abort commit m. (MonadIO m, MonadError abort m) => Directory -> Producer ByteString (ExceptT abort IO) commit -> m (commit, WriteResult)
+ HashAddressed.Directory: writeExcept :: forall abort commit m. (MonadIO m, MonadError abort m) => Directory -> Producer ByteString IO (Either abort commit) -> m (commit, WriteResult)

Files

changelog.md view
@@ -1,3 +1,29 @@+0.2.0.0 (2023-02-08)+----------------------------------------------------------------++Change type of stream parameter in `writeExcept` from++```haskell+Producer ByteString (ExceptT abort IO) commit+```++to++``haskell+Producer ByteString IO (Either abort commit)+```++The new version is equivalent (via the `ExceptT` constructor) to++``haskell+ExceptT abort (Producer ByteString IO) commit+```++and so what this change is doing is reversing the order of the+monad transformers. The overall result is the same, but the new+version seems slightly easier to work with.++ 0.1.0.0 (2023-01-31) ---------------------------------------------------------------- 
hash-addressed.cabal view
@@ -1,7 +1,7 @@ cabal-version: 3.0  name: hash-addressed-version: 0.1.0.0+version: 0.2.0.0 synopsis: Hash-addressed file storage category: Hash, Filesystem 
library/HashAddressed/Directory.hs view
@@ -74,7 +74,7 @@ and an exception thrown via 'IO' will be re-thrown via 'IO'. -} writeExcept :: forall abort commit m. (MonadIO m, MonadError abort m) =>     Directory -- ^ Where to write-    -> Pipes.Producer Strict.ByteString (ExceptT abort IO) commit+    -> Pipes.Producer Strict.ByteString IO (Either abort commit)         -- ^ What to write     -> m (commit, WriteResult) writeExcept dir stream = run action@@ -148,13 +148,14 @@     pure WriteResult{ hashAddressedFile, writeType }  runStream :: forall abort commit. HashFunction -> Handle-    -> Pipes.Producer Strict.ByteString (ExceptT abort IO) commit+    -> Pipes.Producer Strict.ByteString IO (Either abort commit)     -> IO (Either abort (HashName, commit)) runStream hash handle stream =     case writeAndHash hash handle of         Fold.EffectfulFold{ Fold.initial, Fold.step, Fold.extract } ->             Except.runExceptT $-                Pipes.foldM' step initial extract stream+                Pipes.foldM' step initial extract $+                    Pipes.hoist lift stream >>= Except.liftEither  writeAndHash :: HashFunction -> Handle     -> Fold.EffectfulFold (ExceptT abort IO) Strict.ByteString HashName@@ -172,7 +173,7 @@     Directory -- ^ Where to write     -> Pipes.Producer Strict.ByteString IO commit -- ^ What to write     -> m (commit, WriteResult)-writeStream dir source = voidExcept $ writeExcept dir $ Pipes.hoist lift source+writeStream dir source = voidExcept $ writeExcept dir $ fmap Either.Right source  voidLeft :: Either Void a -> a voidLeft = \case{ Either.Left x -> absurd x; Either.Right x -> x }