caml-list - the Caml user's mailing list
 help / Atom feed
* [Caml-list] How is this type inferred?
@ 2019-02-21  9:23 Malcolm Matalka
  0 siblings, 0 replies; 1+ messages 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] 1+ messages in thread

only message in thread, back to index

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

caml-list - the Caml user's mailing list

Archives are clonable: git clone --mirror https://inbox.ocaml.org/caml-list

AGPL code for this site: git clone https://public-inbox.org/ public-inbox