Equations
- mzip_with' f (x :: xs) (y :: ys) = f x y *> mzip_with' f xs ys
- mzip_with' f (hd :: tl) list.nil = has_pure.pure punit.star
- mzip_with' f list.nil (hd :: tl) = has_pure.pure punit.star
- mzip_with' f list.nil list.nil = has_pure.pure punit.star
@[simp]
theorem
pure_id'_seq
{α : Type u}
{F : Type u → Type v}
[applicative F]
[is_lawful_applicative F]
(x : F α) :
has_pure.pure (λ (x : α), x) <*> x = x
Equations
- list.mpartition p (x :: xs) = mcond (p x) (prod.map (list.cons x) id <$> list.mpartition p xs) (prod.map id (list.cons x) <$> list.mpartition p xs)
- list.mpartition p list.nil = has_pure.pure (list.nil α, list.nil α)
def
list.mmap_accumr
{α : Type u}
{β' γ' : Type v}
{m' : Type v → Type w}
[monad m']
(f : α → β' → m' (β' × γ')) :
Equations
- list.mmap_accumr f a (x :: xs) = list.mmap_accumr f a xs >>= λ (_p : β' × list γ'), list.mmap_accumr._match_2 f x _p
- list.mmap_accumr f a list.nil = has_pure.pure (a, list.nil γ')
- list.mmap_accumr._match_2 f x (a', ys) = f x a' >>= λ (_p : β' × γ'), list.mmap_accumr._match_1 ys _p
- list.mmap_accumr._match_1 ys (a'', y) = has_pure.pure (a'', y :: ys)
def
list.mmap_accuml
{α : Type u}
{β' γ' : Type v}
{m' : Type v → Type w}
[monad m']
(f : β' → α → m' (β' × γ')) :
Equations
- list.mmap_accuml f a (x :: xs) = f a x >>= λ (_p : β' × γ'), list.mmap_accuml._match_2 (λ (a' : β'), list.mmap_accuml f a' xs) _p
- list.mmap_accuml f a list.nil = has_pure.pure (a, list.nil γ')
- list.mmap_accuml._match_2 _f_1 (a', y) = _f_1 a' >>= λ (_p : β' × list γ'), list.mmap_accuml._match_1 y _p
- list.mmap_accuml._match_1 y (a'', ys) = has_pure.pure (a'', y :: ys)
theorem
mjoin_map_map
{m : Type u → Type u}
[monad m]
[is_lawful_monad m]
{α β : Type u}
(f : α → β)
(a : m (m α)) :
@[simp]
theorem
mjoin_map_pure
{m : Type u → Type u}
[monad m]
[is_lawful_monad m]
{α : Type u}
(a : m α) :
mjoin (has_pure.pure <$> a) = a
@[simp]
theorem
mjoin_pure
{m : Type u → Type u}
[monad m]
[is_lawful_monad m]
{α : Type u}
(a : m α) :
mjoin (has_pure.pure a) = a
Equations
- mtry x = (x $> unit.star() <|> has_pure.pure unit.star())
@[simp]