Documentation

Lake.Util.Cycle

@[reducible, inline]
abbrev Lake.CallStack (κ : Type u_1) :
Type u_1

A sequence of calls donated by the key type κ.

Equations
    Instances For
      @[reducible, inline]
      abbrev Lake.Cycle (κ : Type u_1) :
      Type u_1

      A CallStack ending in a cycle.

      Equations
        Instances For
          def Lake.formatCycle {κ : Type u_1} [ToString κ] (cycle : Cycle κ) :
          Equations
            Instances For
              class Lake.MonadCallStackOf (κ : semiOutParam (Type u)) (m : Type u → Type v) :
              Type (max (u + 1) v)

              A monad equipped with a call stack.

              Instances
                class Lake.MonadCallStack (κ : outParam (Type u)) (m : Type u → Type v) :
                Type (max (u + 1) v)

                Similar to MonadCallStackOf, but κ is an outParam for convenience.

                Instances
                  instance Lake.instMonadCallStackOfMonadCallStackOf {κ : Type u_1} {m : Type u_1 → Type u_2} [MonadCallStackOf κ 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] :
                    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.

                      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.

                        Instances
                          instance Lake.instMonadCycleOfMonadCycleOf {κ : Type u_1} {m : Type u_1 → Type u_2} [MonadCycleOf κ 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] :
                            Equations
                              instance Lake.inhabitedOfMonadCycle {κ : Type u_1} {m : Type u_1 → Type u_2} {α : Type u_1} [MonadCycle κ m] :
                              Inhabited (m α)
                              Equations
                                @[reducible, inline]
                                abbrev Lake.CallStackT (κ : Type u_1) (m : Type u_1 → Type u_2) (α : Type u_1) :
                                Type (max u_1 u_2)

                                A transformer that equips a monad with a CallStack.

                                Equations
                                  Instances For
                                    instance Lake.instMonadCallStackOfCallStackTOfMonad {m : Type u_1 → Type u_2} {κ : Type u_1} [Monad m] :
                                    Equations
                                      @[reducible, inline]
                                      abbrev Lake.CycleT (κ : Type u_1) (m : Type u_1 → Type u_2) (α : Type u_1) :
                                      Type (max u_1 u_2)

                                      A transformer that equips a monad with a CallStack to detect cycles.

                                      Equations
                                        Instances For
                                          instance Lake.instMonadCycleOfCycleTOfMonad {m : Type u_1 → Type u_2} {κ : Type u_1} [Monad 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.

                                            Equations
                                              Instances For