caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Stéphane Glondu" <steph@glondu.net>
To: Tim Hanson <sideskate@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Lwt try_bind question...
Date: Tue, 03 Nov 2009 08:46:45 +0100	[thread overview]
Message-ID: <4AEFDFE5.2030004@glondu.net> (raw)
In-Reply-To: <9d2084740911022107g3ea468c3xa5b34a38258dfd40@mail.gmail.com>

Tim Hanson a écrit :
> I've been trying to use Lwt in my application (robot control). [...]

Hummm... How familiar :-)

> I compile with the following line:
> ocamlfind ocamlc -c -package lwt,lwt.unix,lwt.syntax -syntax camlp4o relay.ml

Try instead:

ocamlfind ocamlc -c -package lwt,lwt.unix,lwt.syntax -syntax camlp4o
-syntax lwt.syntax toto.ml

Or just:

ocamlfind ocamlc -c -package lwt,lwt.unix toto.ml

If you don't use Lwt's syntax extensions. But there is a type error in
your code:

> 			try_bind
> 				(fun () -> (Lwt_unix.read banger_socket buffer 0 512))
> 				(fun n -> read_banger n )
> 				(fun _ -> (Lwt_unix.sleep 3.0) >>= read_banger 0 )

It should be ">>= fun () -> read_banger 0" (in plain OCaml), or ">>
read_banger 0" (with the camlp4 extension).


Cheers,

-- 
Stéphane


      reply	other threads:[~2009-11-03  7:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-03  5:07 Tim Hanson
2009-11-03  7:46 ` Stéphane Glondu [this message]

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=4AEFDFE5.2030004@glondu.net \
    --to=steph@glondu.net \
    --cc=caml-list@inria.fr \
    --cc=sideskate@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).