import System.IO.Unsafe ( unsafeInterleaveIO )
import Control.Concurrent.MVar
+import Data.Typeable
+
+#include "Typeable.h"
-- A channel is represented by two @MVar@s keeping track of the two ends
-- of the channel contents,i.e., the read- and write ends. Empty @MVar@s
= Chan (MVar (Stream a))
(MVar (Stream a))
+INSTANCE_TYPEABLE1(Chan,chanTc,"Chan")
+
type Stream a = MVar (ChItem a)
data ChItem a = ChItem a (Stream a)
-- Operators for interfacing with functional streams.
-- |Return a lazy list representing the contents of the supplied
--- 'Chan', much like 'IO.hGetContents'.
+-- 'Chan', much like 'System.IO.hGetContents'.
getChanContents :: Chan a -> IO [a]
getChanContents ch
= unsafeInterleaveIO (do