@@ -24,11 +24,12 @@
2424-- by several orders of magnitude.
2525--
2626-- This module provides variants of Cloud Haskell's messaging primitives
27−-- ('send', 'sendChan' and 'nsend') which do /not/ force binary serialisation in
28−-- the local case, thereby offering superior intra-node messaging performance.
29−-- The /catch/ is that any evaluation problems lurking within the passed data
30−-- structure - e.g., fields set to @undefined@ and so on - will show up in the
31−-- receiver rather than in the caller (as they would with the /normal/ strategy).
27+-- ('send', 'sendChan', 'nsend' and 'wrapMessage') which do /not/ force binary
28+-- serialisation in the local case, thereby offering superior intra-node
29+-- messaging performance. The /catch/ is that any evaluation problems lurking
30+-- within the passed data structure (e.g., fields set to @undefined@ and so on)
31+-- will show up in the receiver rather than in the caller (as they would with
32+-- the /normal/ strategy).
3233--
3334-- Use of the functions in this module can potentially change the runtime
3435-- behaviour of your application. You have been warned!
@@ -90,6 +91,10 @@ send them msg = do
9091 (ProcessIdentifier them)
9192 NoImplicitReconnect
9293 msg
94+ where
95+ unsafeSendLocal :: (Serializable a) => ProcessId -> a -> Process ()
96+ unsafeSendLocal pid msg =
97+ sendCtrlMsg Nothing $ LocalSend pid (unsafeCreateUnencodedMessage msg)
9398
9499-- | Send a message on a typed channel
95100sendChan :: Serializable a => SendPort a -> a -> Process ()
@@ -105,15 +110,12 @@ sendChan (SendPort cid) msg = do
105110 (SendPortIdentifier cid)
106111 NoImplicitReconnect
107112 msg
113+ where
114+ unsafeSendChanLocal :: (Serializable a) => SendPortId -> a -> Process ()
115+ unsafeSendChanLocal spId msg =
116+ sendCtrlMsg Nothing $ LocalPortSend spId (unsafeCreateUnencodedMessage msg)
108117
118+-- | Create an unencoded @Message@ for any @Serializable@ type.
109119wrapMessage :: Serializable a => a -> Message
110120wrapMessage = unsafeCreateUnencodedMessage
111121
112−unsafeSendLocal :: (Serializable a) => ProcessId -> a -> Process ()
113−unsafeSendLocal pid msg =
114− sendCtrlMsg Nothing $ LocalSend pid (unsafeCreateUnencodedMessage msg)
115−
116−unsafeSendChanLocal :: (Serializable a) => SendPortId -> a -> Process ()
117−unsafeSendChanLocal spId msg =
118− sendCtrlMsg Nothing $ LocalPortSend spId (unsafeCreateUnencodedMessage msg)
119−