git.iko.soy/distributed-process
on master help sign in
strip whitespace
205b5adTim Watson
distributed-process/src/Control/Distributed/Process/Internal/Primitives.hs+7−7
@@ -315,7 +315,7 @@ matchIf c p = Match $ MatchMsg $ \msg ->
315 !decoded = decode (messageEncoding msg)
315 !decoded = decode (messageEncoding msg)
316 _ -> Nothing
316 _ -> Nothing
317
317
318−-- | Represents a received message and provides two basic operations on it.
318+-- | Represents a received message and provides two basic operations on it.
319data AbstractMessage = AbstractMessage {
319data AbstractMessage = AbstractMessage {
320 forward :: ProcessId -> Process () -- ^ forward the message to @ProcessId@
320 forward :: ProcessId -> Process () -- ^ forward the message to @ProcessId@
321 , maybeHandleMessage :: forall a b. (Serializable a)
321 , maybeHandleMessage :: forall a b. (Serializable a)
@@ -324,7 +324,7 @@ data AbstractMessage = AbstractMessage {
324 the supplied expression, then the expression will be evaluated against
324 the supplied expression, then the expression will be evaluated against
325 it. If this runtime type checking fails, then @Nothing@ will be returned
325 it. If this runtime type checking fails, then @Nothing@ will be returned
326 to indicate the fact. If the check succeeds and evaluation proceeds
326 to indicate the fact. If the check succeeds and evaluation proceeds
327− however, the resulting value with be wrapped with @Just@.
327+ however, the resulting value with be wrapped with @Just@.
328 -}
328 -}
329 }
329 }
330
330
@@ -334,9 +334,9 @@ data AbstractMessage = AbstractMessage {
334-- type. If /not/ of the right type, then the 'AbstractMessage'
334-- type. If /not/ of the right type, then the 'AbstractMessage'
335-- @maybeHandleMessage@ function will not evaluate the supplied expression,
335-- @maybeHandleMessage@ function will not evaluate the supplied expression,
336-- /but/ the message will still have been removed from the process mailbox!
336-- /but/ the message will still have been removed from the process mailbox!
337−--
337+--
338matchAny :: forall b. (AbstractMessage -> Process b) -> Match b
338matchAny :: forall b. (AbstractMessage -> Process b) -> Match b
339−matchAny p = Match $ MatchMsg $ Just . p . abstract
339+matchAny p = Match $ MatchMsg $ Just . p . abstract
340
340
341-- | Match against an arbitrary message. 'matchAnyIf' will /only/ remove the
341-- | Match against an arbitrary message. 'matchAnyIf' will /only/ remove the
342-- message from the process mailbox, /if/ the supplied condition matches. The
342-- message from the process mailbox, /if/ the supplied condition matches. The
@@ -358,7 +358,7 @@ matchAnyIf c p = Match $ MatchMsg $ \msg ->
358 -- Make sure the value is fully decoded so that we don't hang to
358 -- Make sure the value is fully decoded so that we don't hang to
359 -- bytestrings when the calling process doesn't evaluate immediately
359 -- bytestrings when the calling process doesn't evaluate immediately
360 !decoded = decode (messageEncoding msg)
360 !decoded = decode (messageEncoding msg)
361− _ -> Nothing
361+ _ -> Nothing
362
362
363abstract :: Message -> AbstractMessage
363abstract :: Message -> AbstractMessage
364abstract msg = AbstractMessage {
364abstract msg = AbstractMessage {
@@ -429,7 +429,7 @@ exit them reason = sendCtrlMsg Nothing (Exit them (createMessage reason))
429-- the exception will be re-thrown.
429-- the exception will be re-thrown.
430--
430--
431-- To handle 'ProcessExitException' without regard for /reason/, see 'catch'.
431-- To handle 'ProcessExitException' without regard for /reason/, see 'catch'.
432−-- To handle multiple /reasons/ of differing types, see 'catchesExit'.
432+-- To handle multiple /reasons/ of differing types, see 'catchesExit'.
433catchExit :: forall a b . (Show a, Serializable a)
433catchExit :: forall a b . (Show a, Serializable a)
434 => Process b
434 => Process b
435 -> (ProcessId -> a -> Process b)
435 -> (ProcessId -> a -> Process b)
@@ -454,7 +454,7 @@ catchExit act exitHandler = catch act handleExit
454-- a handler passed to 'catchesExit' must accept 'AbstractMessage' and return
454-- a handler passed to 'catchesExit' must accept 'AbstractMessage' and return
455-- @Maybe@ (i.e., @Just p@ if it handled the exit reason, otherwise @Nothing@).
455-- @Maybe@ (i.e., @Just p@ if it handled the exit reason, otherwise @Nothing@).
456--
456--
457−-- See 'maybeHandleMessage' and 'AsbtractMessage' for more details.
457+-- See 'maybeHandleMessage' and 'AsbtractMessage' for more details.
458catchesExit :: Process b
458catchesExit :: Process b
459 -> [(ProcessId -> AbstractMessage -> (Process (Maybe b)))]
459 -> [(ProcessId -> AbstractMessage -> (Process (Maybe b)))]
460 -> Process b
460 -> Process b