From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id AB47A7ED7A for ; Mon, 1 Oct 2012 00:31:57 +0200 (CEST) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of sebastien.mondet@gmail.com) identity=pra; client-ip=209.85.220.182; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="sebastien.mondet@gmail.com"; x-sender="sebastien.mondet@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of sebastien.mondet@gmail.com designates 209.85.220.182 as permitted sender) identity=mailfrom; client-ip=209.85.220.182; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="sebastien.mondet@gmail.com"; x-sender="sebastien.mondet@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-vc0-f182.google.com) identity=helo; client-ip=209.85.220.182; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="sebastien.mondet@gmail.com"; x-sender="postmaster@mail-vc0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmABAOXGaFDRVdy2kWdsb2JhbABFhgumKIkeAYhcCCMBAQEBCQkNBxIpgiABAQEDARICDwQZARsSCwEDAQsGAwIEBxodAgIiAREBBQEKEgYTEhCHUAEDCQYLmz0JA4tWT4J1hAQKGScDClmIdQEFDIsThTmBEgOVaYEVjTcWKYQj X-IronPort-AV: E=Sophos;i="4.80,514,1344204000"; d="scan'208";a="157380591" Received: from mail-vc0-f182.google.com ([209.85.220.182]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 01 Oct 2012 00:31:56 +0200 Received: by vcbfw7 with SMTP id fw7so8949418vcb.27 for ; Sun, 30 Sep 2012 15:31:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=Iu/diINBlSyEEZKK+h5uO1vZgnhttiZu/AJPWEtaOSk=; b=zn/YsQj+ftmIA0y3knrYNRLzV2yg0ma4/ENFqcaT6BwwuNJr1/5x2WF4f24v0zTFU6 TU6H29vt9kWWUiWKToq2cy75UdY3HIHBXSJUzzWyNnFty0Ov20q6FEoPjcQXQch3qgt2 PPCD6FvrCmkViFYoGgy0Hl0u9E6tSgfVLMlOJ+DlCv+O0CI5uttmGMpn3KYc6f+V4OcI bvopvqO9BKs+QEViupL3CFW9yL9QtK/4DksLMxcUKZqWk2DWv/2fimCcqAZRGiPdWhci Rtz1ANxyVPJZr/LfyeqlITHsTqKS1gQ3SQ+GU9HFbCsE+Koi/nwJYKKbL5YXdpAmlQnl 4ERw== Received: by 10.52.93.238 with SMTP id cx14mr442655vdb.42.1349044315271; Sun, 30 Sep 2012 15:31:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.30.130 with HTTP; Sun, 30 Sep 2012 15:31:35 -0700 (PDT) In-Reply-To: <64d7146993183dc67fd675e7eb6f710f.squirrel@webmail.u-psud.fr> References: <64d7146993183dc67fd675e7eb6f710f.squirrel@webmail.u-psud.fr> From: Sebastien Mondet Date: Sun, 30 Sep 2012 18:31:35 -0400 Message-ID: To: Pierre Chopin Cc: caml-list@inria.fr Content-Type: multipart/alternative; boundary=20cf3071d09032b1db04caf2dbaf Subject: Re: [Caml-list] pgocaml and lwt --20cf3071d09032b1db04caf2dbaf Content-Type: text/plain; charset=UTF-8 Hi If I remember correctly, the syntax extension will use the module called PGOCaml which is "in scope", so you need to hide the "preemtive threads" one with yours: module PGOCaml = PGOCaml_generic.Make(Thread) Cheers Seb On Sun, Sep 30, 2012 at 6:04 PM, Pierre Chopin wrote: > Hi, > I am trying to use pgocaml and lwt, but I have some error I can't > understand: > > (**********************************************) > (**********************************************) > > > module Thread = > struct > open Lwt > open Lwt_io > type 'a t = 'a Lwt.t > let (>>=) = (>>=) > let return = return > let fail = fail > type in_channel = input_channel > type out_channel = output_channel > let open_connection addr = open_connection ~buffer_size:2097152 addr > let output_char = write_char > let output_binary_int = write_int > let output_string = write > let flush = flush > let input_char = read_char > let input_binary_int = read_int > let really_input =read_into_exactly > let close_in = close > end > > > module Lwt_db = PGOCaml_generic.Make(Thread) > open Lwt_db > > open Lwt > > let query_user dbh id = > PGSQL(dbh) "SELECT id,name,visited FROM user_db WHERE id=$id" > > let _ = > Lwt_main.run > (connect ~database:"schat" ()>|= > function dbh -> query_user dbh 1L) > > (**********************************************) > (**********************************************) > > when I try to compile : > > > $ ocamlfind ocamlc -thread -c -package lwt,pgocaml,pgocaml.syntax -syntax > camlp4o test.ml > > File "test.ml", line 34, characters 30-33: > Error: This expression has type > 'a Lwt_db.t = 'a PGOCaml_generic.Make(Thread).t > but an expression was expected of type > (string, bool) Hashtbl.t PGOCaml.t > > > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > --20cf3071d09032b1db04caf2dbaf Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi

If I remember correctly, the syntax extension will use the mo= dule called PGOCaml which is "in scope", so you need to hide the = "preemtive threads" one with yours:

module PGOCaml =3D PGO= Caml_generic.Make(Thread)


Cheers
Seb


On Sun, Sep 30,= 2012 at 6:04 PM, Pierre Chopin <pierre.chopin@u-psud.fr> wrote:
Hi,
I am trying to use pgocaml and lwt, but I have some error I can't under= stand:

(**********************************************)
(**********************************************)


module Thread =3D
struct
open Lwt
open Lwt_io
type 'a t =3D 'a Lwt.t
let (>>=3D) =3D (>>=3D)
let return =3D return
let fail =3D fail
type in_channel =3D input_channel
type out_channel =3D output_channel
let open_connection addr =3D open_connection ~buffer_size:2097152 addr
let output_char =3D write_char
let =C2=A0output_binary_int =3D =C2=A0write_int
let output_string =C2=A0=3D write
let flush =3D flush
let input_char =3D read_char
let input_binary_int =3D read_int
let really_input =3Dread_into_exactly
let close_in =3D close
end


module Lwt_db =3D PGOCaml_generic.Make(Thread)
open Lwt_db

open Lwt

let query_user dbh id =3D
PGSQL(dbh) "SELECT id,name,visited FROM user_db WHERE id=3D$id"
let _ =3D
=C2=A0 =C2=A0 Lwt_main.run
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (connect ~database:"schat" ()>|=3D=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 function dbh -> query_user dbh= 1L)

(**********************************************)
(**********************************************)

when I try to compile :


$ ocamlfind ocamlc -thread -c -package lwt,pgocaml,pgocaml.syntax -syntax camlp4o test.ml

File "test.ml", = line 34, characters 30-33:
Error: This expression has type
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0'a Lwt_db.t =3D 'a PGOCaml_generi= c.Make(Thread).t
=C2=A0 =C2=A0 =C2=A0 =C2=A0but an expression was expected of type
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(string, bool) Hashtbl.t PGOCaml.t




--
Caml-list mailing list. =C2=A0Subscription management and archives:
ht= tps://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

--20cf3071d09032b1db04caf2dbaf--