12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061(************************************************************************)(* * 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 *)(************************************************************************)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.t)->(Yojson.Safe.t->(b,string)Result.t)->Yojson.Safe.t->((a,b)thunk,string)Result.t=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]