Commit 3595c4f7 authored by Francois Bobot's avatar Francois Bobot

Encoding_decorate : Utilisation de option_eq au lieu de option_maq

parent 04da3988
......@@ -152,8 +152,9 @@ let conv_ls tenv ls =
then ls
else
let tyl = List.map (conv_ty_neg tenv) ls.ls_args in
let ty_res = Util.option_maq (conv_ty_pos tenv) ls.ls_value in
if ty_res == ls.ls_value && List.for_all2 (==) tyl ls.ls_args
let ty_res = Util.option_map (conv_ty_pos tenv) ls.ls_value in
if Util.option_eq (==) ty_res ls.ls_value
&& List.for_all2 (==) tyl ls.ls_args
then ls
else
let preid = id_clone ls.ls_name in
......
......@@ -23,14 +23,11 @@ let of_option = function None -> assert false | Some x -> x
let option_map f = function None -> None | Some x -> Some (f x)
let option_maq f = function None as o -> o | Some x as o ->
let r = (f x) in if r == x then o else Some r
let option_apply d f = function None -> d | Some x -> f x
let option_iter f = function None -> () | Some x -> f x
let option_eq eq = function
let option_eq eq a b = match a,b with
| None, None -> true
| None, _ | _, None -> false
| Some x, Some y -> eq x y
......
......@@ -23,15 +23,12 @@ val of_option : 'a option -> 'a
val option_map : ('a -> 'b) -> 'a option -> 'b option
val option_maq : ('a -> 'a) -> 'a option -> 'a option
(** same as {! option_map} but [option_maq f o] return o if o is
None or f is the identity (according to (==)) on the argument
given *)
val option_iter : ('a -> unit) -> 'a option -> unit
val option_apply : 'b -> ('a -> 'b) -> 'a option -> 'b
val option_eq : ('a -> 'b -> bool) -> 'a option -> 'b option -> bool
(* useful list combinators *)
val map_fold_left :
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment