\ignore{
\begin{code}
\end{code}
}
The first module we need is {\tt Parry.Protocol}, that defines the type of
messages exchanged between the client and server. We assume, in the rest of the
proof, that the {\tt encode} and {\tt decode} functions generated by the {\tt
Binary} instances of these datatypes verify {\tt decode.encode} is the identity.
\hfill
\begin{code}
module Parry.Protocol where
import Data.Binary
import GHC.Generics (Generic)
import Codec.Crypto.RSA.Pure
data ClientMessage j=
GetJob Integer PublicKey
| JobDone { clientId::Integer, jobResults::[j], currentJob::j }
| NewJobs { clientId::Integer, jobResults::[j], currentJob::j,
nextJob::j, newJobs::[j] }
| Alive Integer
deriving (Generic, Show)
data ServerMessage j=
Job Bool j
| Finished
| Ack
| Die
deriving (Generic,Show)
instance (Binary j)=>Binary (ClientMessage j)
instance (Binary j)=>Binary (ServerMessage j)
\end{code}
\vspace{1em}