Monadic instances for ULift and PLift #
In this file we define Monad and IsLawfulMonad instances on PLift and ULift.
Functorial action.
Instances For
@[simp]
theorem
PLift.map_up
{α : Sort u}
{β : Sort v}
(f : α → β)
(a : α)
:
PLift.map f { down := a } = { down := f a }
Applicative sequencing.
Instances For
@[simp]
theorem
PLift.seq_up
{α : Sort u}
{β : Sort v}
(f : α → β)
(x : α)
:
({ down := f }.seq fun (x_1 : Unit) => { down := x }) = { down := f x }
Monadic bind.
Instances For
@[simp]
theorem
PLift.bind_up
{α : Sort u}
{β : Sort v}
(a : α)
(f : α → PLift β)
:
{ down := a }.bind f = f a
@[simp]
theorem
PLift.rec.constant
{α : Sort u}
{β : Type v}
(b : β)
:
(rec fun (x : α) => b) = fun (x : PLift α) => b
Functorial action.
Instances For
@[simp]
theorem
ULift.map_up
{α : Type u}
{β : Type v}
(f : α → β)
(a : α)
:
ULift.map f { down := a } = { down := f a }
Embedding of pure values.
Instances For
@[simp]
theorem
ULift.seq_up
{α : Type u}
{β : Type v}
(f : α → β)
(x : α)
:
({ down := f }.seq fun (x_1 : Unit) => { down := x }) = { down := f x }
def
ULift.bind
{α : Type u}
{β : Type v}
(a : ULift.{u_1, u} α)
(f : α → ULift.{u_2, v} β)
:
ULift.{u_2, v} β
Monadic bind.
Instances For
@[simp]
theorem
ULift.bind_up
{α : Type u}
{β : Type v}
(a : α)
(f : α → ULift.{u_1, v} β)
:
{ down := a }.bind f = f a
@[simp]
theorem
ULift.rec.constant
{α : Type u}
{β : Sort v}
(b : β)
:
(rec fun (x : α) => b) = fun (x : ULift.{u_1, u} α) => b