Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Pierre Chopin" <pierre.chopin@u-psud.fr>
To: caml-list@inria.fr
Subject: [Caml-list] pgocaml and lwt
Date: Sun, 30 Sep 2012 15:04:34 -0700	[thread overview]
Message-ID: <64d7146993183dc67fd675e7eb6f710f.squirrel@webmail.u-psud.fr> (raw)

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




             reply	other threads:[~2012-09-30 22:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-30 22:04 Pierre Chopin [this message]
2012-09-30 22:31 ` Sebastien Mondet
2012-09-30 22:37   ` Pierre Chopin

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=64d7146993183dc67fd675e7eb6f710f.squirrel@webmail.u-psud.fr \
    --to=pierre.chopin@u-psud.fr \
    --cc=caml-list@inria.fr \
    /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