Global Instance sum_Serializer : Serializer (A + B).Fixpoint list_serialize_rec (l : list A) : IOStreamWriter.t :=
    match l with
    | [] => IOStreamWriter.empty
    | a :: l' => IOStreamWriter.append (fun _ => serialize a)
                               (fun _ => list_serialize_rec l')
    end.Definition list_serialize (l : list A) : IOStreamWriter.t :=
    IOStreamWriter.append (fun _ => serialize (length l))
                  (fun _ => list_serialize_rec l).

Lemma serialize_snoc : forall (a : A) l, (IOStreamWriter.unwrap (list_serialize_rec (l ++ [a]))) = (IOStreamWriter.unwrap (list_serialize_rec l) ++ IOStreamWriter.unwrap (serialize a)).