feat: change back seqLeft/Right signature

This was originally changed for the sake of `do`, which does not depend on it anymore
This commit is contained in:
Sebastian Ullrich 2021-02-12 10:57:41 +01:00 committed by Leonardo de Moura
parent c64d053f9e
commit 75243e7f24
2 changed files with 4 additions and 4 deletions

View file

@ -1122,10 +1122,10 @@ class Seq (f : Type u → Type v) : Type (max (u+1) v) where
seq : {α β : Type u} → f (α → β) → f α → f β
class SeqLeft (f : Type u → Type v) : Type (max (u+1) v) where
seqLeft : {α : Type u} → f α → f PUnit → f α
seqLeft : {α β : Type u} → f α → f β → f α
class SeqRight (f : Type u → Type v) : Type (max (u+1) v) where
seqRight : {β : Type u} → f PUnit → f β → f β
seqRight : {α β : Type u} → f α → f β → f β
class Applicative (f : Type u → Type v) extends Functor f, Pure f, Seq f, SeqLeft f, SeqRight f where
map := fun x y => Seq.seq (pure x) y
@ -1468,7 +1468,7 @@ class Backtrackable (δ : outParam (Type u)) (σ : Type u) where
| Result.ok a s => Result.ok (f a) s
| Result.error e s => Result.error e s
@[inline] protected def seqRight (x : EStateM ε σ PUnit) (y : EStateM ε σ β) : EStateM ε σ β := fun s =>
@[inline] protected def seqRight (x : EStateM ε σ α) (y : EStateM ε σ β) : EStateM ε σ β := fun s =>
match x s with
| Result.ok _ s => y s
| Result.error e s => Result.error e s

View file

@ -7,7 +7,7 @@ class Monad2 (m : Type u → Type v) extends Applicative m, Bind2 m : Type (max
map := fun f x => Bind2.bind x (pure ∘ f)
seq := fun f x => Bind2.bind f fun y => Functor.map y x
seqLeft := fun x y => Bind2.bind x fun a => Bind2.bind y fun _ => pure a
seqRight := @fun β x y => Bind2.bind x fun _ => y -- Recall that `@` disables implicit lambda support
seqRight := @fun α β x y => Bind2.bind x fun _ => y -- Recall that `@` disables implicit lambda support
class Monad3 (m : Type u → Type v) extends Applicative m, Bind2 m : Type (max (u+1) v) where
map (f x) := Bind2.bind x (pure ∘ f)