Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* [Caml-list] Functorising over Cohttp's backends
@ 2016-08-29 13:53 Dario Teixeira
  2016-08-29 15:39 ` Rudi Grinberg
  0 siblings, 1 reply; 5+ messages in thread
From: Dario Teixeira @ 2016-08-29 13:53 UTC (permalink / raw)
  To: caml-list

Hi,

Suppose I have a function "make_callback" which creates a callback
ready to be given to Cohttp's Server.make. Here's its signature:

  type callback =
    Cohttp_lwt_unix.Server.IO.conn * Cohttp.Connection.t ->
    Cohttp.Request.t ->
    Cohttp_lwt_body.t ->
    (Cohttp.Response.t * Cohttp_lwt_body.t) Cohttp_lwt_unix.Server.IO.t

  val make_callback: unit -> callback

Note that it's tied to the Lwt+Unix instantiation of Cohttp. Now,
I wish to make it more generic, so it can be used with the Async
backend, for instance.

There's more to it than just using a functor for abstracting over the
IO monad, unfortunately. In particular, the connection type and the
body are also backend-dependent. Anyway, Cohttp's API is notoriously
hard to navigate. Is the generic signature I'm looking for already
defined somewhere, or are the backends so distinct that I might
as well forget about functorising the interface and thus force the
Lwt+Unix backend on my API? (It's the only backend I use myself...)

Thanks in advance!
Best regards,
Dario Teixeira


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-30  9:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-29 13:53 [Caml-list] Functorising over Cohttp's backends Dario Teixeira
2016-08-29 15:39 ` Rudi Grinberg
2016-08-29 18:42   ` Dario Teixeira
2016-08-29 21:51     ` Daniel Bünzli
2016-08-30  9:08       ` Malcolm Matalka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox