let rec while_none cond body =
  match cond () with
  | Some r -> r
  | None   -> body (); while_none cond body