git.iko.soy/distributed-process
on master help sign in
move forever' into Type.hs for general use
5c3abffTim Watson
distributed-process/src/Control/Distributed/Process/Internal/Types.hs+12
@@ -67,6 +67,8 @@ module Control.Distributed.Process.Internal.Types
67 , channelCounter
67 , channelCounter
68 , typedChannels
68 , typedChannels
69 , typedChannelWithId
69 , typedChannelWithId
70+ -- * Utilities
71+ , forever'
70 ) where
72 ) where
71
73
72import System.Mem.Weak (Weak)
74import System.Mem.Weak (Weak)
@@ -625,3 +627,13 @@ typedChannels = accessor _typedChannels (\cs st -> st { _typedChannels = cs })
625
627
626typedChannelWithId :: LocalSendPortId -> Accessor LocalProcessState (Maybe TypedChannel)
628typedChannelWithId :: LocalSendPortId -> Accessor LocalProcessState (Maybe TypedChannel)
627typedChannelWithId cid = typedChannels >>> DAC.mapMaybe cid
629typedChannelWithId 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
109 , localPidUnique
109 , localPidUnique
110 , localProcessWithId
110 , localProcessWithId
111 , localConnections
111 , localConnections
112+ , forever'
112 , MonitorRef(..)
113 , MonitorRef(..)
113 , ProcessMonitorNotification(..)
114 , ProcessMonitorNotification(..)
114 , NodeMonitorNotification(..)
115 , NodeMonitorNotification(..)
@@ -202,11 +203,6 @@ createBareLocalNode endPoint rtable = do
202 void . forkIO $ handleIncomingMessages node
203 void . forkIO $ handleIncomingMessages node
203 return node
204 return node
204
205
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−
210-- | Start and register the service processes on a node
206-- | Start and register the service processes on a node
211-- (for now, this is only the logger)
207-- (for now, this is only the logger)
212startServiceProcesses :: LocalNode -> IO ()
208startServiceProcesses :: LocalNode -> IO ()