caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] How is this type inferred?
@ 2019-02-21  9:23 Malcolm Matalka
  0 siblings, 0 replies; only message in thread
From: Malcolm Matalka @ 2019-02-21  9:23 UTC (permalink / raw)
  To: caml users

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-02-21  9:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-21  9:23 [Caml-list] How is this type inferred? Malcolm Matalka

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).