123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156(*open Odoc_model.Paths*)openOdoc_model.Namestyperoot=[`ModuleTypeofCpath.Resolved.module_type|`ModuleofCpath.Resolved.module_]typeresolved_signature=[`Rootofroot|`SubstofCpath.Resolved.module_type*resolved_module|`AliasofCpath.Resolved.module_*resolved_module|`Moduleofresolved_signature*ModuleName.t|`OpaqueModuleofresolved_module]andresolved_module=[`SubstofCpath.Resolved.module_type*resolved_module|`AliasofCpath.Resolved.module_*resolved_module|`Moduleofresolved_signature*ModuleName.t|`OpaqueModuleofresolved_module]andresolved_module_type=[`ModuleTypeofresolved_signature*ModuleTypeName.t]andresolved_type=[`Typeofresolved_signature*TypeName.t|`Classofresolved_signature*ClassName.t|`ClassTypeofresolved_signature*ClassTypeName.t](* and signature = [ `Resolved of resolved_signature ] *)typesignature=[`Resolvedofresolved_signature|`Dotofsignature*string|`Root]andmodule_=[`Resolvedofresolved_module|`Dotofsignature*string]andmodule_type=[`Resolvedofresolved_module_type|`Dotofsignature*string]andtype_=[`Resolvedofresolved_type|`Dotofsignature*string]typeresolved_base_name=|RBaseofroot|RBranchofModuleName.t*resolved_signaturetypebase_name=Baseofrootoption|BranchofModuleName.t*signatureletrecresolved_signature_split_parent:resolved_signature->resolved_base_name=function|`Rooti->RBasei|`Subst(_,p)->resolved_signature_split_parent(p:>resolved_signature)|`Alias(_,p)->resolved_signature_split_parent(p:>resolved_signature)|`OpaqueModulem->resolved_signature_split_parent(m:>resolved_signature)|`Module(p,name)->(matchresolved_signature_split_parentpwith|RBasei->RBranch(name,`Module(`Rooti,name))|RBranch(base,m)->RBranch(base,`Module(m,name)))(* Note that this returns an unresolved fragment by design *)letrecsignature_split_parent:signature->base_name=function|`Root->BaseNone|`Resolvedr->(matchresolved_signature_split_parentrwith|RBase_->BaseNone|RBranch(base,m)->Branch(base,`Resolvedm))|`Dot(m,name)->(matchsignature_split_parentmwith|Base_->Branch(ModuleName.make_stdname,`Root)|Branch(base,m)->Branch(base,`Dot(m,name)))letrecresolved_module_split:resolved_module->string*resolved_moduleoption=function|`Subst(_,p)->resolved_module_splitp|`Alias(_,p)->resolved_module_splitp|`Module(m,name)->(matchresolved_signature_split_parentmwith|RBase_->(ModuleName.to_stringname,None)|RBranch(base,m)->(ModuleName.to_stringbase,Some(`Module(m,name))))|`OpaqueModulem->resolved_module_splitmletmodule_split:module_->string*module_option=function|`Resolvedr->letbase,m=resolved_module_splitrinletm=matchmwithNone->None|Somem->Some(`Resolvedm)in(base,m)|`Dot(m,name)->(matchsignature_split_parentmwith|Base_->(name,None)|Branch(base,m)->(ModuleName.to_stringbase,Some(`Dot(m,name))))letresolved_module_type_split:resolved_module_type->string*resolved_module_typeoption=function|`ModuleType(m,name)->(matchresolved_signature_split_parentmwith|RBase_->(ModuleTypeName.to_stringname,None)|RBranch(base,m)->(ModuleName.to_stringbase,Some(`ModuleType(m,name))))letmodule_type_split:module_type->string*module_typeoption=function|`Resolvedr->letbase,m=resolved_module_type_splitrinletm=matchmwithNone->None|Somem->Some(`Resolvedm)in(base,m)|`Dot(m,name)->(matchsignature_split_parentmwith|Base_->(name,None)|Branch(base,m)->(ModuleName.to_stringbase,Some(`Dot(m,name))))letresolved_type_split:resolved_type->string*resolved_typeoption=function|`Type(m,name)->(matchresolved_signature_split_parentmwith|RBase_->(TypeName.to_stringname,None)|RBranch(base,m)->(ModuleName.to_stringbase,Some(`Type(m,name))))|`Class(m,name)->(matchresolved_signature_split_parentmwith|RBase_->(ClassName.to_stringname,None)|RBranch(base,m)->(ModuleName.to_stringbase,Some(`Class(m,name))))|`ClassType(m,name)->(matchresolved_signature_split_parentmwith|RBase_->(ClassTypeName.to_stringname,None)|RBranch(base,m)->(ModuleName.to_stringbase,Some(`ClassType(m,name))))lettype_split:type_->string*type_option=function|`Resolvedr->letbase,m=resolved_type_splitrinletm=matchmwithNone->None|Somem->Some(`Resolvedm)in(base,m)|`Dot(m,name)->(matchsignature_split_parentmwith|Base_->(name,None)|Branch(base,m)->(ModuleName.to_stringbase,Some(`Dot(m,name))))letrecunresolve_module:resolved_module->module_=function|`OpaqueModulem|`Subst(_,m)|`Alias(_,m)->unresolve_modulem|`Module(parent,m)->`Dot(unresolve_signatureparent,ModuleName.to_stringm)andunresolve_signature:resolved_signature->signature=function|#resolved_moduleasm->(unresolve_modulem:>signature)|`Root_->`Rootandunresolve_type:resolved_type->type_=function|`Type(parent,name)->`Dot(unresolve_signatureparent,TypeName.to_stringname)|`ClassType(parent,name)->`Dot(unresolve_signatureparent,ClassTypeName.to_stringname)|`Class(parent,name)->`Dot(unresolve_signatureparent,ClassName.to_stringname)andunresolve_module_type:resolved_module_type->module_type=function|`ModuleType(parent,name)->`Dot(unresolve_signatureparent,ModuleTypeName.to_stringname)