@@ -27,7 +27,6 @@ module Control.Distributed.Process.Internal.Primitives
2727 , matchMessage
2828 , matchMessageIf
2929 , wrapMessage
30− , wrapMessageLocal
3130 , unwrapMessage
3231 , handleMessage
3332 , forward
@@ -393,27 +392,26 @@ forward msg them = do
393392
394393
395394-- | Wrap a 'Serializable' value in a 'Message'. Note that 'Message's are
396−-- 'Serializable' - like the datum they contain - but remember that deserializing
395+-- 'Serializable' - like the datum they contain - but also note, deserialising
397396-- a 'Message' will yield a 'Message', not the type within it! To obtain the
398397-- wrapped datum, use 'unwrapMessage' or 'handleMessage' with a specific type.
399398--
400399-- @
401400-- do
402−-- self <- getSelfPid
403−-- send self (wrapMessage "blah")
404−-- Nothing <- expectTimeout 1000000 :: Process (Maybe String)
405−-- (Just m) <- expectTimeout 1000000 :: Process (Maybe Message)
406−-- (Just "blah") <- unwrapMessage m :: Process (Maybe String)
401+-- self <- getSelfPid
402+-- send self (wrapMessage "blah")
403+-- Nothing <- expectTimeout 1000000 :: Process (Maybe String)
404+-- (Just m) <- expectTimeout 1000000 :: Process (Maybe Message)
405+-- (Just "blah") <- unwrapMessage m :: Process (Maybe String)
407406-- @
408407--
409408wrapMessage :: Serializable a => a -> Message
410−wrapMessage = createMessage
409+wrapMessage = createUnencodedMessage -- see [note Serializable UnencodedMessage]
411410
412−-- | Like 'wrapMessage', but produces a 'Message' that is only usable in the
413−-- local node. This is primarily useful when consuming the tracing and debugging
414−-- APIs in "Control.Distributed.Process.Debug".
415−wrapMessageLocal :: Serializable a => a -> Message
416−wrapMessageLocal = createUnencodedMessage
411+-- [note Serializable UnencodedMessage]
412+-- if we attempt to serialise an UnencodedMessage, it will be converted to an
413+-- EncodedMessage first, so we're ok here. See 'messageToPayload' in
414+-- Primitives.hs for the gory details
417415
418416-- | Attempt to unwrap a raw 'Message'.
419417-- If the type of the decoded message payload matches the expected type, the