Extends the theory on functors, applicatives and monads.
A generalization of List.zipWith
which combines list elements with an Applicative
.
Equations
Instances For
Like zipWithM
but evaluates the result as it traverses the lists using *>
.
Equations
- zipWithM' f (x_2 :: xs) (y :: ys) = SeqRight.seqRight (f x_2 y) fun x => zipWithM' f xs ys
- zipWithM' f [] x = pure PUnit.unit
- zipWithM' f x [] = pure PUnit.unit
Instances For
Takes a value β
and List α
and accumulates pairs according to a monadic function f
.
Accumulation occurs from the right (i.e., starting from the tail of the list).
Equations
- One or more equations did not get rendered due to their size.
- List.mapAccumRM f x [] = pure (x, [])
Instances For
Takes a value β
and List α
and accumulates pairs according to a monadic function f
.
Accumulation occurs from the left (i.e., starting from the head of the list).
Equations
- One or more equations did not get rendered due to their size.
- List.mapAccumLM f x [] = pure (x, [])
Instances For
Returns pure true
if the computation succeeds and pure false
otherwise.
Equations
- succeeds x = HOrElse.hOrElse (Functor.mapConst true x) fun x => pure false
Instances For
Attempts to perform the computation, but fails silently if it doesn't succeed.
Equations
- tryM x = HOrElse.hOrElse (Functor.mapConst () x) fun x => pure ()
Instances For
- map_const : ∀ {α β : Type u}, Functor.mapConst = Functor.map ∘ Function.const β
- seqLeft_eq : ∀ {α β : Type u} (x : m α) (y : m β), (SeqLeft.seqLeft x fun x => y) = Seq.seq (Function.const β <$> x) fun x => y
- seqRight_eq : ∀ {α β : Type u} (x : m α) (y : m β), (SeqRight.seqRight x fun x => y) = Seq.seq (Function.const α id <$> x) fun x => y
- commutative_prod : ∀ {α β : Type u} (a : m α) (b : m β), (Seq.seq (Prod.mk <$> a) fun x => b) = Seq.seq ((fun b a => (a, b)) <$> b) fun x => a
Computations performed first on
a : α
and then onb : β
are equal to those performed in the reverse order.
A CommApplicative
functor m
is a (lawful) applicative functor which behaves identically on
α × β
and β × α
, so computations can occur in either order.