@@ -6,26 +6,21 @@ module System.IO.Streams.Concurrent.Unagi.Bounded
66 , chanToInput
77 , chanToOutput
88 , makeChanPipe
9- , dupStream
10- , DupHandle
119 ) where
1210
1311
1412------------------------------------------------------------------------------
15- import Control.Applicative (pure , (<$>) , (<*>) )
13+ import Control.Applicative ((<$>) , (<*>) )
1614import Control.Concurrent.Chan.Unagi.Bounded (InChan , OutChan ,
17- dupChan , newChan ,
18- readChan , writeChan )
19- import Control.Monad ((>=>) )
15+ newChan , readChan ,
16+ writeChan )
2017import Prelude hiding (read )
2118import System.IO.Streams.Internal (InputStream ,
2219 OutputStream ,
2320 makeInputStream ,
2421 makeOutputStream , read )
2522
2623
27- newtype DupHandle a = DupHandle { unDupHandle :: InChan (Maybe a ) }
28-
2924------------------------------------------------------------------------------
3025-- | Writes the contents of an input stream to a channel until the input stream
3126-- yields end-of-stream.
@@ -58,15 +53,7 @@ chanToOutput = makeOutputStream . writeChan
5853--
5954-- Since reading from the 'InputStream' and writing to the 'OutputStream' are
6055-- blocking calls, be sure to do so in different threads.
61- makeChanPipe :: Int -> IO (InputStream a , OutputStream a , DupHandle a )
56+ makeChanPipe :: Int -> IO (InputStream a , OutputStream a )
6257makeChanPipe size = do
6358 (inChan, outChan) <- newChan size
64- (,,) <$> chanToInput outChan <*> chanToOutput inChan <*> pure (DupHandle inChan)
65-
66-
67- ------------------------------------------------------------------------------
68- -- | Use a 'DupHandle' to replicate everything written on the
69- -- associated 'OutputStream' to the 'InputStream'.
70- --
71- dupStream :: DupHandle a -> IO (InputStream a )
72- dupStream = dupChan . unDupHandle >=> chanToInput
59+ (,) <$> chanToInput outChan <*> chanToOutput inChan
0 commit comments