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
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
- Lake.updateAction action = modify fun (s : Lake.JobState) => { log := s.log, action := s.action.merge action, trace := s.trace }
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 }
Instances For
Set the caption of the job's build trace.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Replace the job's build trace with a new empty trace.
Equations
- Lake.newTrace caption = modify fun (s : Lake.JobState) => { log := s.log, action := s.action, trace := Lake.BuildTrace.nil caption }
Instances For
Mix a trace into the current job's build trace.
Equations
- Lake.addTrace trace = modify fun (s : Lake.JobState) => { log := s.log, action := s.action, trace := s.trace.mix trace }
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 })
Instances For
The monad used to spawn asynchronous Lake build jobs. Lifts into FetchM.
Equations
Instances For
Equations
- Lake.JobM.runSpawnM x fn stack store ctx s = do let __do_lift ← x fn stack store ctx s.trace pure (Lake.EResult.ok __do_lift s)
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
- Lake.Job.async act prio caption fetch stack store ctx = (fun (task : Lake.JobTask α) => Lake.Job.ofTask task caption) <$> liftM ((Lake.withLoggedIO act fetch stack store ctx { }).asTask prio)
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
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
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
Instances For
BuildJob (deprecated) #
A Lake build job.
Equations
- Lake.BuildJob α = Lake.Job α
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lake.BuildJob.ofJob job = Lake.Job.mapOk (fun (trace : Lake.BuildTrace) (s : Lake.JobState) => Lake.EResult.ok () { log := s.log, action := s.action, trace := trace }) job
Instances For
Equations
Instances For
Equations
Instances For
Equations
- Lake.BuildJob.instPure = { pure := fun {α : Type ?u.5} (a : α) => Lake.Job.pure a }
Equations
- Lake.BuildJob.map f self = Lake.Job.map f self.toJob
Instances For
Equations
- Lake.BuildJob.instFunctor = { map := fun {α β : Type ?u.12} (f : α → β) (self : Lake.Job α) => Lake.Job.map f self }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
- Lake.BuildJob.mixList jobs = pure (Lake.Job.mixList jobs)
Instances For
Equations
- Lake.BuildJob.mixArray jobs = pure (Lake.Job.mixArray jobs)
Instances For
Equations
- Lake.BuildJob.zipWith f self other = Lake.Job.zipWith f self.toJob other.toJob
Instances For
Equations
- Lake.BuildJob.collectList jobs = pure (Lake.Job.collectList jobs)
Instances For
Equations
- Lake.BuildJob.collectArray jobs = pure (Lake.Job.collectArray jobs)