packages feed

process-streaming 0.6.6.0 → 0.6.7.0

raw patch · 4 files changed

+99/−49 lines, 4 filesdep ~exceptionsdep ~semigroupsdep ~text

Dependency ranges changed: exceptions, semigroups, text, transformers-compat, void

Files

CHANGELOG view
@@ -1,3 +1,7 @@+0.6.7.0+-------+- Bumped some dependencies.+ 0.6.6.0 ------- 
process-streaming.cabal view
@@ -1,5 +1,5 @@ name:          process-streaming-version:       0.6.6.0+version:       0.6.7.0 license:       BSD3 license-file:  LICENSE data-files:    @@ -27,7 +27,7 @@     build-depends:                  base >= 4.4 && < 5,         transformers >= 0.2 && < 0.5,-        transformers-compat == 0.3.*,+        transformers-compat >= 0.3,         free >= 4.2 && < 5,         bifunctors >= 4.1 && < 5,         process >= 1.2.0 && < 1.3,@@ -38,10 +38,9 @@         pipes-concurrency >= 2.0.2 && < 3,         pipes-safe >= 2.2.0 && < 3,         pipes-parse >=3.0.1 && <3.1,-        exceptions >= 0.6.0 && < 0.7,-        void >= 0.6 && < 0.7,+        void >= 0.6 && < 1.0,         containers >= 0.4,-        semigroups >= 0.15 && < 0.16,+        semigroups >= 0.15 && < 0.20,         conceit >= 0.2.1.0 && < 0.3.0.0,         contravariant >= 1.2,         foldl >= 1.0.7@@ -59,20 +58,20 @@     build-depends:         base >= 4.4 && < 5       , transformers >= 0.2 && < 0.5-      , transformers-compat == 0.3.*+      , transformers-compat >= 0.3       , free >= 4.2 && < 5       , bifunctors >= 4.1 && < 5       , process >= 1.2.0 && < 1.3       , pipes >= 4.1.2 && < 4.2       , pipes-bytestring >= 2.1.0 && < 2.2       , pipes-text >= 0.0.0.10 && < 0.0.2-      , text >= 0.11.2 && < 1.2+      , text >= 0.11.2 && < 1.2.1       , pipes-concurrency >= 2.0.2 && < 3       , pipes-safe >= 2.2.0 && < 3       , pipes-parse >=3.0.1 && <3.1-      , exceptions >= 0.6.0 && < 0.7-      , void >= 0.6 && < 0.7-      , semigroups >= 0.15 && < 0.16+      , exceptions >= 0.6.0 && < 1.0+      , void >= 0.6 && < 1.0+      , semigroups >= 0.15 && < 0.20       , containers >= 0.4       , process-streaming       , tasty >= 0.9@@ -93,7 +92,7 @@   build-depends:         base >= 4.4 && < 5       , transformers >= 0.2 && < 0.5-      , transformers-compat == 0.3.*+      , transformers-compat == 0.3       , free >= 4.2 && < 5       , bifunctors >= 4.1 && < 5       , process >= 1.2.0 && < 1.3@@ -104,7 +103,7 @@       , pipes-concurrency >= 2.0.2 && < 3       , pipes-safe >= 2.2.0 && < 3       , pipes-parse >=3.0.1 && <3.1-      , exceptions >= 0.6.0 && < 0.7+      , exceptions >= 0.6.0 && < 1       , void >= 0.6 && < 0.7       , semigroups >= 0.15 && < 0.16       , containers >= 0.4
src/System/Process/Streaming.hs view
@@ -113,7 +113,6 @@ import Control.Monad.Trans.State import Control.Monad.Trans.Writer.Strict import qualified Control.Foldl as L-import qualified Control.Monad.Catch as C import Control.Exception import Control.Concurrent import Control.Concurrent.Conceit@@ -150,24 +149,59 @@  -} executeFallibly :: Piping e a -> CreateProcess -> IO (Either e (ExitCode,a)) executeFallibly pp record = case pp of-      PPNone a -> executeInternal record nohandles $  -          \() -> (return . Right $ a,return ())-      PPOutput action -> executeInternal (record{std_out = CreatePipe}) handleso $-          \h->(action (fromHandle h),hClose h) -      PPError action ->  executeInternal (record{std_err = CreatePipe}) handlese $-          \h->(action (fromHandle h),hClose h)-      PPOutputError action -> executeInternal (record{std_out = CreatePipe, std_err = CreatePipe}) handlesoe $-          \(hout,herr)->(action (fromHandle hout,fromHandle herr),hClose hout `finally` hClose herr)-      PPInput action -> executeInternal (record{std_in = CreatePipe}) handlesi $-          \h -> (action (toHandle h, hClose h), return ())-      PPInputOutput action -> executeInternal (record{std_in = CreatePipe,std_out = CreatePipe}) handlesio $-          \(hin,hout) -> (action (toHandle hin,hClose hin,fromHandle hout), hClose hout)-      PPInputError action -> executeInternal (record{std_in = CreatePipe,std_err = CreatePipe}) handlesie $-          \(hin,herr) -> (action (toHandle hin,hClose hin,fromHandle herr), hClose herr)-      PPInputOutputError action -> executeInternal (record{std_in = CreatePipe, std_out = CreatePipe, std_err = CreatePipe}) handlesioe $-          \(hin,hout,herr) -> (action (toHandle hin,hClose hin,fromHandle hout,fromHandle herr), hClose hout `finally` hClose herr)+      PPNone a -> executeInternal +          record +          nohandles   +          (\() -> (return . Right $ a,return ()))+      PPOutput action -> executeInternal +          (record{std_out = CreatePipe}) +          handleso +          (\h->(action (fromHandle h),hClose h)) +      PPError action ->  executeInternal +          (record{std_err = CreatePipe}) +          handlese +          (\h->(action (fromHandle h),hClose h))+      PPOutputError action -> executeInternal +          (record{std_out = CreatePipe, std_err = CreatePipe}) +          handlesoe +          (\(hout,herr)->(action (fromHandle hout+                                 ,fromHandle herr)+                         ,hClose hout `finally` hClose herr))+      PPInput action -> executeInternal +          (record{std_in = CreatePipe}) +          handlesi +          (\h -> (action (toHandle h, hClose h), return ()))+      PPInputOutput action -> executeInternal +          (record{std_in = CreatePipe,std_out = CreatePipe}) +          handlesio +          (\(hin,hout) -> (action (toHandle hin,hClose hin,fromHandle hout)+                          ,hClose hout))+      PPInputError action -> executeInternal +          (record{std_in = CreatePipe,std_err = CreatePipe}) +          handlesie +          (\(hin,herr) -> (action (toHandle hin,hClose hin,fromHandle herr)+                          ,hClose herr))+      PPInputOutputError action -> executeInternal +          (record{std_in = CreatePipe+                 ,std_out = CreatePipe+                 ,std_err = CreatePipe}) +          handlesioe +          (\(hin,hout,herr) -> (action (toHandle hin+                                       ,hClose hin+                                       ,fromHandle hout+                                       ,fromHandle herr)+                               ,hClose hout `finally` hClose herr)) -executeInternal :: CreateProcess -> (forall m. Applicative m => (t -> m t) -> (Maybe Handle, Maybe Handle, Maybe Handle) -> m (Maybe Handle, Maybe Handle, Maybe Handle)) -> (t ->(IO (Either e a),IO ())) -> IO (Either e (ExitCode,a))+executeInternal :: CreateProcess +                -> (forall m. Applicative m => (t -> m t) +                                            -> (Maybe Handle+                                               ,Maybe Handle+                                               ,Maybe Handle) +                                            -> m (Maybe Handle+                                                 ,Maybe Handle+                                                 ,Maybe Handle)) +                -> (t ->(IO (Either e a),IO ())) +                -> IO (Either e (ExitCode,a)) executeInternal record somePrism allocator = mask $ \restore -> do     (min,mout,merr,phandle) <- createProcess record     case getFirst . getConst . somePrism (Const . First . Just) $ (min,mout,merr) of@@ -230,28 +264,32 @@          ->           IO (Either e a))     | PPOutputError -        ((Producer ByteString IO (),-          Producer ByteString IO ()) +        ((Producer ByteString IO ()+         ,Producer ByteString IO ())           ->           IO (Either e a))     | PPInput -        ((Consumer ByteString IO (), IO ()) +        ((Consumer ByteString IO ()+         ,IO ())           ->           IO (Either e a))     | PPInputOutput -        ((Consumer ByteString IO (), IO (),-          Producer ByteString IO ()) +        ((Consumer ByteString IO ()+         ,IO ()+         ,Producer ByteString IO ())           ->           IO (Either e a))     | PPInputError -        ((Consumer ByteString IO (), IO (), -          Producer ByteString IO ()) +        ((Consumer ByteString IO ()+         ,IO () +         ,Producer ByteString IO ())           ->           IO (Either e a))     | PPInputOutputError -        ((Consumer ByteString IO (),IO (),-          Producer ByteString IO (),-          Producer ByteString IO ()) +        ((Consumer ByteString IO ()+         ,IO ()+         ,Producer ByteString IO ()+         ,Producer ByteString IO ())           ->           IO (Either e a))     deriving (Functor)@@ -609,7 +647,8 @@ fromFold aFold = siphon $ fmap (fmap pure) $ aFold   {-| -   Builds a 'Siphon' out of a computation that folds a 'Producer' and drains it completely.+   Builds a 'Siphon' out of a computation that folds a 'Producer' and+   drains it completely. -} fromFold' :: (forall r. Producer b IO r -> IO (a,r)) -> Siphon b e a  fromFold' aFold = siphon' $ fmap (fmap pure) aFold@@ -635,14 +674,20 @@ {-|     Builds a 'Siphon' out of a monadic fold from the @foldl@ package. -}-fromFoldlM :: MonadIO m => (forall r. m (a,r) -> IO (Either e (c,r))) -> L.FoldM m b a -> Siphon b e c +fromFoldlM :: MonadIO m +           => (forall r. m (a,r) -> IO (Either e (c,r))) +           -> L.FoldM m b a +           -> Siphon b e c  fromFoldlM whittle aFoldM = siphon' $ \producer ->      whittle $ L.impurely P.foldM' aFoldM (hoist liftIO producer)  fromConsumer :: Consumer b IO r -> Siphon b e () fromConsumer consumer = siphon $ \producer -> fmap pure $ runEffect $ producer >-> mute consumer  -fromConsumerM :: MonadIO m => (m () -> IO (Either e a)) -> Consumer b m r -> Siphon b e a+fromConsumerM :: MonadIO m +              => (m () -> IO (Either e a)) +              -> Consumer b m r +              -> Siphon b e a fromConsumerM whittle consumer = siphon $ \producer -> whittle $ runEffect $ (hoist liftIO producer) >-> mute consumer   fromSafeConsumer :: Consumer b (SafeT IO) r -> Siphon b e ()@@ -661,7 +706,9 @@ {-|    Turn a 'Parser' from @pipes-parse@ into a 'Sihpon'.  -}-fromParserM :: MonadIO m => (forall r. m (a,r) -> IO (Either e (c,r))) -> Parser b m a -> Siphon b e c +fromParserM :: MonadIO m +            => (forall r. m (a,r) -> IO (Either e (c,r))) +            -> Parser b m a -> Siphon b e c  fromParserM f parser = siphon' $ \producer -> f $ drainage $ (Pipes.Parse.runStateT parser) (hoist liftIO producer)   where     drainage m = do @@ -738,7 +785,7 @@   {-|-    Specifies a prefix that will be calculated and appeded for each line of+    Specifies a prefix that will be calculated and appended for each line of     text. -} prefixLines :: IO T.Text -> Lines e -> Lines e @@ -752,8 +799,8 @@     abort the computation if leftovers remain.  -} toLines :: DecodingFunction ByteString Text -           -> Siphon ByteString e ()-           -> Lines e +        -> Siphon ByteString e ()+        -> Lines e  toLines decoder lopo = Lines     (\tweaker teardown producer -> do         let freeLines = transFreeT tweaker @@ -968,7 +1015,8 @@              processDefinition' :: CreateProcess             , stderrLines' :: Lines e            , exitCodePolicy' :: ExitCode -> Either e ()-           , inbound' :: forall r. Producer ByteString IO r -> Producer ByteString (ExceptT e IO) r +           , inbound' :: forall r. Producer ByteString IO r +                      -> Producer ByteString (ExceptT e IO) r             }   instance Functor (Stage) where
src/System/Process/Streaming/Tutorial.hs view
@@ -78,7 +78,6 @@ >>> import qualified Data.Attoparsec.Text as A >>> import Control.Applicative >>> import Control.Monad->>> import Control.Monad.Except >>> import Control.Lens (view) >>> import Pipes >>> import qualified Pipes.ByteString as B