Documentation

Lean.Util.MonadCache

class Lean.MonadCache (α : Type) (β : Type) (m : TypeType) :
  • findCached? : αm (Option β)
  • cache : αβm Unit

Interface for caching results.

Instances
    @[inline]
    def Lean.checkCache {α : Type} {β : Type} {m : TypeType} [Lean.MonadCache α β m] [Monad m] (a : α) (f : Unitm β) :
    m β

    If entry a := b is already in the cache, then return b. Otherwise, execute b ← f (), store a := b in the cache and return b.

    Instances For
      instance Lean.instMonadCacheReaderT {α : Type} {β : Type} {ρ : Type} {m : TypeType} [Lean.MonadCache α β m] :
      @[always_inline]
      instance Lean.instMonadCacheExceptT {α : Type} {β : Type} {ε : Type} {m : TypeType} [Lean.MonadCache α β m] [Monad m] :
      class Lean.MonadHashMapCacheAdapter (α : Type) (β : Type) (m : TypeType) [BEq α] [Hashable α] :

      Adapter for implementing MonadCache interface using HashMaps. We just have to specify how to extract/modify the HashMap.

      Instances
        @[inline]
        def Lean.MonadHashMapCacheAdapter.findCached? {α : Type} {β : Type} {m : TypeType} [BEq α] [Hashable α] [Monad m] [Lean.MonadHashMapCacheAdapter α β m] (a : α) :
        m (Option β)
        Instances For
          @[inline]
          def Lean.MonadHashMapCacheAdapter.cache {α : Type} {β : Type} {m : TypeType} [BEq α] [Hashable α] [Lean.MonadHashMapCacheAdapter α β m] (a : α) (b : β) :
          Instances For
            def Lean.MonadCacheT {ω : Type} (α : Type) (β : Type) (m : TypeType) [STWorld ω m] [BEq α] [Hashable α] (α : Type) :
            Instances For
              @[inline]
              def Lean.MonadCacheT.run {ω : Type} {α : Type} {β : Type} {m : TypeType} [STWorld ω m] [BEq α] [Hashable α] [MonadLiftT (ST ω) m] [Monad m] {σ : Type} (x : Lean.MonadCacheT α β m σ) :
              m σ
              Instances For
                instance Lean.MonadCacheT.instMonadMonadCacheT {ω : Type} {α : Type} {β : Type} {m : TypeType} [STWorld ω m] [BEq α] [Hashable α] [Monad m] :
                instance Lean.MonadCacheT.instMonadLiftMonadCacheT {ω : Type} {α : Type} {β : Type} {m : TypeType} [STWorld ω m] [BEq α] [Hashable α] :
                instance Lean.MonadCacheT.instMonadExceptOfMonadCacheT {ω : Type} {α : Type} {β : Type} {m : TypeType} [STWorld ω m] [BEq α] [Hashable α] (ε : Type u_1) [MonadExceptOf ε m] :
                instance Lean.MonadCacheT.instMonadControlMonadCacheT {ω : Type} {α : Type} {β : Type} {m : TypeType} [STWorld ω m] [BEq α] [Hashable α] :
                instance Lean.MonadCacheT.instMonadRefMonadCacheT {ω : Type} {α : Type} {β : Type} {m : TypeType} [STWorld ω m] [BEq α] [Hashable α] [Monad m] [Lean.MonadRef m] :
                instance Lean.MonadCacheT.instAlternativeMonadCacheT {ω : Type} {α : Type} {β : Type} {m : TypeType} [STWorld ω m] [BEq α] [Hashable α] [Monad m] [Alternative m] :
                def Lean.MonadStateCacheT (α : Type) (β : Type) (m : TypeType) [BEq α] [Hashable α] (α : Type) :
                Instances For
                  @[inline]
                  def Lean.MonadStateCacheT.run {α : Type} {β : Type} {m : TypeType} [BEq α] [Hashable α] [Monad m] {σ : Type} (x : Lean.MonadStateCacheT α β m σ) :
                  m σ
                  Instances For