@@ -33,31 +33,31 @@ namespace MainM
3333@[inline] protected def toBaseIO (self : MainM α) : BaseIO (Except ExitCode α) :=
3434 self.toEIO.toBaseIO
3535
36- protected def run (self : MainM α) : BaseIO ExitCode :=
36+ @[inline] protected def run (self : MainM α) : BaseIO ExitCode :=
3737 self.toBaseIO.map fun | Except.ok _ => 0 | Except.error rc => rc
3838
3939/-! # Exits -/
4040
4141/-- Exit with given return code. -/
42- protected def exit (rc : ExitCode) : MainM α :=
42+ @[inline] protected def exit (rc : ExitCode) : MainM α :=
4343 MainM.mk <| throw rc
4444
4545instance : MonadExit MainM := ⟨MainM.exit⟩
4646
4747/-- Try this and catch exits. -/
48- protected def tryCatchExit (f : ExitCode → MainM α) (self : MainM α) : MainM α :=
48+ @[inline] protected def tryCatchExit (f : ExitCode → MainM α) (self : MainM α) : MainM α :=
4949 self.toEIO.tryCatch f
5050
5151/-- Try this and catch error codes (i.e., non-zero exits). -/
52- protected def tryCatchError (f : ExitCode → MainM α) (self : MainM α) : MainM α :=
52+ @[inline] protected def tryCatchError (f : ExitCode → MainM α) (self : MainM α) : MainM α :=
5353 self.tryCatchExit fun rc => if rc = 0 then exit 0 else f rc
5454
5555/-- Exit with a generic error code (i.e., 1). -/
56- protected def failure : MainM α :=
56+ @[inline] protected def failure : MainM α :=
5757 exit 1
5858
5959/-- If this exits with an error code (i.e., not 0), perform other. -/
60- protected def orElse (self : MainM α) (other : Unit → MainM α) : MainM α :=
60+ @[inline] protected def orElse (self : MainM α) (other : Unit → MainM α) : MainM α :=
6161 self.tryCatchExit fun rc => if rc = 0 then exit 0 else other ()
6262
6363instance : Alternative MainM where
@@ -69,14 +69,14 @@ instance : Alternative MainM where
6969instance : MonadLog MainM := MonadLog.eio
7070
7171/-- Print out a error line with the given message and then exit with an error code. -/
72- protected def error (msg : String) (rc : ExitCode := 1 ) : MainM α := do
72+ @[inline] protected def error (msg : String) (rc : ExitCode := 1 ) : MainM α := do
7373 logError msg
7474 exit rc
7575
7676instance : MonadError MainM := ⟨MainM.error⟩
7777instance : MonadLift IO MainM := ⟨MonadError.runEIO⟩
7878
79- def runLogIO (x : LogIO α) (verbosity := Verbosity.normal) : MainM α :=
79+ @[inline] def runLogIO (x : LogIO α) (verbosity := Verbosity.normal) : MainM α :=
8080 liftM <| x.run <| MonadLog.eio verbosity
8181
8282instance : MonadLift LogIO MainM := ⟨runLogIO⟩
0 commit comments