Version française
Home     About     Download     Resources     Contact us    
Browse thread
Lwt try_bind question...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Stéphane Glondu <steph@g...>
Subject: Re: [Caml-list] Lwt try_bind question...
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