caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Lwt idioms: iterating
@ 2013-01-23  5:02 Ivan Gotovchits
  2013-01-23 10:15 ` Raphael Proust
  0 siblings, 1 reply; 2+ messages in thread
From: Ivan Gotovchits @ 2013-01-23  5:02 UTC (permalink / raw)
  To: caml-list


What is a best practice to implement a common iterative operations with
Lwt?

For example, I have a data structure incapsulating some
collection. Interface of the structure includes some iterators, i.e.

  val iter (e -> unit) -> t -> unit

  
Now, I would like to output each element of type e using one of the
functions from Lwt_io module. 

I see two solutions and neither I like:

1. Use Buffer.t to accumulate text while iterating, then output it.

2. Use Lwt_stream.t for the same purpose.

Both solutions a rather imperative and too ad-hoc (not scales to other
iterators and tasks). 

Are there any idiomatic solutions for such common tasks in Lwt?

-- 
         (__) 
         (oo) 
   /------\/ 
  / |    ||   
 *  /\---/\ 
    ~~   ~~   
...."Have you mooed today?"...

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-23 10:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-23  5:02 [Caml-list] Lwt idioms: iterating Ivan Gotovchits
2013-01-23 10:15 ` Raphael Proust

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).