Skip to content

Commit

Permalink
feat: add LawfulMonad instance for EStateM (#416)
Browse files Browse the repository at this point in the history
Co-authored-by: François G. Dorais <fgdorais@gmail.com>
  • Loading branch information
eric-wieser and fgdorais authored Dec 5, 2023
1 parent 1f24793 commit baf6def
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Std/Classes/LawfulMonad.lean
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ instance : LawfulMonad Option := LawfulMonad.mk'
instance : LawfulApplicative Option := inferInstance
instance : LawfulFunctor Option := inferInstance

instance : LawfulMonad (EStateM ε σ) := .mk'
(id_map := fun x => funext <| fun s => by
dsimp only [EStateM.instMonadEStateM, EStateM.map]
match x s with
| .ok _ _ => rfl
| .error _ _ => rfl)
(pure_bind := fun _ _ => rfl)
(bind_assoc := fun x _ _ => funext <| fun s => by
dsimp only [EStateM.instMonadEStateM, EStateM.bind]
match x s with
| .ok _ _ => rfl
| .error _ _ => rfl)
(map_const := fun _ _ => rfl)

/-!
## SatisfiesM
Expand Down

0 comments on commit baf6def

Please sign in to comment.