Job Monad #
This module contains additional definitions for Lake Job.
In particular, it defines JobM, which uses BuildContext, which contains
OpaqueJobs, hence the module split.
The monad of asynchronous Lake jobs.
While this can be lifted into FetchM, job action should generally
be wrapped into an asynchronous job (e.g., via Job.async) instead of being
run directly in FetchM.
Equations
Instances For
Construct a FetchM monad from its full functional representation.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Convert a JobM monad to its full functional representation.
Equations
- self.toFn fetch pkg? stack store ctx s = Lake.EStateT.run s (Lake.EquipT.run self fetch pkg? stack store ctx)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
Equations
- Lake.instMonadLiftLogIOJobM = { monadLift := fun {α : Type} => Lake.ELogT.takeAndRun }
Record that this job is trying to perform some action.
Equations
Instances For
Returns the current job's build trace.
Equations
- Lake.getTrace = (fun (x : Lake.JobState) => x.trace) <$> get
Instances For
Sets the current job's build trace.
Equations
- Lake.setTrace trace = modify fun (s : Lake.JobState) => { log := s.log, action := s.action, trace := trace, buildTime := s.buildTime }
Instances For
Replace the job's build trace with a new empty trace.
Equations
- Lake.newTrace caption = Lake.setTrace (Lake.BuildTrace.nil caption)
Instances For
Mutates the job's trace, applying f to it.
Equations
- Lake.modifyTrace f = modify fun (s : Lake.JobState) => { log := s.log, action := s.action, trace := f s.trace, buildTime := s.buildTime }
Instances For
Set the caption of the job's build trace.
Equations
- Lake.setTraceCaption caption = Lake.modifyTrace fun (x : Lake.BuildTrace) => { caption := caption, inputs := x.inputs, hash := x.hash, mtime := x.mtime }
Instances For
Returns the current job's build trace and removes it from the state.
Equations
- Lake.takeTrace = modifyGet fun (s : Lake.JobState) => (s.trace, { log := s.log, action := s.action, trace := Lake.nilTrace, buildTime := s.buildTime })
Instances For
Sets the current job's trace and returns the previous one.
Equations
Instances For
Mix a trace into the current job's build trace.
Equations
- Lake.addTrace trace = Lake.modifyTrace fun (x : Lake.BuildTrace) => x.mix trace
Instances For
Runs x with a new trace and then mixes it into the original trace.
Equations
- Lake.addSubTrace caption x = do let oldTrace ← Lake.swapTrace (Lake.BuildTrace.nil caption) let a ← x Lake.modifyTrace fun (x : Lake.BuildTrace) => oldTrace.mix x pure a
Instances For
The monad used to spawn asynchronous Lake build jobs. Lifts into FetchM.
Equations
Instances For
Construct a SpawnM monad from its full functional representation.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Convert a SpawnM monad to its full functional representation.
Equations
- self.toFn fetch pkg? stack store ctx s = (Lake.EquipT.run self fetch pkg? stack store ctx).run s
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lake.instMonadLiftSpawnMJobM = { monadLift := fun {α : Type} => Lake.JobM.runSpawnM }
Equations
- Lake.instMonadLiftJobMFetchM = { monadLift := fun {α : Type} => Lake.FetchM.runJobM }
Equations
- Lake.instMonadLiftFetchMJobM = { monadLift := fun {α : Type} => Lake.JobM.runFetchM }
Equations
- Lake.Job.bindTask f self = do let __do_lift ← f self.task pure { task := __do_lift, kind := inferInstance, caption := self.caption, optional := self.optional }
Instances For
Spawn a job that asynchronously performs act.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Wait for a job to complete and return the produced value.
If an error occurred, return none and discarded any logs produced.
Equations
- self.wait? = do let __do_lift ← self.wait pure (Lake.EResult.result? __do_lift)
Instances For
Wait for a job to complete and return the produced value. Logs the job's log and throws if there was an error.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Apply f asynchronously to the job's output.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Apply f asynchronously to the job's output
and asynchronously await the resulting job.
Equations
- One or more equations did not get rendered due to their size.
Instances For
a.zipWith f b produces a new job c that applies f to the
results of a and b. The job c errors if either a or b error.
Equations
- One or more equations did not get rendered due to their size.
Instances For
a.zipWith f b produces a new job c that applies f to the
results of a and b. The job c errors if either a or b error.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Merge a List of jobs into one, discarding their outputs.
Equations
- Lake.Job.mixList jobs traceCaption = List.foldr (fun (x1 : Lake.Job α) (x2 : Lake.Job Unit) => x1.mix x2) (Lake.Job.traceRoot () traceCaption) jobs
Instances For
Merge an Array of jobs into one, discarding their outputs.
Equations
- Lake.Job.mixArray jobs traceCaption = Array.foldl (fun (x1 : Lake.Job Unit) (x2 : Lake.Job α) => x1.mix x2) (Lake.Job.traceRoot () traceCaption) jobs
Instances For
Merge a List of jobs into one, collecting their outputs into a List.
Equations
- Lake.Job.collectList jobs traceCaption = List.foldr (fun (self : Lake.Job α) (other : Lake.Job (List α)) => Lake.Job.zipWith List.cons self other) (Lake.Job.traceRoot [] traceCaption) jobs