@[reducible, inline]
A sequence of calls donated by the key type κ
.
Equations
Instances For
instance
Lake.instMonadCallStackOfMonadCallStackOf
{κ : Type u_1}
{m : Type u_1 → Type u_2}
[MonadCallStackOf κ m]
:
MonadCallStack κ m
Equations
instance
Lake.instMonadCallStackOfOfMonadLiftOfMonadFunctor
{m : Type u_1 → Type u_2}
{n : Type u_1 → Type u_3}
{κ : Type u_1}
[MonadLift m n]
[MonadFunctor m n]
[MonadCallStackOf κ m]
:
MonadCallStackOf κ n
Equations
class
Lake.MonadCycleOf
(κ : semiOutParam (Type u))
(m : Type u → Type v)
extends Lake.MonadCallStackOf κ m :
Type (max (u + 1) v)
A monad equipped with a call stack and the ability to error on a cycle.
- getCallStack : m (CallStack κ)
Instances
class
Lake.MonadCycle
(κ : outParam (Type u))
(m : Type u → Type v)
extends Lake.MonadCallStack κ m :
Type (max (u + 1) v)
Similar to MonadCycle
, but κ
is an outParam
for convenience.
- getCallStack : m (CallStack κ)
Instances
instance
Lake.instMonadCycleOfMonadCycleOf
{κ : Type u_1}
{m : Type u_1 → Type u_2}
[MonadCycleOf κ m]
:
MonadCycle κ m
Equations
instance
Lake.instMonadCycleOfOfMonadLiftOfMonadFunctor
{m : Type u_1 → Type u_2}
{n : Type u_1 → Type u_3}
{κ : Type u_1}
[MonadLift m n]
[MonadFunctor m n]
[MonadCycleOf κ m]
:
MonadCycleOf κ n
Equations
instance
Lake.inhabitedOfMonadCycle
{κ : Type u_1}
{m : Type u_1 → Type u_2}
{α : Type u_1}
[MonadCycle κ m]
:
Inhabited (m α)
Equations
instance
Lake.instMonadCallStackOfCallStackTOfMonad
{m : Type u_1 → Type u_2}
{κ : Type u_1}
[Monad m]
:
MonadCallStackOf κ (CallStackT κ m)
Equations
instance
Lake.instMonadCycleOfCycleTOfMonad
{m : Type u_1 → Type u_2}
{κ : Type u_1}
[Monad m]
:
MonadCycleOf κ (CycleT κ m)
Equations
@[inline]
def
Lake.guardCycle
{κ : Type u_1}
{m : Type u_1 → Type u_2}
{α : Type u_1}
[BEq κ]
[Monad m]
[MonadCycle κ m]
(key : κ)
(act : m α)
:
m α
Add key
to the monad's CallStack
before invoking act
.
If adding key
produces a cycle, the cyclic call stack is thrown.