123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051(******************************************************************************)(* *)(* Fix *)(* *)(* François Pottier, Inria Paris *)(* *)(* Copyright Inria. All rights reserved. This file is distributed under the *)(* terms of the GNU Library General Public License version 2, with a *)(* special exception on linking, as described in the file LICENSE. *)(* *)(******************************************************************************)(* Although the code is polymorphic in the type of elements, it must still
be packaged as a functor, because [property] cannot be a parameterized
type. *)moduleOption(X:sigtypetend)=structopenXtypeproperty=toptionletbottom=Noneletequal(o1:property)(o2:property)=(* It is permitted to assume that [o1 <= o2] holds. This implies that
when [o1] is [Some x1] and [o2] is [Some x2] we may return [true]
without actually comparing [x1] and [x2]. *)matcho1,o2with|Some_,None->(* Because [o1 <= o2] holds, this cannot happen. *)letmsg=Printf.sprintf"\n Fix.Prop.Option says: \
please check that your \"rhs\" function is \
monotone.\n %s\n"__LOC__inraise(Invalid_argumentmsg)|None,Some_->false|None,None|Some_,Some_->trueletis_maximalo=matchowith|None->false|Some_->trueend