123456789101112131415161718192021222324252627282930313233343536373839404142434445(* The [globalize_{bool,char,unit}] functions are written as matches plus the identity
function so that the type checker can give them the desired type, without having to do
anything special. However, [globalize_int] cannot be written this way, so we resort to
using an [external]. *)letglobalize_bool=function|(true|false)asb->b;;letglobalize_char=function|'\x00'..'\xFF'asc->c;;externalglobalize_float:(float[@local])->float="caml_obj_dup"externalglobalize_int:(int[@local])->int="%identity"externalglobalize_int32:(int32[@local])->int32="caml_obj_dup"externalglobalize_int64:(int64[@local])->int64="caml_obj_dup"externalglobalize_nativeint:(nativeint[@local])->nativeint="caml_obj_dup"externalglobalize_bytes:(bytes[@local])->bytes="caml_obj_dup"externalglobalize_string:(string[@local])->string="caml_obj_dup"letglobalize_unit(()asu)=uexternalglobalize_array':('aarray[@local])->'aarray="caml_obj_dup"letglobalize_array_a=globalize_array'aletrecglobalize_listf=function|[]->[]|x::xs->fx::globalize_listfxs;;letglobalize_optionf=function|None->None|Somex->Some(fx);;letglobalize_resultglobalize_aglobalize_bt=matchtwith|Oka->Ok(globalize_aa)|Errorb->Error(globalize_bb);;letglobalize_ref'r=ref!rletglobalize_ref_r=globalize_ref'r