Instance wire_Serializer : Serializer IOStreamWriter.wire.
(* top-level interface for output and input channels *)
Definition to_channel : IOStreamWriter.t -> IOStreamWriter.out_channel :=
IOStreamWriter.out_channel_wrap.
Definition from_channel {A} (d : ByteListReader.t A) (i : IOStreamWriter.in_channel) :=
match ByteListReader.unwrap d (IOStreamWriter.in_channel_unwrap i) with
| Some (a, []) => Some a
| _ => None
end.

(* Specifications: *)
Theorem serialize_deserialize_channel_id : forall {A} {sA : Serializer A} a,
from_channel deserialize (IOStreamWriter.channel_send (to_channel (serialize a))) = Some a.