let may_default f x ~opt =
  match opt with None -> f x | Some y -> y