Ocaml record syntax (beginner question)

Hello there,
I am a Ocaml beginner coming from languages like C and Java and I have a question on a bit of
Ocaml code that I found on GitHub - mirage/ocaml-cohttp: An OCaml library for HTTP clients and servers using Lwt or Async and which I don’t quite understand.
I hope, this isn’t going to be too embarrassing.

I found this code example in section " Basic Server Tutorial":

let tcp_config =
{
Conduit_lwt.TCP.sockaddr = Unix.ADDR_INET (Unix.inet_addr_loopback, 8000);
capacity = 40;
}
in …

from my limited understanding, this looks like a definition of a variable of some record type.
What confuses me is the part
Conduit_lwt.TCP.sockaddr = …
This does not seem to be a field name of this record, but something else.
Can anyone enlighten me, what this is about?
I don’t necessarily want to know about the cohttp library, I’m just wondering how to parse this syntax.
Thank you!

1 Like

It’s specifying that the record type comes from the module Conduit_lwt.TCP; see the “Reusing Field Names” section here for more.

1 Like

Thank you, that was it.