def
monad_cont.goto
{α : Type u_1}
{β : Type u}
{m : Type u → Type v}
(f : monad_cont.label α m β)
(x : α) :
m β
Equations
- monad_cont.goto f x = f.apply x
@[class]
- call_cc : Π {α β : Type ?}, (monad_cont.label α m β → m α) → m α
Instances of this typeclass
Instances of other typeclasses for monad_cont
- monad_cont.has_sizeof_inst
@[class]
- to_is_lawful_monad : is_lawful_monad m
- call_cc_bind_right : ∀ {α ω γ : Type ?} (cmd : m α) (next : monad_cont.label ω m γ → α → m ω), monad_cont.call_cc (λ (f : monad_cont.label ω m γ), cmd >>= next f) = cmd >>= λ (x : α), monad_cont.call_cc (λ (f : monad_cont.label ω m γ), next f x)
- call_cc_bind_left : ∀ {α : Type ?} (β : Type ?) (x : α) (dead : monad_cont.label α m β → β → m α), monad_cont.call_cc (λ (f : monad_cont.label α m β), monad_cont.goto f x >>= dead f) = has_pure.pure x
- call_cc_dummy : ∀ {α β : Type ?} (dummy : m α), monad_cont.call_cc (λ (f : monad_cont.label α m β), dummy) = dummy
Instances of this typeclass
Instances of other typeclasses for is_lawful_monad_cont
- is_lawful_monad_cont.has_sizeof_inst
@[protected, instance]
@[protected, instance]
def
cont_t.has_monad_lift
{r : Type u}
{m : Type u → Type v}
[monad m] :
has_monad_lift m (cont_t r m)
Equations
- cont_t.has_monad_lift = {monad_lift := λ (α : Type u), cont_t.monad_lift}
theorem
cont_t.monad_lift_bind
{r : Type u}
{m : Type u → Type v}
[monad m]
[is_lawful_monad m]
{α β : Type u}
(x : m α)
(f : α → m β) :
cont_t.monad_lift (x >>= f) = cont_t.monad_lift x >>= cont_t.monad_lift ∘ f
@[protected, instance]
def
cont_t.is_lawful_monad_cont
{r : Type u}
{m : Type u → Type v} :
is_lawful_monad_cont (cont_t r m)
Equations
- cont_t.is_lawful_monad_cont = {to_is_lawful_monad := _, call_cc_bind_right := _, call_cc_bind_left := _, call_cc_dummy := _}
@[protected, instance]
def
cont_t.monad_except
{r : Type u}
{m : Type u → Type v}
(ε : out_param (Type u_1))
[monad_except ε m] :
monad_except ε (cont_t r m)
Equations
- cont_t.monad_except ε = {throw := λ (x : Type u_2) (e : ε) (f : x → m r), monad_except.throw e, catch := λ (α : Type u_2) (act : cont_t r m α) (h : ε → cont_t r m α) (f : α → m r), monad_except.catch (act f) (λ (e : ε), h e f)}
def
except_t.mk_label
{m : Type u → Type v}
[monad m]
{α β ε : Type u} :
monad_cont.label (except ε α) m β → monad_cont.label α (except_t ε m) β
Equations
- except_t.mk_label {apply := f} = {apply := λ (a : α), has_monad_lift_t.monad_lift (f (except.ok a))}
theorem
except_t.goto_mk_label
{m : Type u → Type v}
[monad m]
{α β ε : Type u}
(x : monad_cont.label (except ε α) m β)
(i : α) :
monad_cont.goto (except_t.mk_label x) i = ⟨except.ok <$> monad_cont.goto x (except.ok i)⟩
def
except_t.call_cc
{m : Type u → Type v}
[monad m]
{ε : Type u}
[monad_cont m]
{α β : Type u}
(f : monad_cont.label α (except_t ε m) β → except_t ε m α) :
except_t ε m α
Equations
- except_t.call_cc f = ⟨monad_cont.call_cc (λ (x : monad_cont.label (except ε α) m β), (f (except_t.mk_label x)).run)⟩
@[protected, instance]
def
except_t.monad_cont
{m : Type u → Type v}
[monad m]
{ε : Type u}
[monad_cont m] :
monad_cont (except_t ε m)
Equations
- except_t.monad_cont = {call_cc := λ (α β : Type u), except_t.call_cc}
@[protected, instance]
def
except_t.is_lawful_monad_cont
{m : Type u → Type v}
[monad m]
{ε : Type u}
[monad_cont m]
[is_lawful_monad_cont m] :
is_lawful_monad_cont (except_t ε m)
Equations
- except_t.is_lawful_monad_cont = {to_is_lawful_monad := _, call_cc_bind_right := _, call_cc_bind_left := _, call_cc_dummy := _}
def
option_t.mk_label
{m : Type u → Type v}
[monad m]
{α β : Type u} :
monad_cont.label (option α) m β → monad_cont.label α (option_t m) β
Equations
- option_t.mk_label {apply := f} = {apply := λ (a : α), has_monad_lift_t.monad_lift (f (option.some a))}
theorem
option_t.goto_mk_label
{m : Type u → Type v}
[monad m]
{α β : Type u}
(x : monad_cont.label (option α) m β)
(i : α) :
monad_cont.goto (option_t.mk_label x) i = {run := option.some <$> monad_cont.goto x (option.some i)}
def
option_t.call_cc
{m : Type u → Type v}
[monad m]
[monad_cont m]
{α β : Type u}
(f : monad_cont.label α (option_t m) β → option_t m α) :
option_t m α
Equations
- option_t.call_cc f = {run := monad_cont.call_cc (λ (x : monad_cont.label (option α) m β), (f (option_t.mk_label x)).run)}
@[protected, instance]
Equations
- option_t.monad_cont = {call_cc := λ (α β : Type u), option_t.call_cc}
@[protected, instance]
def
option_t.is_lawful_monad_cont
{m : Type u → Type v}
[monad m]
[monad_cont m]
[is_lawful_monad_cont m] :
Equations
- option_t.is_lawful_monad_cont = {to_is_lawful_monad := _, call_cc_bind_right := _, call_cc_bind_left := _, call_cc_dummy := _}
def
writer_t.mk_label
{m : Type u → Type v}
[monad m]
{α : Type u_1}
{β ω : Type u}
[has_one ω] :
monad_cont.label (α × ω) m β → monad_cont.label α (writer_t ω m) β
Equations
- writer_t.mk_label {apply := f} = {apply := λ (a : α), has_monad_lift_t.monad_lift (f (a, 1))}
theorem
writer_t.goto_mk_label
{m : Type u → Type v}
[monad m]
{α : Type u_1}
{β ω : Type u}
[has_one ω]
(x : monad_cont.label (α × ω) m β)
(i : α) :
monad_cont.goto (writer_t.mk_label x) i = has_monad_lift_t.monad_lift (monad_cont.goto x (i, 1))
def
writer_t.call_cc
{m : Type u → Type v}
[monad m]
[monad_cont m]
{α β ω : Type u}
[has_one ω]
(f : monad_cont.label α (writer_t ω m) β → writer_t ω m α) :
writer_t ω m α
Equations
@[protected, instance]
def
writer_t.monad_cont
{m : Type u → Type v}
[monad m]
(ω : Type u)
[monad m]
[has_one ω]
[monad_cont m] :
monad_cont (writer_t ω m)
Equations
- writer_t.monad_cont ω = {call_cc := λ (α β : Type u), writer_t.call_cc}
def
state_t.mk_label
{m : Type u → Type v}
[monad m]
{α β σ : Type u} :
monad_cont.label (α × σ) m (β × σ) → monad_cont.label α (state_t σ m) β
theorem
state_t.goto_mk_label
{m : Type u → Type v}
[monad m]
{α β σ : Type u}
(x : monad_cont.label (α × σ) m (β × σ))
(i : α) :
monad_cont.goto (state_t.mk_label x) i = ⟨λ (s : σ), monad_cont.goto x (i, s)⟩
def
state_t.call_cc
{m : Type u → Type v}
[monad m]
{σ : Type u}
[monad_cont m]
{α β : Type u}
(f : monad_cont.label α (state_t σ m) β → state_t σ m α) :
state_t σ m α
Equations
- state_t.call_cc f = ⟨λ (r : σ), monad_cont.call_cc (λ (f' : monad_cont.label (α × σ) m (β × σ)), (f (state_t.mk_label f')).run r)⟩
@[protected, instance]
def
state_t.monad_cont
{m : Type u → Type v}
[monad m]
{σ : Type u}
[monad_cont m] :
monad_cont (state_t σ m)
Equations
- state_t.monad_cont = {call_cc := λ (α β : Type u), state_t.call_cc}
@[protected, instance]
def
state_t.is_lawful_monad_cont
{m : Type u → Type v}
[monad m]
{σ : Type u}
[monad_cont m]
[is_lawful_monad_cont m] :
is_lawful_monad_cont (state_t σ m)
Equations
- state_t.is_lawful_monad_cont = {to_is_lawful_monad := _, call_cc_bind_right := _, call_cc_bind_left := _, call_cc_dummy := _}
def
reader_t.mk_label
{m : Type u → Type v}
[monad m]
{α : Type u_1}
{β : Type u}
(ρ : Type u) :
monad_cont.label α m β → monad_cont.label α (reader_t ρ m) β
Equations
- reader_t.mk_label ρ {apply := f} = {apply := has_monad_lift_t.monad_lift ∘ f}
theorem
reader_t.goto_mk_label
{m : Type u → Type v}
[monad m]
{α : Type u_1}
{ρ β : Type u}
(x : monad_cont.label α m β)
(i : α) :
def
reader_t.call_cc
{m : Type u → Type v}
[monad m]
{ε : Type u}
[monad_cont m]
{α β : Type u}
(f : monad_cont.label α (reader_t ε m) β → reader_t ε m α) :
reader_t ε m α
Equations
- reader_t.call_cc f = ⟨λ (r : ε), monad_cont.call_cc (λ (f' : monad_cont.label α m β), (f (reader_t.mk_label ε f')).run r)⟩
@[protected, instance]
def
reader_t.monad_cont
{m : Type u → Type v}
[monad m]
{ρ : Type u}
[monad_cont m] :
monad_cont (reader_t ρ m)
Equations
- reader_t.monad_cont = {call_cc := λ (α β : Type u), reader_t.call_cc}
@[protected, instance]
def
reader_t.is_lawful_monad_cont
{m : Type u → Type v}
[monad m]
{ρ : Type u}
[monad_cont m]
[is_lawful_monad_cont m] :
is_lawful_monad_cont (reader_t ρ m)
Equations
- reader_t.is_lawful_monad_cont = {to_is_lawful_monad := _, call_cc_bind_right := _, call_cc_bind_left := _, call_cc_dummy := _}