From: "Jérémie Dimino" <jeremie@dimino.org>
To: Mehdi Dogguy <mehdi@dogguy.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Lwt and exceptions
Date: Thu, 15 Sep 2011 14:09:36 +0200 [thread overview]
Message-ID: <1316088576.28210.8.camel@aurora> (raw)
In-Reply-To: <4E71CDB8.5020704@dogguy.org>
Le jeudi 15 septembre 2011 à 12:04 +0200, Mehdi Dogguy a écrit :
> I guess, not (and it has been answered already). In fact, I was wondering
> if Lwt's authors would be against adding a function like:
>
> let wrap f x = try Lwt.return (f x) with e -> Lwt.fail e
>
> It is stupid, trivial, etc… but looks what we need most of the time, no?
Yes, it seems useful. But should it be:
val wrap : ('a -> 'b) -> 'a -> 'b t
or:
val wrap : (unit -> 'a) -> 'a t
?
I would tend for the second solution because if you are wrapping a
function that takes multiple arguments you are going to write:
wrap (fun () -> f x y z) ()
anyway. Plus maybe wrap1, wrap2, ..., wrapn for a reasonable value of n.
--
Jérémie
next prev parent reply other threads:[~2011-09-15 12:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-13 18:37 rixed
2011-09-13 19:17 ` Anil Madhavapeddy
2011-09-14 16:15 ` rixed
2011-09-15 12:24 ` Jérémie Dimino
2011-09-15 10:04 ` Mehdi Dogguy
2011-09-15 10:35 ` Anil Madhavapeddy
2011-09-15 12:09 ` Jérémie Dimino [this message]
2011-09-15 12:33 ` Mehdi Dogguy
2011-09-15 12:22 ` Dmitry Grebeniuk
2011-09-15 13:10 ` Jérémie Dimino
2011-09-17 6:38 ` Dmitry Grebeniuk
2011-09-17 9:23 ` Stéphane Glondu
2011-09-17 10:20 ` Jérémie Dimino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1316088576.28210.8.camel@aurora \
--to=jeremie@dimino.org \
--cc=caml-list@inria.fr \
--cc=mehdi@dogguy.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox