123456789101112131415161718192021222324letvar="PATH"letcons?(var=var)env~dir=Env.updateenv~var~f:(fun_PATH->Some(Bin.cons_pathdir~_PATH));;(* [cons_multi env ~dirs] adds each path in [dirs] to the start of the PATH
variable in [env], preserving their order *)letcons_multienv~dirs=Env.updateenv~var~f:(funinit->List.fold_rightdirs~init~f:(fundiracc->Some(Bin.cons_pathdir~_PATH:acc)));;letpathenv=matchEnv.getenvvarwith|None->[]|Somes->Bin.parse_paths;;letextend_env_concat_pathab=leta_including_b's_path=cons_multia~dirs:(pathb)inletb_without_path=Env.removeb~varinEnv.extend_enva_including_b's_pathb_without_path;;