Basic control operations #
Extends the theory on functors, applicatives and monads.
A generalization of List.zipWith which combines list elements with an Applicative.
Equations
Instances For
@[simp]
theorem pure_id'_seq {α : Type u} {F : Type u → Type v} [Applicative F] [LawfulApplicative F] (x : F α) :
theorem seq_map_assoc {α β γ : Type u} {F : Type u → Type v} [Applicative F] [LawfulApplicative F] (x : F (α → β)) (f : γ → α) (y : F γ) :
theorem joinM_map_map {m : Type u → Type u} [Monad m] [LawfulMonad m] {α β : Type u} (f : α → β) (a : m (m α)) :
@[simp]
@[instance_reducible]
Equations
- One or more equations did not get rendered due to their size.
A CommApplicative functor m is a (lawful) applicative functor which behaves identically on
α × β and β × α, so computations can occur in either order.
- seq_assoc {α β γ : Type u} (x : m α) (g : m (α → β)) (h : m (β → γ)) : h <*> (g <*> x) = Function.comp <$> h <*> g <*> x
- commutative_prod {α β : Type u} (a : m α) (b : m β) : Prod.mk <$> a <*> b = (fun (b : β) (a : α) => (a, b)) <$> b <*> a
Computations performed first on
a : αand then onb : βare equal to those performed in the reverse order.
Instances
theorem CommApplicative.commutative_map {m : Type u → Type v} [h : Applicative m] [CommApplicative m] {α β γ : Type u} (a : m α) (b : m β) {f : α → β → γ} :