{-# LANGUAGE TemplateHaskell, DeriveDataTypeable, DeriveGeneric #-} {-# OPTIONS_GHC -Wall #-} import Control.Distributed.Process import Control.Distributed.Process.Closure import DistribUtils import Text.Printf import Data.Binary import Data.Typeable import GHC.Generics (Generic) -- < instance Binary Message -- <2> -- >> -- < say $ printf "ping received from %s" (show from) -- <2> mypid <- getSelfPid -- <3> send from (Pong mypid) -- <4> -- >> -- <> -- < say $ printf "spawning on %s" (show node) pid <- spawn node $(mkStaticClosure 'pingServer) -- <2> mypid <- getSelfPid -- <3> say $ printf "sending ping to %s" (show pid) send pid (Ping mypid) -- <4> Pong _ <- expect -- <5> say "pong." terminate -- <6> -- >> -- <
master) Main.__remoteTable -- >>