Documentation

Lake.Util.MainM

def Lake.MainM (α : Type) :

The monad in Lake for main-like functions. Supports IO, logging, and exit.

Equations
    Instances For

      Basics #

      @[inline]
      def Lake.MainM.mk {α : Type} (x : EIO ExitCode α) :
      Equations
        Instances For
          @[inline]
          def Lake.MainM.toEIO {α : Type} (self : MainM α) :
          Equations
            Instances For
              @[inline]
              def Lake.MainM.toBaseIO {α : Type} (self : MainM α) :
              Equations
                Instances For
                  @[inline]
                  def Lake.MainM.run {α : Type} (self : MainM α) :
                  Equations
                    Instances For

                      Exits #

                      @[inline]
                      def Lake.MainM.exit {α : Type} (rc : ExitCode) :

                      Exit with given return code.

                      Equations
                        Instances For
                          @[inline]
                          def Lake.MainM.tryCatchExit {α : Type} (f : ExitCodeMainM α) (self : MainM α) :

                          Try this and catch exits.

                          Equations
                            Instances For
                              @[inline]
                              def Lake.MainM.tryCatchError {α : Type} (f : ExitCodeMainM α) (self : MainM α) :

                              Try this and catch error codes (i.e., non-zero exits).

                              Equations
                                Instances For
                                  @[inline]

                                  Exit with a generic error code (i.e., 1).

                                  Equations
                                    Instances For
                                      @[inline]
                                      def Lake.MainM.orElse {α : Type} (self : MainM α) (other : UnitMainM α) :

                                      If this exits with an error code (i.e., not 0), perform other.

                                      Equations
                                        Instances For

                                          Logging and IO #

                                          @[inline]
                                          def Lake.MainM.error {α : Type} (msg : String) (rc : ExitCode := 1) :

                                          Print out a error line with the given message and then exit with an error code.

                                          Equations
                                            Instances For
                                              @[inline]
                                              def Lake.MainM.runLogIO {α : Type} (x : LogIO α) (cfg : LogConfig := { }) :
                                              Equations
                                                Instances For
                                                  def Lake.MainM.liftLogIO {α : Type} (x : LogIO α) :
                                                  Equations
                                                    Instances For
                                                      @[instance 100]
                                                      Equations
                                                        @[inline]
                                                        def Lake.MainM.runLoggerIO {α : Type} (x : LoggerIO α) (cfg : LogConfig := { }) :
                                                        Equations
                                                          Instances For
                                                            def Lake.MainM.liftLoggerIO {α : Type} (x : LoggerIO α) :
                                                            Equations
                                                              Instances For