Tezt_mavryk.Runnable
Runnable values.
Values that come with functions to handle them.
This is intended mainly for use with 'a = Process.t
. Indeed, it is convenient to define functions that declare both how to spawn processes and how to read their output. Sometimes you want the output, sometimes you just want the Process.t
itself (e.g. to check its exit code). Instead of defining one function for each use case, you can define a single function that returns a runnable
, and use let*!
when you need the output value, or let*?
if you just need the process itself. There is no function to inject a value into the monad (return
), as there is no need for it.
For instance, let's say you have a function which runs git log
:
val git_log: unit -> (Process.t, string list) runnable
If you just want to check the exit code, use it like this:
let*? process : Process.t = git_log () in
Process.check process
If you just want to get its output, use it like this:
let*! log : string list = git_log () in
val run : ('a, 'b) t -> 'b Lwt.t
Apply the function of a runnable to its value.
Convert the output of a runnable to make another runnable.
type 'a process = (Tezt_wrapper.Process.t, 'a) t
Processes with associated run functions.
Typically, processes are associated to run functions that parse their output into values of type 'a
. See Base.runnable
for an example.
module Syntax : sig ... end
Part of the Runnable
module that is intended to be open
ed.