summaryrefslogtreecommitdiffstats
path: root/lib/Phi/Phi.hs
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-10-07 05:31:23 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-10-07 05:31:23 +0200
commit579552b29b396943c3a2c97456c37c8005729ce1 (patch)
tree1d67b4da005ebce9c1378ce3f4aa5c920f95c284 /lib/Phi/Phi.hs
parent5cb4744d4f8bae31c17802f1e57fe31bf747f469 (diff)
downloadphi-579552b29b396943c3a2c97456c37c8005729ce1.tar
phi-579552b29b396943c3a2c97456c37c8005729ce1.zip
Send X message batched
Diffstat (limited to 'lib/Phi/Phi.hs')
-rw-r--r--lib/Phi/Phi.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Phi/Phi.hs b/lib/Phi/Phi.hs
index df71a1c..4a896c7 100644
--- a/lib/Phi/Phi.hs
+++ b/lib/Phi/Phi.hs
@@ -7,6 +7,7 @@ module Phi.Phi ( Phi
, initPhi
, dupPhi
, sendMessage
+ , sendMessages
, receiveMessage
, messageAvailable
) where
@@ -36,6 +37,9 @@ dupPhi (Phi chan) = liftM Phi $ liftIO $ atomically $ dupTChan chan
sendMessage :: (MonadIO m, Typeable a, Show a) => Phi -> a -> m ()
sendMessage (Phi chan) = liftIO . atomically . writeTChan chan . Message
+sendMessages :: (MonadIO m, Typeable a, Show a) => Phi -> [a] -> m ()
+sendMessages (Phi chan) = liftIO . atomically . mapM_ (writeTChan chan . Message)
+
receiveMessage :: MonadIO m => Phi -> m Message
receiveMessage (Phi chan) = liftIO $ atomically $ readTChan chan