Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Why3
why3
Commits
3595c4f7
Commit
3595c4f7
authored
Apr 22, 2010
by
Francois Bobot
Browse files
Encoding_decorate : Utilisation de option_eq au lieu de option_maq
parent
04da3988
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/transform/encoding_decorate.ml
View file @
3595c4f7
...
...
@@ -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
...
...
src/util/util.ml
View file @
3595c4f7
...
...
@@ -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
...
...
src/util/util.mli
View file @
3595c4f7
...
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment