@@ -222,9 +222,11 @@ newChan = do
222222 , (sport, rport)
223223 )
224224
225+-- | Send a message on a typed channel
225226sendChan :: Serializable a => SendPort a -> a -> Process ()
226227sendChan (SendPort them) msg = lift $ sendBinary (ChannelIdentifier them) msg
227228
229+-- | Wait for a message on a typed channel
228230receiveChan :: Serializable a => ReceivePort a -> Process a
229231receiveChan = liftIO . atomically . receiveSTM
230232 where
@@ -243,9 +245,15 @@ receiveChan = liftIO . atomically . receiveSTM
243245 rotate [] = []
244246 rotate (x:xs) = xs ++ [x]
245247
248+-- | Merge a list of typed channels.
249+--
250+-- The result port is left-biased: if there are messages available on more
251+-- than one port, the first available message is returned.
246252mergePortsBiased :: Serializable a => [ReceivePort a] -> Process (ReceivePort a)
247253mergePortsBiased = return . ReceivePortBiased
248254
255+-- | Like 'mergePortsBiased', but with a round-robin scheduler (rather than
256+-- left-biased)
249257mergePortsRR :: Serializable a => [ReceivePort a] -> Process (ReceivePort a)
250258mergePortsRR ps = liftIO . atomically $ ReceivePortRR <$> newTVar ps
251259
@@ -312,6 +320,7 @@ call nid proc@(Closure (Static label) _) = do
312320 CallReply a <- expect
313321 return a
314322
323+-- | Thrown by 'terminate'
315324data ProcessTerminationException = ProcessTerminationException
316325 deriving (Show, Typeable)
317326