@[instance_reducible]
instance Lake.instMonadErrorOfMonadLift {m : Type u_1 → Type u_2} {n : Type u_1 → Type u_3} [MonadLift m n] [MonadError m] :
Equations
- Lake.instMonadErrorOfMonadLift = { error := fun {α : Type ?u.3} (msg : String) => liftM (Lake.error msg) }
@[instance_reducible]
Equations
- Lake.instMonadErrorIO = { error := fun {α : Type} (msg : String) => throw (IO.userError msg) }
@[instance_reducible]
@[instance_reducible]
@[inline]
def Lake.MonadError.runEIO {m : Type → Type u_1} {ε α : Type} [Monad m] [MonadError m] [MonadLiftT BaseIO m] [ToString ε] (x : EIO ε α) :
m α
Perform an EIO action.
If it throws an error, invoke error with its string representation.
Equations
- Lake.MonadError.runEIO x = do let __do_lift ← liftM x.toBaseIO match __do_lift with | Except.ok a => pure a | Except.error e => Lake.error (toString e)
Instances For
@[inline]
def Lake.MonadError.runIO {m : Type → Type u_1} {α : Type} [Monad m] [MonadError m] [MonadLiftT BaseIO m] (x : IO α) :
m α
Perform an IO action.
If it throws an error, invoke error with its string representation.