streaming-with 0.2.2.1 → 0.3.0.0
raw patch · 5 files changed
+37/−29 lines, 5 filesdep ~streaming-bytestringPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: streaming-bytestring
API changes (from Hackage documentation)
- Streaming.With: appendBinaryFile :: (MonadMask m, MonadIO m) => FilePath -> ByteString m r -> m r
+ Streaming.With: appendBinaryFile :: (MonadMask m, MonadIO m) => FilePath -> ByteStream m r -> m r
- Streaming.With: class MonadCatch m => MonadMask (m :: * -> *)
+ Streaming.With: class MonadCatch m => MonadMask (m :: Type -> Type)
- Streaming.With: withBinaryFileContents :: (MonadMask m, MonadIO m, MonadIO n) => FilePath -> (ByteString n () -> m r) -> m r
+ Streaming.With: withBinaryFileContents :: (MonadMask m, MonadIO m, MonadIO n) => FilePath -> (ByteStream n () -> m r) -> m r
- Streaming.With: writeBinaryFile :: (MonadMask m, MonadIO m) => FilePath -> ByteString m r -> m r
+ Streaming.With: writeBinaryFile :: (MonadMask m, MonadIO m) => FilePath -> ByteStream m r -> m r
- Streaming.With.Lifted: appendBinaryFile :: (Withable w) => FilePath -> ByteString (WithMonad w) r -> w r
+ Streaming.With.Lifted: appendBinaryFile :: Withable w => FilePath -> ByteStream (WithMonad w) r -> w r
- Streaming.With.Lifted: class MonadCatch m => MonadMask (m :: * -> *)
+ Streaming.With.Lifted: class MonadCatch m => MonadMask (m :: Type -> Type)
- Streaming.With.Lifted: liftActionIO :: (Withable w) => IO a -> w a
+ Streaming.With.Lifted: liftActionIO :: Withable w => IO a -> w a
- Streaming.With.Lifted: withBinaryFile :: (Withable w) => FilePath -> IOMode -> w Handle
+ Streaming.With.Lifted: withBinaryFile :: Withable w => FilePath -> IOMode -> w Handle
- Streaming.With.Lifted: withBinaryFileContents :: (Withable w, MonadIO n) => FilePath -> w (ByteString n ())
+ Streaming.With.Lifted: withBinaryFileContents :: (Withable w, MonadIO n) => FilePath -> w (ByteStream n ())
- Streaming.With.Lifted: withFile :: (Withable w) => FilePath -> IOMode -> w Handle
+ Streaming.With.Lifted: withFile :: Withable w => FilePath -> IOMode -> w Handle
- Streaming.With.Lifted: withSystemTempDirectory :: (Withable w) => String -> w FilePath
+ Streaming.With.Lifted: withSystemTempDirectory :: Withable w => String -> w FilePath
- Streaming.With.Lifted: withSystemTempFile :: (Withable w) => String -> w (FilePath, Handle)
+ Streaming.With.Lifted: withSystemTempFile :: Withable w => String -> w (FilePath, Handle)
- Streaming.With.Lifted: withTempDirectory :: (Withable w) => FilePath -> String -> w FilePath
+ Streaming.With.Lifted: withTempDirectory :: Withable w => FilePath -> String -> w FilePath
- Streaming.With.Lifted: withTempFile :: (Withable w) => FilePath -> String -> w (FilePath, Handle)
+ Streaming.With.Lifted: withTempFile :: Withable w => FilePath -> String -> w (FilePath, Handle)
- Streaming.With.Lifted: within :: (Withable w) => w a -> (a -> WithMonad w b) -> w b
+ Streaming.With.Lifted: within :: Withable w => w a -> (a -> WithMonad w b) -> w b
- Streaming.With.Lifted: writeBinaryFile :: (Withable w) => FilePath -> ByteString (WithMonad w) r -> w r
+ Streaming.With.Lifted: writeBinaryFile :: Withable w => FilePath -> ByteStream (WithMonad w) r -> w r
Files
- ChangeLog.md +4/−0
- README.md +1/−1
- src/Streaming/With.hs +8/−8
- src/Streaming/With/Lifted.hs +18/−15
- streaming-with.cabal +6/−5
ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for streaming-with +## 0.3.0.0 -- 2021-08-29++* Support newer version of `streaming-bytestring` and GHC.+ ## 0.2.2.1 -- 2018-05-23 * Bump temporary dependency
README.md view
@@ -1,7 +1,7 @@ streaming-with ============== -[](https://hackage.haskell.org/package/streaming-with) [](https://travis-ci.org/haskell-streaming/streaming-with)+[](https://hackage.haskell.org/package/streaming-with) [](https://github.com/haskell-streaming/streaming-with/actions/workflows/haskell-ci.yml) > with/bracket-style idioms for use with [streaming]
src/Streaming/With.hs view
@@ -29,12 +29,12 @@ , bracket ) where -import Data.ByteString.Streaming (ByteString)-import qualified Data.ByteString.Streaming as B+import Streaming.ByteString (ByteStream)+import qualified Streaming.ByteString as B import Control.Monad.Catch (MonadMask, bracket) import Control.Monad.IO.Class (MonadIO, liftIO)-import System.IO (Handle, IOMode(..), hClose,+import System.IO (Handle, IOMode (..), hClose, openBinaryFile, openFile) import System.IO.Temp (withSystemTempDirectory, withTempDirectory)@@ -45,7 +45,7 @@ -- | A lifted variant of 'System.IO.withFile'. -- -- You almost definitely don't want to use this; instead, use--- 'withBinaryFile' in conjunction with "Data.ByteString.Streaming".+-- 'withBinaryFile' in conjunction with "Streaming.ByteString". withFile :: (MonadMask m, MonadIO m) => FilePath -> IOMode -> (Handle -> m r) -> m r withFile fp md = bracket (liftIO (openFile fp md)) (liftIO . hClose) @@ -54,20 +54,20 @@ withBinaryFile fp md = bracket (liftIO (openBinaryFile fp md)) (liftIO . hClose) -- | Write to the specified file.-writeBinaryFile :: (MonadMask m, MonadIO m) => FilePath -> ByteString m r -> m r+writeBinaryFile :: (MonadMask m, MonadIO m) => FilePath -> ByteStream m r -> m r writeBinaryFile fp = withBinaryFile fp WriteMode . flip B.hPut -- | Append to the specified file.-appendBinaryFile :: (MonadMask m, MonadIO m) => FilePath -> ByteString m r -> m r+appendBinaryFile :: (MonadMask m, MonadIO m) => FilePath -> ByteStream m r -> m r appendBinaryFile fp = withBinaryFile fp AppendMode . flip B.hPut -- | Apply a function to the contents of the file. -- -- Note that a different monadic stack is allowed for the--- 'ByteString' input, as long as it later gets resolved to the+-- 'ByteStream' input, as long as it later gets resolved to the -- required output type (e.g. remove transformer). withBinaryFileContents :: (MonadMask m, MonadIO m, MonadIO n) => FilePath- -> (ByteString n () -> m r) -> m r+ -> (ByteStream n () -> m r) -> m r withBinaryFileContents fp f = withBinaryFile fp ReadMode (f . B.hGetContents) --------------------------------------------------------------------------------
src/Streaming/With/Lifted.hs view
@@ -1,4 +1,7 @@-{-# LANGUAGE FlexibleContexts, FlexibleInstances, RankNTypes, TypeFamilies #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE TypeFamilies #-} {- | Module : Streaming.With.Lifted@@ -59,16 +62,16 @@ , bracket ) where -import Data.ByteString.Streaming (ByteString)+import Streaming.ByteString (ByteStream) import qualified Streaming.With as W -import Control.Exception (Exception)-import Control.Monad.Catch (MonadMask, bracket, throwM)-import Control.Monad.IO.Class (MonadIO, liftIO)-import Control.Monad.Managed (Managed, managed, runManaged)-import Control.Monad.Trans.Class (lift)-import Control.Monad.Trans.Cont (ContT(..), runContT)-import System.IO (Handle, IOMode)+import Control.Exception (Exception)+import Control.Monad.Catch (MonadMask, bracket, throwM)+import Control.Monad.IO.Class (MonadIO, liftIO)+import Control.Monad.Managed (Managed, managed, runManaged)+import Control.Monad.Trans.Class (lift)+import Control.Monad.Trans.Cont (ContT (..), runContT)+import System.IO (Handle, IOMode) -------------------------------------------------------------------------------- @@ -100,7 +103,7 @@ instance (MonadMask m, MonadIO m) => Withable (ContT r m) where type WithMonad (ContT r m) = m - liftWith = ContT+ liftWith a = ContT a liftAction = lift @@ -163,7 +166,7 @@ -- | A lifted variant of 'System.IO.withFile'. -- -- You almost definitely don't want to use this; instead, use--- 'withBinaryFile' in conjunction with "Data.ByteString.Streaming".+-- 'withBinaryFile' in conjunction with "Streaming.ByteString". withFile :: (Withable w) => FilePath -> IOMode -> w Handle withFile fp md = liftWith (W.withFile fp md) @@ -172,19 +175,19 @@ withBinaryFile fp md = liftWith (W.withBinaryFile fp md) -- | Write to the specified file.-writeBinaryFile :: (Withable w) => FilePath -> ByteString (WithMonad w) r -> w r+writeBinaryFile :: (Withable w) => FilePath -> ByteStream (WithMonad w) r -> w r writeBinaryFile fp inp = liftAction (W.writeBinaryFile fp inp) -- | Append to the specified file.-appendBinaryFile :: (Withable w) => FilePath -> ByteString (WithMonad w) r -> w r+appendBinaryFile :: (Withable w) => FilePath -> ByteStream (WithMonad w) r -> w r appendBinaryFile fp inp = liftAction (W.appendBinaryFile fp inp) -- | Apply a function to the contents of the file. -- -- Note that a different monadic stack is allowed for the--- 'ByteString' input, as long as it later gets resolved to the+-- 'ByteStream' input, as long as it later gets resolved to the -- required output type (e.g. remove transformer).-withBinaryFileContents :: (Withable w, MonadIO n) => FilePath -> w (ByteString n ())+withBinaryFileContents :: (Withable w, MonadIO n) => FilePath -> w (ByteStream n ()) withBinaryFileContents fp = liftWith (W.withBinaryFileContents fp) --------------------------------------------------------------------------------
streaming-with.cabal view
@@ -1,5 +1,5 @@ name: streaming-with-version: 0.2.2.1+version: 0.3.0.0 synopsis: with/bracket-style idioms for use with streaming description: This package provides the foundations for a continuation-based@@ -13,8 +13,9 @@ build-type: Simple extra-source-files: ChangeLog.md, README.md cabal-version: >=1.10-tested-with: GHC == 7.10.2, GHC == 8.0.2, GHC == 8.2.2,- GHC == 8.4.1, GHC == 8.5.*+tested-with: GHC == 8.0.2 || == 8.2.2 || == 8.4.4+ || == 8.6.5 || == 8.8.4 || == 8.10.4+ || == 9.0.1 source-repository head type: git@@ -23,10 +24,10 @@ library exposed-modules: Streaming.With , Streaming.With.Lifted- build-depends: base == 4.*+ build-depends: base >= 4.8 && < 5 , exceptions >= 0.6 && < 0.11 , managed == 1.0.*- , streaming-bytestring >= 0.1.0.3 && < 0.2+ , streaming-bytestring == 0.2.* , temporary >= 1.2.1 && < 1.4 , transformers hs-source-dirs: src