123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051open!Import(* In the definition of [t], we do not have [[@@deriving_inline compare, sexp][@@@end]] because
in general, syntax extensions tend to use the implementation when available rather than
using the alias. Here that would lead to use the record representation [ { mutable
contents : 'a } ] which would result in different (and unwanted) behavior. *)type'at='aref={mutablecontents:'a}include(structtype'at='aref[@@deriving_inlinecompare,equal,sexp]letcompare:'a.('a->'a->int)->'at->'at->int=compare_refletequal:'a.('a->'a->bool)->'at->'at->bool=equal_reflett_of_sexp:'a.(Ppx_sexp_conv_lib.Sexp.t->'a)->Ppx_sexp_conv_lib.Sexp.t->'at=ref_of_sexpletsexp_of_t:'a.('a->Ppx_sexp_conv_lib.Sexp.t)->'at->Ppx_sexp_conv_lib.Sexp.t=sexp_of_ref[@@@end]end:sigtype'at='aref[@@deriving_inlinecompare,equal,sexp]includesig[@@@ocaml.warning"-32"]valcompare:('a->'a->int)->'at->'at->intvalequal:('a->'a->bool)->'at->'at->boolincludePpx_sexp_conv_lib.Sexpable.S1withtype'at:='atend[@@ocaml.doc"@inline"][@@@end]endwithtype'at:='at)externalcreate:'a->'at="%makemutable"external(!):'at->'a="%field0"external(:=):'at->'a->unit="%setfield0"letswapt1t2=lettmp=!t1int1:=!t2;t2:=tmp;;letreplacetf=t:=f!tletset_temporarilyta~f=letrestore_to=!tint:=a;Exn.protect~f~finally:(fun()->t:=restore_to);;