From: Malcolm Matalka <mmatalka@gmail.com>
To: caml users <caml-list@inria.fr>
Subject: [Caml-list] How is this type inferred?
Date: Thu, 21 Feb 2019 10:23:00 +0100 [thread overview]
Message-ID: <86o975a423.fsf@gmail.com> (raw)
I wrote a typed SQL interface where the usage is something like:
let sql = TS.(sql / "SELECT foo FROM bar WHERE x =" /% Var.int /^ "AND"
/% Var.string)
And then one can gets a value back of type:
(int -> string -> '_weak4, '_weak4) Sqlite_io.Typed_sql.t
And the type of all of that is:
type ('f, 'r) t
val sql : ('r, 'r) t
val (/^) : ('f, 'r) t -> string -> ('f, 'r) t
val (/%) : ('f, 'a -> 'r) t -> 'a Var.t -> ('f, 'r) t
My question is:
How is the type of 'f inferred in there? I managed to get this working
by cobbling together a bunch of things I didn't quite understand and now
I'm trying to figure it out.
Thanks,
/Malcolm
reply other threads:[~2019-02-21 9:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=86o975a423.fsf@gmail.com \
--to=mmatalka@gmail.com \
--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