[project @ 1996-06-27 16:55:06 by partain]
[ghc-hetmet.git] / ghc / lib / concurrent / Merge.hs
similarity index 79%
rename from ghc/lib/prelude/Merge.lhs
rename to ghc/lib/concurrent/Merge.hs
index be38c89..7d80992 100644 (file)
@@ -1,3 +1,4 @@
+{-
 %
 % (c) The GRASP/AQUA Project, Glasgow University, 1995
 %
@@ -7,6 +8,7 @@ Avoiding the loss of ref. transparency by attaching the merge to the
 IO monad.
 
 \begin{code}
+-}
 module Merge
 
        (
@@ -18,12 +20,6 @@ import Semaphore
 
 import PreludeGlaST
 import Concurrent      ( forkIO )
-import PreludePrimIO   ( newEmptyMVar, newMVar, putMVar,
-                         readMVar, takeMVar, _MVar
-                       )
-\end{code}
-
-\begin{code}
 
 max_buff_size = 1
 
@@ -52,9 +48,9 @@ mergeIO ls rs
     return val
 
 type Buffer a 
- = (_MVar (_MVar [a]), QSem)
+ = (MVar (MVar [a]), QSem)
 
-suckIO :: _MVar Int -> Buffer a -> [a] -> IO ()
+suckIO :: MVar Int -> Buffer a -> [a] -> IO ()
 
 suckIO branches_running buff@(tail_list,e) vs
  = case vs of
@@ -94,24 +90,5 @@ nmergeIO lss
     return val
   where
     mapIO f xs = accumulate (map f xs)
-\end{code}
-
-So as to avoid creating a mutual recursive module dep. with @Concurrent.lhs@,
-the defn. of @forkIO@ is duplicated here:
-
-\begin{code}
-{- HAH! WDP 95/07
-
-forkIO :: PrimIO a -> PrimIO a
-forkIO action s
- = let
-    (r, new_s) = action s
-   in
-    new_s `_fork_` (r, s)
- where
-    _fork_ x y = case (fork# x) of { 0# -> parError#; _ -> y }
--}
 
 #endif {- __CONCURRENT_HASKELL__ -}
-
-\end{code}