let enumeration_wrappers enum =
let switched = List.map (fun (string,cons) -> cons,string) enum in
{to_raw = (fun v -> Raw.String (List.assq v switched));
of_raw = function
| Raw.String s ->
(try List.assoc s enum
with Not_found -> failwith (Printf.sprintf "%s isn't a known constructor" s))
| r -> raise (Wrong_type (fun outchan -> Printf.fprintf outchan
"Raw enumeration expected, got %a\n%!" Raw.to_channel r))
}