Removed opaque type for chan dupping.
--- a/src/System/IO/Streams/Concurrent/Unagi/Bounded.hs Tue Dec 09 13:37:21 2014 -0600
+++ b/src/System/IO/Streams/Concurrent/Unagi/Bounded.hs Thu Dec 18 10:56:53 2014 -0600
@@ -6,17 +6,14 @@
, 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 @@
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 @@
--
-- 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
--- a/unagi-streams.cabal Tue Dec 09 13:37:21 2014 -0600
+++ b/unagi-streams.cabal Thu Dec 18 10:56:53 2014 -0600
@@ -21,5 +21,6 @@
, unagi-chan >= 0.2 && < 0.3
, io-streams >= 1.2 && < 1.3
- hs-source-dirs: src/
+
+ hs-source-dirs: src
default-language: Haskell2010