Equations
- Lean.Core.getMaxHeartbeats opts = Lean.Option.get opts Lean.Core.maxHeartbeats * 1000
@[inline]
- instLevelType : Lean.Core.InstantiateLevelCache
- instLevelValue : Lean.Core.InstantiateLevelCache
Equations
- Lean.Core.instInhabitedCache = { default := { instLevelType := default, instLevelValue := default } }
- env : Lean.Environment
- nextMacroScope : Lean.MacroScope
- ngen : Lean.NameGenerator
- traceState : Lean.TraceState
- cache : Lean.Core.Cache
- messages : Lean.MessageLog
State for the CoreM monad.
Equations
- Lean.Core.instInhabitedState = { default := { env := default, nextMacroScope := default, ngen := default, traceState := default, cache := default, messages := default } }
- fileName : String
- fileMap : Lean.FileMap
- options : Lean.Options
- currRecDepth : Nat
- maxRecDepth : Nat
- ref : Lean.Syntax
- currNamespace : Lean.Name
- openDecls : List Lean.OpenDecl
- initHeartbeats : Nat
- maxHeartbeats : Nat
- currMacroScope : Lean.MacroScope
Context for the CoreM monad.
@[inline]
CoreM is a monad for manipulating the Lean environment.
It is the base monad for MetaM
.
The main features it provides are:
- name generator state
- environment state
- Lean options context
- the current open namespace
Equations
- Lean.Core.instMonadCoreM = let i := inferInstanceAs (Monad Lean.CoreM); Monad.mk
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.Core.instMonadOptionsCoreM = { getOptions := do let a ← read pure a.options }
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.Core.instAddMessageContextCoreM = { addMessageContext := Lean.addMessageContextPartial }
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.Core.instMonadResolveNameCoreM = { getCurrNamespace := do let a ← read pure a.currNamespace, getOpenDecls := do let a ← read pure a.openDecls }
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
@[inline]
Equations
- One or more equations did not get rendered due to their size.
@[inline]
def
Lean.Core.modifyInstLevelTypeCache
(f : Lean.Core.InstantiateLevelCache → Lean.Core.InstantiateLevelCache)
:
Equations
- Lean.Core.modifyInstLevelTypeCache f = Lean.Core.modifyCache fun x => match x with | { instLevelType := c₁, instLevelValue := c₂ } => { instLevelType := f c₁, instLevelValue := c₂ }
@[inline]
def
Lean.Core.modifyInstLevelValueCache
(f : Lean.Core.InstantiateLevelCache → Lean.Core.InstantiateLevelCache)
:
Equations
- Lean.Core.modifyInstLevelValueCache f = Lean.Core.modifyCache fun x => match x with | { instLevelType := c₁, instLevelValue := c₂ } => { instLevelType := c₁, instLevelValue := f c₂ }
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
@[inline]
Equations
- Lean.Core.liftIOCore x = do let ref ← Lean.getRef liftM (IO.toEIO (fun err => Lean.Exception.error ref (Function.comp Lean.MessageData.ofFormat Lean.format (toString err))) x)
Equations
- Lean.Core.instMonadLiftIOCoreM = { monadLift := fun {α} => Lean.Core.liftIOCore }
Equations
- One or more equations did not get rendered due to their size.
Restore backtrackable parts of the state.
Equations
- Lean.Core.restore b = modify fun s => { env := b.env, nextMacroScope := s.nextMacroScope, ngen := s.ngen, traceState := s.traceState, cache := s.cache, messages := b.messages }
Equations
@[inline]
def
Lean.Core.CoreM.run
{α : Type}
(x : Lean.CoreM α)
(ctx : Lean.Core.Context)
(s : Lean.Core.State)
:
Equations
- Lean.Core.CoreM.run x ctx s = StateRefT'.run (x ctx) s
@[inline]
def
Lean.Core.CoreM.run'
{α : Type}
(x : Lean.CoreM α)
(ctx : Lean.Core.Context)
(s : Lean.Core.State)
:
Equations
- Lean.Core.CoreM.run' x ctx s = Prod.fst <$> Lean.Core.CoreM.run x ctx s
@[inline]
def
Lean.Core.CoreM.toIO
{α : Type}
(x : Lean.CoreM α)
(ctx : Lean.Core.Context)
(s : Lean.Core.State)
:
IO (α × Lean.Core.State)
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
def
Lean.Core.withIncRecDepth
{m : Type → Type u_1}
{α : Type}
[inst : Monad m]
[inst : MonadControlT Lean.CoreM m]
(x : m α)
:
m α
Equations
- Lean.Core.withIncRecDepth x = controlAt Lean.CoreM fun runInBase => Lean.withIncRecDepth (runInBase x)
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.checkMaxHeartbeats moduleName = do let a ← read Lean.Core.checkMaxHeartbeatsCore moduleName `maxHeartbeats a.maxHeartbeats
def
Lean.Core.withCurrHeartbeats
{m : Type → Type u_1}
{α : Type}
[inst : Monad m]
[inst : MonadControlT Lean.CoreM m]
(x : m α)
:
m α
Equations
- Lean.withCurrHeartbeats x = controlAt Lean.CoreM fun runInBase => Lean.Core.withCurrHeartbeatsImp (runInBase x)
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.Core.getMessageLog = do let a ← get pure a.messages
Equations
- One or more equations did not get rendered due to their size.
@[inline]
def
Lean.catchInternalId
{m : Type u_1 → Type u_2}
{α : Type u_1}
[inst : Monad m]
[inst : MonadExcept Lean.Exception m]
(id : Lean.InternalExceptionId)
(x : m α)
(h : Lean.Exception → m α)
:
m α
Equations
- One or more equations did not get rendered due to their size.
@[inline]
def
Lean.catchInternalIds
{m : Type u_1 → Type u_2}
{α : Type u_1}
[inst : Monad m]
[inst : MonadExcept Lean.Exception m]
(ids : List Lean.InternalExceptionId)
(x : m α)
(h : Lean.Exception → m α)
:
m α
Equations
- One or more equations did not get rendered due to their size.
Return true if ex
was generated by throwMaxHeartbeat
.
This function is a bit hackish. The heartbeat exception should probably be an internal exception.
We used a similar hack at Exception.isMaxRecDepth
Equations
- One or more equations did not get rendered due to their size.