struct type t = | Bool of bool | Int of int let to_string r = match r with | Bool b -> sprintf "Bool %B" b | Int i -> sprintf "Int %d" i end