jon.recoil.org

Module Job.OpSource

Open type and add combinators. Meant to be opened

Sourcetype 'a job =
  1. | Done of 'a
  2. | Run of OpamProcess.command * OpamProcess.result -> 'a OpamProcess.Job.Op.job

Stage a shell command with its continuation, eg:

  command "ls" ["-a"] @@> fun result ->
  if OpamProcess.is_success result then Done result.r_stdout
  else failwith "ls"

job1 @@+ fun r -> job2 appends the computation of tasks in job2 after job1

Sourceval (@@|) : 'a OpamProcess.Job.Op.job -> ('a -> 'b) -> 'b OpamProcess.Job.Op.job

job @@| f maps f on the results of job. Equivalent to job @@+ fun r -> Done (f r)