“Pipe.to_list” mentioned in the paragraph below, can’t be found anywhere in the code examples in this section of the book? Maybe the code examples changed without also updating the corresponding text in the book, or the other way around? Thanks for clarifying!
Quoted text:
“In this case, the HTTP body probably isn’t very large, so we call Pipe.to_list to collect the strings from the pipe as a single deferred list of strings. We then join those strings using String.concat and pass the result through our parsing function.”
I think it’s referencing the example above, if you scroll up a bit, you should see the example as copied here
(* Execute the DuckDuckGo search *)
let get_definition word =
Cohttp_async.Client.get (query_uri word)
>>= fun (_, body) ->
Pipe.to_list body
>>| fun strings ->
(word, get_definition_from_json (String.concat strings))