Type error: `Eof isn't the same as `Eof ?
| Newsgroups | gmane.comp.lang.ocaml.beginners |
|---|---|
| Message-ID | <[email protected]> |
I have this code that tries to log the output of a pipe:
Async.Std.print_string (match (Async.Std.Pipe.read r) with
| `Eof -> "an empty string"
| `Ok text -> text)
However, I get this type error when compiling:
File "hello_world.ml", line 57, characters 29-33:
Error: This pattern matches values of type [? `Eof ]
but a pattern was expected which matches values of type
[ `Eof | `Ok of string ] Async_conduit.io
Should I qualify these `Eof and `Ok somehow?
What I am trying to do is to log the content of the body of a POST request. The body content is to be salvaged through a pipe.
The full code can be seen here:
https://github.com/loldrup/ocaml-cohttp/blob/master/examples/async/hello_world.ml https://github.com/loldrup/ocaml-cohttp/blob/master/examples/async/hello_world.ml