Documentation

Hale.Base.System.Exit

Exit codes for process termination.

$$\text{ExitCode} ::= \text{success} \mid \text{failure}(n : \mathbb{N}_{32})$$

Instances For
    Equations
    Instances For
      @[implicit_reducible]
      Equations
      • One or more equations did not get rendered due to their size.
      @[inline]

      Convert an ExitCode to its numeric representation.

      $$\text{toUInt32}(\text{success}) = 0, \quad \text{toUInt32}(\text{failure}(n)) = n$$

      Equations
      Instances For
        @[inline]

        Test if the exit code represents success.

        $$\text{isSuccess}(\text{success}) = \text{true}$$

        Equations
        Instances For
          def System.exitWith {α : Type} (code : ExitCode) :
          IO α

          Exit the process with the given exit code.

          $$\text{exitWith} : \text{ExitCode} \to \text{IO}\ \alpha$$

          Note: Lean's IO.Process.exit takes UInt8, so codes above 255 are truncated.

          Equations
          Instances For
            def System.exitSuccess {α : Type} :
            IO α

            Exit successfully (code 0).

            $$\text{exitSuccess} : \text{IO}\ \alpha$$

            Equations
            Instances For
              def System.exitFailure {α : Type} :
              IO α

              Exit with failure code 1.

              $$\text{exitFailure} : \text{IO}\ \alpha$$

              Equations
              Instances For