Task creation utilities for Lean's tactic monads. #
This file provides asTask and asTask' functions for various monads
(CoreM, MetaM, TermElabM, TacticM), which convert monadic computations
into tasks that run in parallel while preserving state.
Each asTask function returns:
- a cancellation hook and
- a
Taskcontaining a monadic value with the cached result and updated state
The asTask' variants omit the cancellation hook for convenience.
Note: Calling IO.cancel on t.map f does not cancel t,
so these functions are careful to construct cancellation hooks
connected to the underlying task rather than various maps of it.
Given a monadic value in CoreM, creates a task that runs it in the current state,
returning
- a cancellation hook and
- a monadic value with the cached result (and subsequent state as it was after running).
The task is run with a fresh CancelToken in its context, so it can detect cancellation
via Core.checkInterrupted. The cancellation hook sets this token.
Uses Core.wrapAsync internally to properly handle name generators and heartbeats.
Note: We only set the cancel token and don't call IO.cancel task. We're uncertain whether
IO.cancel is also necessary - it may be required for tasks that use IO.checkCanceled
instead of Core.checkInterrupted.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given a monadic value in CoreM, creates a task that runs it in the current state,
returning a monadic value with the cached result (and subsequent state as it was after running).
Instances For
Given a monadic value in MetaM, creates a task that runs it in the current state,
returning
- a cancellation hook and
- a monadic value with the cached result (and subsequent state as it was after running).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given a monadic value in MetaM, creates a task that runs it in the current state,
returning a monadic value with the cached result (and subsequent state as it was after running).
Instances For
Given a monadic value in TermElabM, creates a task that runs it in the current state,
returning
- a cancellation hook and
- a monadic value with the cached result (and subsequent state as it was after running).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given a monadic value in TermElabM, creates a task that runs it in the current state,
returning a monadic value with the cached result (and subsequent state as it was after running).
Instances For
Given a monadic value in TacticM, creates a task that runs it in the current state,
returning
- a cancellation hook and
- a monadic value with the cached result (and subsequent state as it was after running).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given a monadic value in TacticM, creates a task that runs it in the current state,
returning a monadic value with the cached result (and subsequent state as it was after running).