Documentation

Init.Control.Do

This module provides specialized wrappers around ExceptT to support the do elaborator.

Specifically, the types here are used to tunnel early return, break and continue through non-algebraic higher-order effect combinators such as tryCatch.

@[reducible, inline]
abbrev EarlyReturnT (ρ : Type u_1) (m : Type u_1 → Type u_2) (α : Type u_1) :
Type u_2

A wrapper around ExceptT signifying early return.

Equations
Instances For
    @[reducible, inline]
    abbrev EarlyReturnT.return {ρ : Type u_1} {m : Type u_1 → Type u_2} {α : Type u_1} [Monad m] (r : ρ) :
    EarlyReturnT ρ m α

    Exit a computation by returning a value r : ρ early.

    Equations
    Instances For
      @[reducible, inline]
      abbrev EarlyReturn.runK {ρ α : Type u} {β : Type v} (x : Except ρ α) (ret : ρβ) (pure : αβ) :
      β

      A specialization of Except.casesOn.

      Equations
      Instances For
        @[reducible, inline]
        abbrev BreakT (m : Type u_1 → Type u_2) (α : Type u_1) :
        Type u_2

        A wrapper around OptionT signifying break in a loop.

        Equations
        Instances For
          @[reducible, inline]
          abbrev BreakT.break {α : Type w} {m : Type w → Type x} [Monad m] :
          BreakT m α

          Exit a loop body via break.

          Equations
          Instances For
            @[reducible, inline]
            abbrev Break.runK {α : Type u} {β : Type v} (x : Option α) (breakK : Unitβ) (successK : αβ) :
            β

            A specialization of Option.casesOn.

            Equations
            Instances For
              @[reducible, inline]
              abbrev ContinueT (m : Type u_1 → Type u_2) (α : Type u_1) :
              Type u_2

              A wrapper around OptionT signifying continue in a loop.

              Equations
              Instances For
                @[reducible, inline]
                abbrev ContinueT.continue {α : Type w} {m : Type w → Type x} [Monad m] :

                Exit a loop body via continue.

                Equations
                Instances For
                  @[reducible, inline]
                  abbrev Continue.runK {α : Type u} {β : Type v} (x : Option α) (continueK : Unitβ) (successK : αβ) :
                  β

                  A specialization of Option.casesOn.

                  Equations
                  Instances For