diff options
| author | Luke Hoersten <[email protected]> | 2014-12-18 10:56:53 -0600 |
|---|---|---|
| committer | Luke Hoersten <[email protected]> | 2014-12-18 10:56:53 -0600 |
| commit | 3b40b5c3c97b636c4130e8b85e347c53aed1b25f (patch) | |
| tree | 573c43493413cb2eaf563b0a5da3f67fd2843c1c /src/System/IO/Streams/Concurrent | |
| parent | 9f53721dad732c5c389fd27b155c08dc603d1191 (diff) | |
Removed opaque type for chan dupping.
Diffstat (limited to 'src/System/IO/Streams/Concurrent')
| -rw-r--r-- | src/System/IO/Streams/Concurrent/Unagi/Bounded.hs | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/System/IO/Streams/Concurrent/Unagi/Bounded.hs b/src/System/IO/Streams/Concurrent/Unagi/Bounded.hs index 83cb542..fe1e856 100644 --- a/src/System/IO/Streams/Concurrent/Unagi/Bounded.hs +++ b/src/System/IO/Streams/Concurrent/Unagi/Bounded.hs @@ -6,17 +6,14 @@ module System.IO.Streams.Concurrent.Unagi.Bounded , chanToInput , chanToOutput , makeChanPipe - , dupStream - , DupHandle ) where ------------------------------------------------------------------------------ -import Control.Applicative (pure, (<$>), (<*>)) +import Control.Applicative ((<$>), (<*>)) import Control.Concurrent.Chan.Unagi.Bounded (InChan, OutChan, - dupChan, newChan, - readChan, writeChan) -import Control.Monad ((>=>)) + newChan, readChan, + writeChan) import Prelude hiding (read) import System.IO.Streams.Internal (InputStream, OutputStream, @@ -24,8 +21,6 @@ import System.IO.Streams.Internal (InputStream, makeOutputStream, read) -newtype DupHandle a = DupHandle { unDupHandle :: InChan (Maybe a) } - ------------------------------------------------------------------------------ -- | Writes the contents of an input stream to a channel until the input stream -- yields end-of-stream. @@ -58,15 +53,7 @@ chanToOutput = makeOutputStream . writeChan -- -- Since reading from the 'InputStream' and writing to the 'OutputStream' are -- blocking calls, be sure to do so in different threads. -makeChanPipe :: Int -> IO (InputStream a, OutputStream a, DupHandle a) +makeChanPipe :: Int -> IO (InputStream a, OutputStream a) makeChanPipe size = do (inChan, outChan) <- newChan size - (,,) <$> chanToInput outChan <*> chanToOutput inChan <*> pure (DupHandle inChan) - - ------------------------------------------------------------------------------- --- | Use a 'DupHandle' to replicate everything written on the --- associated 'OutputStream' to the 'InputStream'. --- -dupStream :: DupHandle a -> IO (InputStream a) -dupStream = dupChan . unDupHandle >=> chanToInput + (,) <$> chanToInput outChan <*> chanToOutput inChan |
