streaming-commons 0.1.4 → 0.1.4.1
raw patch · 2 files changed
+18/−3 lines, 2 files
Files
- Data/Streaming/Process.hs +17/−2
- streaming-commons.cabal +1/−1
Data/Streaming/Process.hs view
@@ -1,5 +1,6 @@+{-# LANGUAGE CPP #-} -- | A full tutorial for this module is available on FP School of Haskell:--- <https://www.fpcomplete.com/user/snoyberg/library-documentation/data-streaming-process>.+-- <https://www.fpcomplete.com/user/snoyberg/library-documentation/data-conduit-process>. -- -- Note that, while the tutorial covers @Data.Streaming.Process@, this module is -- the basis of the streaming version, and almost all concepts there apply here.@@ -29,13 +30,27 @@ import Control.Concurrent (forkIO) import Control.Concurrent.STM (STM, TMVar, atomically, newEmptyTMVar, putTMVar,- readTMVar, tryReadTMVar)+ readTMVar) import Control.Monad.IO.Class (MonadIO, liftIO) import Data.Maybe (fromMaybe) import Data.Streaming.Process.Internal import System.Exit (ExitCode) import System.IO (hClose) import System.Process++#if MIN_VERSION_stm(2,3,0)+import Control.Concurrent.STM (tryReadTMVar)+#else+import Control.Concurrent.STM (tryTakeTMVar, putTMVar)++tryReadTMVar :: TMVar a -> STM (Maybe a)+tryReadTMVar var = do+ mx <- tryTakeTMVar var+ case mx of+ Nothing -> return ()+ Just x -> putTMVar var x+ return mx+#endif -- | Use the @Handle@ provided by the @CreateProcess@ value. This would allow -- you, for example, to open up a @Handle@ to a file, set it as @std_out@, and
streaming-commons.cabal view
@@ -1,5 +1,5 @@ name: streaming-commons-version: 0.1.4+version: 0.1.4.1 synopsis: Common lower-level functions needed by various streaming data libraries description: Provides low-dependency functionality commonly needed by various streaming data libraries, such as conduit and pipes. homepage: https://github.com/fpco/streaming-commons