12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061(******************************************************************************)(* *)(* Fix *)(* *)(* François Pottier, Inria Paris *)(* *)(* Copyright Inria. All rights reserved. This file is distributed under the *)(* terms of the GNU Library General Public License version 2, with a *)(* special exception on linking, as described in the file LICENSE. *)(* *)(******************************************************************************)openSigsmoduleMake(F:FINITE_TYPE)(M:MINIMAL_IMPERATIVE_MAPSwithtypekey=F.t)=structtypekey=M.keylettabulate(f:key->'a):key->'a=lettable=M.create()inF.foreach(funx->M.addx(fx)table);funx->tryM.findxtablewithNot_found->(* This cannot happen if [foreach] is exhaustive. *)letmsg=Printf.sprintf"\n Fix.Tabulate says: \
please check that your \"foreach\" function is \
exhaustive.\n %s\n"__LOC__inraise(Invalid_argumentmsg)endmoduleForOrderedType(F:FINITE_TYPE)(T:OrderedTypewithtypet=F.t)=Make(F)(Glue.PersistentMapsToImperativeMaps(Map.Make(T)))moduleForHashedType(F:FINITE_TYPE)(T:HashedTypewithtypet=F.t)=Make(F)(Glue.HashTablesAsImperativeMaps(T))moduleForType(F:FINITE_TYPE)=ForHashedType(F)(Glue.TrivialHashedType(F))moduleForIntSegment(K:sigvaln:intend)=structtypekey=intlettabulate(f:key->'a):key->'a=lettable=Array.initK.nfinfunx->table.(x)end