123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2021 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. *)(* *)(*****************************************************************************)(** The [S] signature is similar to {!Seq.S} except that suspended nodes are
wrapped in a result-Lwt.
This allows some additional traversors ([ES.map], etc.) to be applied
lazily.
The functions [of_seq] and [of_seq_*] allow conversion from vanilla
sequences. *)moduletypeS=sigtype('a,'e)seq_e_t(* For substitution by [Seq_e.t] *)type'aseq_s_t(* For substitution by [Seq_s.t] *)(** This is similar to {!Seq.S}[.t] but the suspended node is a promised
result.
Similarly to [Seq_e], sequences of this module can be interrupted by an
error. In this case, traversal has fully applied to the successful prefix
before the returned promise evaluates to [Error _].
*)type(+'a,'e)node=Nil|Consof'a*('a,'e)tand('a,'e)t=unit->(('a,'e)node,'e)resultLwt.tincludeSeqes.Sigs.SEQMON2ALLwithtype('a,'e)mon:=('a,'e)resultLwt.twithtype('a,'e)t:=('a,'e)tmoduleE:Seqes.Sigs.SEQMON2TRANSFORMERSwithtype('a,'e)mon:=('a,'e)resultLwt.twithtype('a,'e)callermon:=('a,'e)resultwithtype('a,'e)t:=('a,'e)tmoduleS:Seqes.Sigs.SEQMON2TRANSFORMERSwithtype('a,'e)mon:=('a,'e)resultLwt.twithtype('a,'e)callermon:='aLwt.twithtype('a,'e)t:=('a,'e)tmoduleES:Seqes.Sigs.SEQMON2TRANSFORMERSwithtype('a,'e)mon:=('a,'e)resultLwt.twithtype('a,'e)callermon:=('a,'e)resultLwt.twithtype('a,'e)t:=('a,'e)tvalcons_s:'aLwt.t->('a,'e)t->('a,'e)tvalcons_e:('a,'e)result->('a,'e)t->('a,'e)tvalcons_es:('a,'e)resultLwt.t->('a,'e)t->('a,'e)tvalreturn_e:('a,'e)result->('a,'e)tvalreturn_s:'aLwt.t->('a,'e)tvalreturn_es:('a,'e)resultLwt.t->('a,'e)tvalinterrupted:'e->('a,'e)tvalinterrupted_s:'eLwt.t->('a,'e)tvalmap_error:('e->'f)->('a,'e)t->('a,'f)tvalmap_error_s:('e->'fLwt.t)->('a,'e)t->('a,'f)tvaltake:when_negative_length:'err->int->('a,'e)t->(('a,'e)t,'err)resultvaldrop:when_negative_length:'err->int->('a,'e)t->(('a,'e)t,'err)resultvalof_seq:'aStdlib.Seq.t->('a,'e)tvalof_seq_s:'aLwt.tStdlib.Seq.t->('a,'e)tvalof_seqs:'aseq_s_t->('a,'e)tvalof_seq_e:('a,'e)resultStdlib.Seq.t->('a,'e)tvalof_seqe:('a,'e)seq_e_t->('a,'e)tvalof_seq_es:('a,'e)resultLwt.tStdlib.Seq.t->('a,'e)tend