123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960(************************************************************************)(* v * The Coq Proof Assistant / The Coq Development Team *)(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2016 *)(* \VV/ **************************************************************)(* // * This file is distributed under the terms of the *)(* * GNU Lesser General Public License Version 2.1 *)(************************************************************************)(************************************************************************)(* Coq serialization API/Plugin *)(* Copyright 2016 MINES ParisTech *)(************************************************************************)(* Status: Very Experimental *)(************************************************************************)(* We force the thunks in serialization *)openSexplibmoduleCAst=Ser_cAsttype('a,'b)thunk=[%import:('a,'b)DAst.thunk]letsexp_of_thunk:typeab.(a->Sexp.t)->(b->Sexp.t)->(a,b)thunk->Sexp.t=funf_t->matchtwith|Valuev->fv|Thunkt->f(Lazy.forcet)letthunk_of_sexp:typeab.(Sexp.t->a)->(Sexp.t->b)->Sexp.t->(a,b)thunk=funf_s->Value(fs)letthunk_of_yojson:typeab.(Yojson.Safe.t->(a,string)Result.result)->(Yojson.Safe.t->(b,string)Result.result)->Yojson.Safe.t->((a,b)thunk,string)Result.result=funf_s->Result.map(funs->Values)(fs)letthunk_to_yojson:typeab.(a->Yojson.Safe.t)->(b->Yojson.Safe.t)->(a,b)thunk->Yojson.Safe.t=funf_t->matchtwith|Valuev->fv|Thunkt->f(Lazy.forcet)let_hash:typeab.(a->int)->(b->int)->(a,b)thunk->int=funf_t->matchtwith|Valuev->fv|Thunkt->f(Lazy.forcet)lethash_fold_thunk:typeab.(aPpx_hash_lib.Std.Hash.folder)->(bPpx_hash_lib.Std.Hash.folder)->(a,b)thunkPpx_hash_lib.Std.Hash.folder=funf_stt->matchtwith|Valuev->fstv|Thunkt->fst(Lazy.forcet)letcompare_thunk:typeab.(aPpx_compare_lib.compare)->(bPpx_compare_lib.compare)->(a,b)thunkPpx_compare_lib.compare=funf_t1t2->matcht1,t2with|Valuev1,Valuev2->fv1v2|Thunkt1,Valuev2->f(Lazy.forcet1)v2|Valuev1,Thunkt2->fv1(Lazy.forcet2)|Thunkt1,Thunkt2->f(Lazy.forcet1)(Lazy.forcet2)type('a,'b)t=[%import:('a,'b)DAst.t][@@derivingsexp,yojson,hash,compare]