Documentation

Batteries.Lean.Except

def Except.emoji {ε : Type u_1} {α : Type u_2} :
Except ε αString

Visualize an Except using a checkmark or a cross.

Equations
Instances For
    @[simp]
    theorem Except.map_error {α β : Type u_1} {ε : Type u} (f : αβ) (e : ε) :
    @[simp]
    theorem Except.map_ok {α β : Type u_1} {ε : Type u} (f : αβ) (x : α) :
    f <$> ok x = ok (f x)
    def Except.pmap {ε : Type u} {α β : Type v} (x : Except ε α) (f : (a : α) → x = ok aβ) :
    Except ε β

    Map a function over an Except value, using a proof that the value is .ok.

    Equations
    Instances For
      @[simp]
      theorem Except.pmap_error {ε : Type u} {α β : Type v} (e : ε) (f : (a : α) → error e = ok aβ) :
      (error e).pmap f = error e
      @[simp]
      theorem Except.pmap_ok {ε : Type u} {α β : Type v} (a : α) (f : (a' : α) → ok a = ok a'β) :
      (ok a).pmap f = ok (f a )
      @[simp]
      theorem Except.pmap_id {ε : Type u} {α : Type v} (x : Except ε α) :
      (x.pmap fun (a : α) (x : x = ok a) => a) = x
      @[simp]
      theorem Except.map_pmap {β γ : Type u_1} {ε : Type u_2} {α : Type u_1} (g : βγ) (x : Except ε α) (f : (a : α) → x = ok aβ) :
      g <$> x.pmap f = x.pmap fun (a : α) (h : x = ok a) => g (f a h)
      @[simp]
      theorem ExceptT.run_mk {ε α : Type u} {m : Type u → Type v} (x : m (Except ε α)) :
      (mk x).run = x
      @[simp]
      theorem ExceptT.mk_run {ε : Type u_1} {m : Type u_1 → Type u_2} {α : Type u_1} (x : ExceptT ε m α) :
      mk x.run = x
      @[simp]
      theorem ExceptT.map_mk {m : Type u_1 → Type u_2} {α β ε : Type u_1} [Monad m] [LawfulMonad m] (f : αβ) (x : m (Except ε α)) :
      f <$> mk x = mk ((fun (x : Except ε α) => f <$> x) <$> x)