git.iko.soy/distributed-process
on master help sign in
move forever' into Type.hs for general use
commit5c3abffa07d874c4e2e7245874af22ffc2af2007 authorTim Watson <tim@rabbitmq.com> dateThu 24 Jan 2013, 19:21 (14 years ago) parentebd65bb
2 files changed+13−5
distributed-process/src/Control/Distributed/Process/Internal/Types.hs+12 distributed-process/src/Control/Distributed/Process/Node.hs+1−5
distributed-process/src/Control/Distributed/Process/Internal/Types.hs+12
@@ -67,6 +67,8 @@ module Control.Distributed.Process.Internal.Types
6767 , channelCounter
6868 , typedChannels
6969 , typedChannelWithId
70+ -- * Utilities
71+ , forever'
7072 ) where
7173
7274import System.Mem.Weak (Weak)
@@ -625,3 +627,13 @@ typedChannels = accessor _typedChannels (\cs st -> st { _typedChannels = cs })
625627
626628typedChannelWithId :: LocalSendPortId -> Accessor LocalProcessState (Maybe TypedChannel)
627629typedChannelWithId cid = typedChannels >>> DAC.mapMaybe cid
630+
631+--------------------------------------------------------------------------------
632+-- Utilities --
633+--------------------------------------------------------------------------------
634+
635+-- Like 'Control.Monad.forever' but sans space leak
636+{-# INLINE forever' #-}
637+forever' :: Monad m => m a -> m b
638+forever' a = let a' = a >> a' in a'
639+
distributed-process/src/Control/Distributed/Process/Node.hs+1−5
@@ -109,6 +109,7 @@ import Control.Distributed.Process.Internal.Types
109109 , localPidUnique
110110 , localProcessWithId
111111 , localConnections
112+ , forever'
112113 , MonitorRef(..)
113114 , ProcessMonitorNotification(..)
114115 , NodeMonitorNotification(..)
@@ -202,11 +203,6 @@ createBareLocalNode endPoint rtable = do
202203 void . forkIO $ handleIncomingMessages node
203204 return node
204205
205−-- Like 'Control.Monad.forever' but sans space leak
206−{-# INLINE forever' #-}
207−forever' :: Monad m => m a -> m b
208−forever' a = let a' = a >> a' in a'
209−
210206-- | Start and register the service processes on a node
211207-- (for now, this is only the logger)
212208startServiceProcesses :: LocalNode -> IO ()