123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105(* This is broken off to avoid circular dependency between Sign and Comparable. *)open!Importtypet=|Neg|Zero|Pos[@@deriving_inlinesexp,sexp_grammar,compare,hash,enumerate]lett_of_sexp=(leterror_source__003_="sign0.ml.t"infunction|Sexplib0.Sexp.Atom("neg"|"Neg")->Neg|Sexplib0.Sexp.Atom("zero"|"Zero")->Zero|Sexplib0.Sexp.Atom("pos"|"Pos")->Pos|Sexplib0.Sexp.List(Sexplib0.Sexp.Atom("neg"|"Neg")::_)assexp__004_->Sexplib0.Sexp_conv_error.stag_no_argserror_source__003_sexp__004_|Sexplib0.Sexp.List(Sexplib0.Sexp.Atom("zero"|"Zero")::_)assexp__004_->Sexplib0.Sexp_conv_error.stag_no_argserror_source__003_sexp__004_|Sexplib0.Sexp.List(Sexplib0.Sexp.Atom("pos"|"Pos")::_)assexp__004_->Sexplib0.Sexp_conv_error.stag_no_argserror_source__003_sexp__004_|Sexplib0.Sexp.List(Sexplib0.Sexp.List_::_)assexp__002_->Sexplib0.Sexp_conv_error.nested_list_invalid_sumerror_source__003_sexp__002_|Sexplib0.Sexp.List[]assexp__002_->Sexplib0.Sexp_conv_error.empty_list_invalid_sumerror_source__003_sexp__002_|sexp__002_->Sexplib0.Sexp_conv_error.unexpected_stagerror_source__003_sexp__002_:Sexplib0.Sexp.t->t);;letsexp_of_t=(function|Neg->Sexplib0.Sexp.Atom"Neg"|Zero->Sexplib0.Sexp.Atom"Zero"|Pos->Sexplib0.Sexp.Atom"Pos":t->Sexplib0.Sexp.t);;let(t_sexp_grammar:tSexplib0.Sexp_grammar.t)={untyped=Variant{case_sensitivity=Case_sensitive_except_first_character;clauses=[No_tag{name="Neg";clause_kind=Atom_clause};No_tag{name="Zero";clause_kind=Atom_clause};No_tag{name="Pos";clause_kind=Atom_clause}]}};;letcompare=(Ppx_compare_lib.polymorphic_compare:t->t->int)let(hash_fold_t:Ppx_hash_lib.Std.Hash.state->t->Ppx_hash_lib.Std.Hash.state)=(funhsvarg->matchargwith|Neg->Ppx_hash_lib.Std.Hash.fold_inthsv0|Zero->Ppx_hash_lib.Std.Hash.fold_inthsv1|Pos->Ppx_hash_lib.Std.Hash.fold_inthsv2:Ppx_hash_lib.Std.Hash.state->t->Ppx_hash_lib.Std.Hash.state);;let(hash:t->Ppx_hash_lib.Std.Hash.hash_value)=letfuncarg=Ppx_hash_lib.Std.Hash.get_hash_value(lethsv=Ppx_hash_lib.Std.Hash.create()inhash_fold_thsvarg)infunx->funcx;;letall=([Neg;Zero;Pos]:tlist)[@@@end]moduleReplace_polymorphic_compare=structlet(<)(x:t)y=Poly.(<)xylet(<=)(x:t)y=Poly.(<=)xylet(<>)(x:t)y=Poly.(<>)xylet(=)(x:t)y=Poly.(=)xylet(>)(x:t)y=Poly.(>)xylet(>=)(x:t)y=Poly.(>=)xyletascending(x:t)y=Poly.ascendingxyletdescending(x:t)y=Poly.descendingxyletcompare(x:t)y=Poly.comparexyletequal(x:t)y=Poly.equalxyletmax(x:t)y=ifx>=ythenxelseyletmin(x:t)y=ifx<=ythenxelseyendletof_strings=t_of_sexp(sexp_of_strings)letto_stringt=string_of_sexp(sexp_of_tt)letto_int=function|Neg->-1|Zero->0|Pos->1;;let_=hash(* Ignore the hash function produced by [@@deriving_inline hash] *)lethash=to_intletmodule_name="Base.Sign"letof_intn=ifn<0thenNegelseifn=0thenZeroelsePos