1234567891011121314151617181920212223(** Small helper to find out who is the caller of a function *)open!ImportmodulePrintexc=Stdlib.Printexctypet=Printexc.locationoptionletget~skip=letskip=__FILE__::skipinletstack=Printexc.get_callstack16inletlen=Printexc.raw_backtrace_lengthstackinletreclooppos=ifpos=lenthenNoneelsematchPrintexc.get_raw_backtrace_slotstackpos|>Printexc.convert_raw_backtrace_slot|>Printexc.Slot.locationwith|None->None|Someloc->ifList.mem~set:skiploc.filenamethenloop(pos+1)elseSomelocinloop0