File: .lake/packages/lean4/src/lean/lake/Lake/Util/Cycle.lean

full_name: Lake.CallStack
code: /-- A sequence of calls donated by the key type `κ`. -/
abbrev CallStack κ 
goal: Type u_1

full_name: Lake.Cycle
code: /-- A `CallStack` ending in a cycle. -/
abbrev Cycle κ 
goal: Type u_1

full_name: Lake.MonadCallStackOf
code: /-- A monad equipped with a call stack. -/
class MonadCallStackOf (κ :  semiOutParam (Type u)) (m : Type u → Type v) where
  getCallStack : m (CallStack κ)
  withCallStack (stack : CallStack κ) (x : m α) : m α
goal: Type (max (u + 1) v)

full_name: Lake.MonadCallStackOf.getCallStack
code: /-- A monad equipped with a call stack. -/
class MonadCallStackOf (κ :  semiOutParam (Type u)) (m : Type u → Type v) where
  getCallStack : m (CallStack κ)
  withCallStack (stack : CallStack κ) (x : m α) : m α
goal: m (Lake.CallStack κ)

full_name: Lake.MonadCallStackOf.withCallStack
code: /-- A monad equipped with a call stack. -/
class MonadCallStackOf (κ :  semiOutParam (Type u)) (m : Type u → Type v) where
  getCallStack : m (CallStack κ)
  withCallStack (stack : CallStack κ) (x : m α) : m α
goal: m α

full_name: Lake.MonadCallStack
code: /-- Similar to `MonadCallStackOf`, but `κ` is an `outParam` for convenience. -/
class MonadCallStack (κ :  outParam (Type u)) (m : Type u → Type v) where
  getCallStack : m (CallStack κ)
  withCallStack (stack : CallStack κ) (x : m α) : m α
goal: Type (max (u + 1) v)

full_name: Lake.MonadCallStack.withCallStack
code: /-- Similar to `MonadCallStackOf`, but `κ` is an `outParam` for convenience. -/
class MonadCallStack (κ :  outParam (Type u)) (m : Type u → Type v) where
  getCallStack : m (CallStack κ)
  withCallStack (stack : CallStack κ) (x : m α) : m α
goal: m α

full_name: Lake.MonadCallStack.getCallStack
code: /-- Similar to `MonadCallStackOf`, but `κ` is an `outParam` for convenience. -/
class MonadCallStack (κ :  outParam (Type u)) (m : Type u → Type v) where
  getCallStack : m (CallStack κ)
  withCallStack (stack : CallStack κ) (x : m α) : m α
goal: m (Lake.CallStack κ)

full_name: Lake.instMonadCallStackOfMonadCallStackOf
code: instance [MonadCallStackOf κ m] : MonadCallStack κ m 
goal: Lake.MonadCallStack κ m

full_name: Lake.instMonadCallStackOfOfMonadLiftOfMonadFunctor
code: instance [MonadLift m n] [MonadFunctor m n] [MonadCallStackOf κ m] : MonadCallStackOf κ n 
goal: Lake.MonadCallStackOf κ n

full_name: Lake.MonadCycleOf.throwCycle
code: /-- A monad equipped with a call stack and the ability to error on a cycle. -/
class MonadCycleOf (κ :  semiOutParam (Type u)) (m : Type u → Type v) extends MonadCallStackOf κ m where
  throwCycle (cycle : Cycle κ) : m α
goal: m α

full_name: Lake.MonadCycleOf
code: /-- A monad equipped with a call stack and the ability to error on a cycle. -/
class MonadCycleOf (κ :  semiOutParam (Type u)) (m : Type u → Type v) extends MonadCallStackOf κ m where
  throwCycle (cycle : Cycle κ) : m α
goal: Type (max (u + 1) v)

full_name: Lake.MonadCycle
code: /-- Similar to `MonadCycle`, but `κ` is an `outParam` for convenience. -/
class MonadCycle (κ :  outParam (Type u)) (m : Type u → Type v) extends MonadCallStack κ m where
  throwCycle (cycle : Cycle κ) : m α
goal: Type (max (u + 1) v)

full_name: Lake.MonadCycle.throwCycle
code: /-- Similar to `MonadCycle`, but `κ` is an `outParam` for convenience. -/
class MonadCycle (κ :  outParam (Type u)) (m : Type u → Type v) extends MonadCallStack κ m where
  throwCycle (cycle : Cycle κ) : m α
goal: m α

full_name: Lake.instMonadCycleOfMonadCycleOf
code: instance [MonadCycleOf κ m] : MonadCycle κ m 
goal: Lake.MonadCycle κ m

full_name: Lake.instMonadCycleOfOfMonadLiftOfMonadFunctor
code: instance [MonadLift m n] [MonadFunctor m n] [MonadCycleOf κ m] : MonadCycleOf κ n 
goal: Lake.MonadCycleOf κ n

full_name: Lake.inhabitedOfMonadCycle
code: instance inhabitedOfMonadCycle [MonadCycle κ m] : Inhabited (m α) 
goal: Inhabited (m α)

full_name: Lake.CallStackT
code: /-- A transformer that equips a monad with a `CallStack`. -/
abbrev CallStackT κ m 
goal: Type (max u_1 u_2)

full_name: Lake.instMonadCallStackOfCallStackTOfMonad
code: instance [Monad m] : MonadCallStackOf κ (CallStackT κ m) 
goal: Lake.MonadCallStackOf κ (Lake.CallStackT κ m)

full_name: Lake.CycleT
code: /-- A transformer that equips a monad with a `CallStack` to detect cycles. -/
abbrev CycleT κ m 
goal: Type (max u_1 u_2)

full_name: Lake.instMonadCycleOfCycleTOfMonad
code: instance [Monad m] : MonadCycleOf κ (CycleT κ m) 
goal: Lake.MonadCycleOf κ (Lake.CycleT κ m)

full_name: Lake.guardCycle
code: /--
Add `key` to the monad's `CallStack` before invoking `act`.
If adding `key` produces a cycle, the cyclic call stack is thrown.
-/
@[inline] def guardCycle
  [BEq κ] [Monad m] [MonadCycle κ m] (key : κ) (act : m α)
: m α 
goal: m α