structure Lean.LazyInitExtension (m : TypeType) (α : Type) :
Instances For
    instance Lean.instInhabitedLazyInitExtension {m : TypeType} {α : Type} [inst : Monad m] [inst : Inhabited α] :
    • Lean.instInhabitedLazyInitExtension = { default := { ext := default, fn := pure default } }
    def Lean.registerLazyInitExtension {m : TypeType} {α : Type} (fn : m α) :

    Register an environment extension for storing the result of fn. We initialize the extension with none, and fn is executed the first time LazyInit.get is executed.

    This kind of extension is useful for avoiding work duplication in scenarios where a thunk cannot be used because the computation depends on state from the m monad. For example, we may want to "cache" a collection of theorems as a SimpLemmas object.

    def Lean.LazyInitExtension.get {m : TypeType} {α : Type} [inst : Lean.MonadEnv m] [inst : Monad m] (init : Lean.LazyInitExtension m α) :
    m α
    • One or more equations did not get rendered due to their size.