Eio.Flow.copy
has type #Flow.source -> #Flow.sink -> unit
.
Since you’re using socket
for both arguments, OCaml infers that socket
must be both a source
and a sink
in this case. Since it doesn’t know a specific name for that type, it just lists the operations such a socket must support.
You could help it out by annotating the type, e.g.
let handler (socket : #Eio.Flow.two_way) _addr =
This is a slightly stronger requirement (a two_way
also supports shutdown
), but then it would simply report the type using that name.
At least in Vim, asking Merlin for the type twice in a row gives the expanded version in all cases.
Cstruct is discussed at Decide on cstruct vs bytes · Issue #140 · ocaml-multicore/eio · GitHub.