12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2020 Nomadic Labs <contact@nomadic-labs.com> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)moduleMake(Monad:Traced_sigs.Monad.S)(Seq_e:Traced_sigs.Seq_e.S)(Seq_s:Traced_sigs.Seq_s.Swithtype'errortrace:='errorMonad.trace):Traced_sigs.Seq_es.Swithtype('a,'e)node=('a,'e)Bare_structs.Seq_es.nodeandtype('a,'e)t=('a,'e)Bare_structs.Seq_es.tandtype('a,'e)seq_e_t:=('a,'e)Seq_e.tandtype'aseq_s_t:='aSeq_s.t=structincludeBare_structs.Seq_esletnil_es=Lwt.return(OkNil)letrecof_seqeseq()=matchseq()with|OkSeq_e.Nil->nil_es|Ok(Seq_e.Cons(item,seq))->Lwt.return_ok(Cons(item,of_seqeseq))|Error_ase->Lwt.returneletrecof_seqsseq()=Lwt.bind(seq())@@function|Seq_s.Nil->nil_es|Seq_s.Cons(e,seq)->Lwt.return_ok(Cons(e,of_seqsseq))end