Open sir4ur0n opened 3 years ago
I haven't thought about it either, but the main difficulty is that the whole of Test
would have to live in a monad, I think (since running a test case and doing other things, like generating examples, shrinking, etc. are interleaved). A possibility is to make Test
a functor (or have a new Make_test
functor) parametrized over a monad + some primitives, and have the current Test
be an instance of that with the trivial monad type 'a m = 'a
.
In my current project, we sometimes want to run a QCheck test in an LWT context.
So far what we did was using
Lwt_main.run
inside the test to respect typechecking, e.g.:However there are various reasons why one does not want to
Lwt_main.run
inside each test:Note that rather than only providing an
Lwt
variant ofQCheck.Test.make
, maybe we can abstract away the execution context? This reminds me of "hoisting" in Servant (Haskell).I haven't put much thought into it yet but I think there is a good solution somewhere. What do you think? We may try to give it a shot in my project