Problem using ocaml packages


#1

Any help with this greatly appreciated. I’m trying to get some basic reason webserver code working - I’ve tried various versions of ocaml and am using the latest reason 3.0.4. My code looks like this:

open Cohttp_lwt_unix;

let callback = (_conn, req, body) => {
  let uri = req |> Request.uri |> Uri.to_string;
  let meth = req |> Request.meth |> Code.string_of_method;
  let headers = req |> Request.headers |> Header.to_string;
  body
  |> Cohttp_lwt_body.to_string
  |>...```
  
And my jbuild is :

```(jbuild_version 1)

(executable
 ((name test)
  (libraries (lwt cohttp cohttp-lwt cohttp-lwt-unix))))

But when I compile using jbuilder I get:

Error: Unbound module Cohttp_lwt_body

I’ve tried other libs (e.g Opium), but again, a reference to Opium_misc causes a similar “unbound module” problem. I’m not sure what I’m missing / misunderstanding, or whether it is something to do with modules suffixed with a “_” or whether it is likely to do with the packages that I’m trying to use?


#2

…just got response on discord - to do with my poor understanding of reason - should be Cohttp_lwt.Body.to_string