1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980(************************************************************************)(* * The Rocq Prover / The Rocq Development Team *)(* v * Copyright INRIA, CNRS and contributors *)(* <O___,, * (see version control and CREDITS file for authors & dates) *)(* \VV/ **************************************************************)(* // * This file is distributed under the terms of the *)(* * GNU Lesser General Public License Version 2.1 *)(* * (see LICENSE file for the text of the license) *)(************************************************************************)openGenarg(** Dynamic toplevel values *)moduleValT=Dyn.Make()moduleVal=structtype'atyp='aValT.tagtypet=Dyn:'atyp*'a->ttype_tag=|Base:'atyp->'atag|List:'atag->'alisttag|Opt:'atag->'aoptiontag|Pair:'atag*'btag->('a*'b)tag|Any:ttagleteq=ValT.eqletrepr=ValT.reprletcreate=ValT.createletpr:typea.atyp->Pp.t=funt->Pp.str(reprt)lettyp_list=ValT.create"list"lettyp_opt=ValT.create"option"lettyp_pair=ValT.create"pair"letrecinject:typea.atag->a->t=funtagx->matchtagwith|Baset->Dyn(t,x)|Listtag->Dyn(typ_list,List.map(funx->injecttagx)x)|Opttag->Dyn(typ_opt,Option.map(funx->injecttagx)x)|Pair(tag1,tag2)->Dyn(typ_pair,(injecttag1(fstx),injecttag2(sndx)))|Any->xendmoduleValTMap=ValT.MapmoduleValReprObj=structtype('raw,'glb,'top)obj='topVal.tagletname="valrepr"letdefault_=NoneendmoduleValRepr=Register(ValReprObj)letrecval_tag:typeabc.(a,b,c)genarg_type->cVal.tag=function|ListArgt->Val.List(val_tagt)|OptArgt->Val.Opt(val_tagt)|PairArg(t1,t2)->Val.Pair(val_tagt1,val_tagt2)|ExtraArgs->ValRepr.obj(ExtraArgs)letval_tag=functionTopwitt->val_tagtletregister_val0wittag=lettag=matchtagwith|None->letname=matchwitwith|ExtraArgs->ArgT.reprs|_->assertfalseinVal.Base(Val.createname)|Sometag->taginValRepr.register0wittag