Extends the theory on functors, applicatives and monads.
A generalization of List.zipWith which combines list elements with an Applicative.
Equations
Instances For
def
zipWithM'
{α β γ : Type u}
{F : Type u → Type v}
[Applicative F]
(f : α → β → F γ)
:
List α → List β → F PUnit.{u + 1}
Like zipWithM but evaluates the result as it traverses the lists using *>.
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]
@[simp]
Returns pure true if the computation succeeds and pure false otherwise.
Equations
Instances For
Attempts to perform the computation, but fails silently if it doesn't succeed.
Equations
Instances For
Attempts to perform the computation, and returns none if it doesn't succeed.
Equations
Instances For
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 : α → β → γ}
: