Hi Gabriel, well thanks, I had forgotten this interesting approach by Daniel. Indeed for now I'd like to try a functor/first-class module -based solution. Thanks for the suggestion anyway! Cheers, ph. 2012/10/23 Gabriel Scherer > If you want to parametrize over arbitrary monads, the modularized > appraoch (using functors or first-class modules) is adapted. But note > that for more specialized needs different interfaces are possible. For > example, Daniel Bünzli experimented with explicit inversion of control > instead of parametrization by monadic library, to solve the problem of > being Lwt/Async/"event loop" agnostic: > > [Caml-list] Non-blocking IO interface design > https://sympa.inria.fr/sympa/arc/caml-list/2012-04/msg00055.html > > I'm not sure how this worked out in the end, but this may be worth > looking at if you're still at the general design step. > > On Tue, Oct 23, 2012 at 1:52 AM, Jeremy Yallop wrote: > > On 22 October 2012 23:09, Philippe Veber > wrote: > >> A couple of libraries, like pgocaml for instance, define a functor over > a > >> (monadic) thread implementation, like in the following: > >> > >> module type Thread = sig > >> type 'a t > >> val return : 'a -> 'a t > >> val bind : 'a t -> ('a -> 'b t) -> 'b t > >> end > >> > >> module F(T : Thread) : sig > >> val v : string -> string T.t > >> end > >> > >> Is it possible to define F as a function (ie at the value level)? > > > > Yes! Matías Giovannini has a blog post showing how to do just that: > > > > http://alaska-kamtchatka.blogspot.co.uk/2011/09/higher-order-fun.html > > > > -- > > Caml-list mailing list. Subscription management and archives: > > https://sympa.inria.fr/sympa/arc/caml-list > > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > > Bug reports: http://caml.inria.fr/bin/caml-bugs >