You can search for identifiers within the package.
in-package search v0.2.0
Source file serType.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231(************************************************************************)(* * The Coq Proof Assistant / The Coq 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) *)(************************************************************************)(************************************************************************)(* SerAPI: Coq interaction protocol with bidirectional serialization *)(************************************************************************)(* Copyright 2016-2019 MINES ParisTech -- License LGPL 2.1+ *)(* Copyright 2019-2023 Inria -- License LGPL 2.1+ *)(* Written by: Emilio J. Gallego Arias and others *)(************************************************************************)moduletypeSJHC=sigtypet[@@derivingsexp,yojson,hash,compare]endmoduletypeSJHC1=sigtype'at[@@derivingsexp,yojson,hash,compare]endmoduletypeSJHC2=sigtype('a,'b)t[@@derivingsexp,yojson,hash,compare]end(* Bijection with serializable types *)moduletypeBijectable=sig(* Base Type *)typet(* Representation type *)type_t[@@derivingsexp,yojson,hash,compare](* Need to be bijetive *)valto_t:_t->tvalof_t:t->_tendmoduleBiject(M:Bijectable):SJHCwithtypet=M.t=structtypet=M.tletsexp_of_tx=M.sexp_of__t(M.of_tx)lett_of_sexps=M.to_t(M._t_of_sexps)letto_yojsonp=M._t_to_yojson(M.of_tp)letof_yojsonp=M._t_of_yojsonp|>Result.mapM.to_tlethashx=M.hash__t(M.of_tx)lethash_fold_tstx=M.hash_fold__tst(M.of_tx)letcomparex1x2=M.compare__t(M.of_tx1)(M.of_tx2)end(* Bijection with serializable types *)moduletypeBijectable1=sig(* Base Type *)type'at(* Representation type *)type'a_t[@@derivingsexp,yojson,hash,compare](* Need to be bijetive *)valto_t:'a_t->'atvalof_t:'at->'a_tendmoduleBiject1(M:Bijectable1):SJHC1withtype'at='aM.t=structtype'at='aM.tletsexp_of_tfx=M.sexp_of__tf(M.of_tx)lett_of_sexpfs=M.to_t(M._t_of_sexpfs)letto_yojsonfp=M._t_to_yojsonf(M.of_tp)letof_yojsonfp=M._t_of_yojsonfp|>Result.mapM.to_tlethash_fold_tfstx=M.hash_fold__tfst(M.of_tx)letcomparefx1x2=M.compare__tf(M.of_tx1)(M.of_tx2)endmoduletypeBijectable2=sig(* Base Type *)type('a,'b)t(* Representation type *)type('a,'b)_t[@@derivingsexp,yojson,hash,compare](* Need to be bijetive *)valto_t:('a,'b)_t->('a,'b)tvalof_t:('a,'b)t->('a,'b)_tendmoduleBiject2(M:Bijectable2):SJHC2withtype('a,'b)t=('a,'b)M.t=structtype('a,'b)t=('a,'b)M.tletsexp_of_tfgx=M.sexp_of__tfg(M.of_tx)lett_of_sexpfgs=M.to_t(M._t_of_sexpfgs)letto_yojsonfgp=M._t_to_yojsonfg(M.of_tp)letof_yojsonfgp=M._t_of_yojsonfgp|>Result.mapM.to_tlethash_fold_tfgstx=M.hash_fold__tfgst(M.of_tx)letcomparefgx1x2=M.compare__tfg(M.of_tx1)(M.of_tx2)end(* We do our own alias as to have better control *)let_sercast=Obj.magic(* Obj.magic piercing *)moduletypePierceable=sig(* Type to pierce *)typet(* Representation type *)type_t[@@derivingsexp,yojson,hash,compare]endmoduletypePierceable1=sig(* Type to pierce *)type'at(* Representation type *)type'a_t[@@derivingsexp,yojson,hash,compare]endmodulePierce(M:Pierceable):SJHCwithtypet=M.t=structtypet=M.tletsexp_of_tx=M.sexp_of__t(_sercastx)lett_of_sexps=_sercast(M._t_of_sexps)letto_yojsonp=M._t_to_yojson(_sercastp)letof_yojsonp=M._t_of_yojsonp|>Result.map_sercastlethashx=M.hash__t(_sercastx)lethash_fold_tstx=M.hash_fold__tst(_sercastx)letcomparex1x2=M.compare__t(_sercastx1)(_sercastx2)endmodulePierce1(M:Pierceable1):SJHC1withtype'at='aM.t=structtype'at='aM.tletsexp_of_tfx=M.sexp_of__tf(_sercastx)lett_of_sexpfs=_sercast(M._t_of_sexpfs)letto_yojsonfp=M._t_to_yojsonf(_sercastp)letof_yojsonfp=M._t_of_yojsonfp|>Result.map_sercast(* let hash x = M.hash__t (_sercast x) *)lethash_fold_tfstx=M.hash_fold__tfst(_sercastx)letcomparefx1x2=M.compare__tf(_sercastx1)(_sercastx2)end(* Unfortunately this doesn't really work for types that are named as
the functions would have to be sexp_of_name etc... Maybe fixme in
the future *)modulePierceAlt(M:Pierceable):SJHCwithtypet:=M.t=structletsexp_of_tx=M.sexp_of__t(_sercastx)lett_of_sexps=_sercast(M._t_of_sexps)letto_yojsonp=M._t_to_yojson(_sercastp)letof_yojsonp=M._t_of_yojsonp|>Result.map_sercastlethashx=M.hash__t(_sercastx)lethash_fold_tstx=M.hash_fold__tst(_sercastx)letcomparex1x2=M.compare__t(_sercastx1)(_sercastx2)endmoduletypeOpaqueDesc=sigtypetvalname:stringendmoduleOpaque(M:OpaqueDesc):SJHCwithtypet=M.t=structtypet=M.tlettyp=M.nameletsexp_of_tx=Serlib_base.sexp_of_opaque~typxlett_of_sexps=Serlib_base.opaque_of_sexp~typsletto_yojsonp=Serlib_base.opaque_to_yojson~typpletof_yojsonp=Serlib_base.opaque_of_yojson~typplethashx=Serlib_base.hash_opaque~typxlethash_fold_tstx=Serlib_base.hash_fold_opaque~typstxletcomparex1x2=Serlib_base.compare_opaque~typx1x2endmoduletypeOpaqueDesc1=sigtype'atvalname:stringendmoduleOpaque1(M:OpaqueDesc1):SJHC1withtype'at='aM.t=structtype'at='aM.tlettyp=M.nameletsexp_of_t_x=Serlib_base.sexp_of_opaque~typxlett_of_sexp_s=Serlib_base.opaque_of_sexp~typsletto_yojson_p=Serlib_base.opaque_to_yojson~typpletof_yojson_p=Serlib_base.opaque_of_yojson~typplethash_fold_t_stx=Serlib_base.hash_fold_opaque~typstxletcompare_x1x2=Serlib_base.compare_opaque~typx1x2end