@[class]
@[class]
- to_is_lawful_functor : is_lawful_functor f
- seq_left_eq : (∀ {α β : Type ?} (a : f α) (b : f β), a <* b = function.const β <$> a <*> b) . "control_laws_tac"
- seq_right_eq : (∀ {α β : Type ?} (a : f α) (b : f β), a *> b = function.const α id <$> a <*> b) . "control_laws_tac"
- pure_seq_eq_map : ∀ {α β : Type ?} (g : α → β) (x : f α), has_pure.pure g <*> x = g <$> x
- map_pure : ∀ {α β : Type ?} (g : α → β) (x : α), g <$> has_pure.pure x = has_pure.pure (g x)
- seq_pure : ∀ {α β : Type ?} (g : f (α → β)) (x : α), g <*> has_pure.pure x = (λ (g : α → β), g x) <$> g
- seq_assoc : ∀ {α β γ : Type ?} (x : f α) (g : f (α → β)) (h : f (β → γ)), h <*> (g <*> x) = function.comp <$> h <*> g <*> x
@[simp]
theorem
pure_id_seq
{α : Type u}
{f : Type u → Type v}
[applicative f]
[is_lawful_applicative f]
(x : f α) :
has_pure.pure id <*> x = x
@[class]
- to_is_lawful_applicative : is_lawful_applicative m
- bind_pure_comp_eq_map : (∀ {α β : Type ?} (f : α → β) (x : m α), x >>= has_pure.pure ∘ f = f <$> x) . "control_laws_tac"
- bind_map_eq_seq : (∀ {α β : Type ?} (f : m (α → β)) (x : m α), (f >>= λ (_x : α → β), _x <$> x) = f <*> x) . "control_laws_tac"
- pure_bind : ∀ {α β : Type ?} (x : α) (f : α → m β), has_pure.pure x >>= f = f x
- bind_assoc : ∀ {α β γ : Type ?} (x : m α) (f : α → m β) (g : β → m γ), x >>= f >>= g = x >>= λ (x : α), f x >>= g
Instances of this typeclass
@[simp]
theorem
state_t.run_pure
{σ : Type u}
{m : Type u → Type v}
{α : Type u}
(st : σ)
[monad m]
(a : α) :
(has_pure.pure a).run st = has_pure.pure (a, st)
@[simp]
theorem
state_t.run_monad_lift
{σ : Type u}
{m : Type u → Type v}
{α : Type u}
(st : σ)
[monad m]
{n : Type u → Type u_1}
[has_monad_lift_t n m]
(x : n α) :
(has_monad_lift_t.monad_lift x).run st = has_monad_lift_t.monad_lift x >>= λ (a : α), has_pure.pure (a, st)
@[simp]
theorem
state_t.run_monad_map
{σ : Type u}
{m : Type u → Type v}
{α : Type u}
(x : state_t σ m α)
(st : σ)
[monad m]
{m' : Type u → Type v}
{n n' : Type u → Type u_1}
[monad m']
[monad_functor_t n n' m m']
(f : Π {α : Type u}, n α → n' α) :
(monad_functor_t.monad_map f x).run st = monad_functor_t.monad_map f (x.run st)
@[simp]
theorem
state_t.run_get
{σ : Type u}
{m : Type u → Type v}
(st : σ)
[monad m] :
state_t.get.run st = has_pure.pure (st, st)
@[simp]
theorem
state_t.run_put
{σ : Type u}
{m : Type u → Type v}
(st : σ)
[monad m]
(st' : σ) :
(state_t.put st').run st = has_pure.pure (punit.star, st')
@[protected, instance]
def
state_t.is_lawful_monad
(m : Type u → Type v)
[monad m]
[is_lawful_monad m]
(σ : Type u) :
is_lawful_monad (state_t σ m)
@[simp]
theorem
except_t.run_pure
{α ε : Type u}
{m : Type u → Type v}
[monad m]
(a : α) :
(has_pure.pure a).run = has_pure.pure (except.ok a)
@[simp]
theorem
except_t.run_monad_lift
{α ε : Type u}
{m : Type u → Type v}
[monad m]
{n : Type u → Type u_1}
[has_monad_lift_t n m]
(x : n α) :
@[simp]
@[protected, instance]
def
except_t.is_lawful_monad
(m : Type u → Type v)
[monad m]
[is_lawful_monad m]
(ε : Type u) :
is_lawful_monad (except_t ε m)
@[simp]
theorem
reader_t.run_pure
{ρ : Type u}
{m : Type u → Type v}
{α : Type u}
(r : ρ)
[monad m]
(a : α) :
(has_pure.pure a).run r = has_pure.pure a
@[simp]
theorem
reader_t.run_monad_map
{ρ : Type u}
{m : Type u → Type v}
{α : Type u}
(x : reader_t ρ m α)
(r : ρ)
[monad m]
{m' : Type u → Type v}
{n n' : Type u → Type u_1}
[monad m']
[monad_functor_t n n' m m']
(f : Π {α : Type u}, n α → n' α) :
(monad_functor_t.monad_map f x).run r = monad_functor_t.monad_map f (x.run r)
@[protected, instance]
def
reader_t.is_lawful_monad
(ρ : Type u)
(m : Type u → Type v)
[monad m]
[is_lawful_monad m] :
is_lawful_monad (reader_t ρ m)
@[simp]
theorem
option_t.run_pure
{α : Type u}
{m : Type u → Type v}
[monad m]
(a : α) :
(has_pure.pure a).run = has_pure.pure (option.some a)
@[simp]
theorem
option_t.run_monad_lift
{α : Type u}
{m : Type u → Type v}
[monad m]
{n : Type u → Type u_1}
[has_monad_lift_t n m]
(x : n α) :
@[simp]
@[protected, instance]