Documentation

Mathlib.Control.ULift

Monadic instances for ULift and PLift #

In this file we define Monad and IsLawfulMonad instances on PLift and ULift.

def PLift.map {α : Sort u} {β : Sort v} (f : αβ) (a : PLift α) :
PLift β

Functorial action.

Instances For
    @[simp]
    theorem PLift.map_up {α : Sort u} {β : Sort v} (f : αβ) (a : α) :
    PLift.map f { down := a } = { down := f a }
    def PLift.pure {α : Sort u} :
    αPLift α

    Embedding of pure values.

    Instances For
      def PLift.seq {α : Sort u} {β : Sort v} (f : PLift (αβ)) (x : UnitPLift α) :
      PLift β

      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 }
        def PLift.bind {α : Sort u} {β : Sort v} (a : PLift α) (f : αPLift β) :
        PLift β

        Monadic bind.

        Instances For
          @[simp]
          theorem PLift.bind_up {α : Sort u} {β : Sort v} (a : α) (f : αPLift β) :
          { down := a }.bind f = f a
          @[implicit_reducible]
          instance PLift.instMonad_mathlib :
          Monad PLift
          instance PLift.instLawfulApplicative_mathlib :
          LawfulApplicative PLift
          @[simp]
          theorem PLift.rec.constant {α : Sort u} {β : Type v} (b : β) :
          (rec fun (x : α) => b) = fun (x : PLift α) => b
          def ULift.map {α : Type u} {β : Type v} (f : αβ) (a : ULift.{u', u} α) :
          ULift.{v', v} β

          Functorial action.

          Instances For
            @[simp]
            theorem ULift.map_up {α : Type u} {β : Type v} (f : αβ) (a : α) :
            ULift.map f { down := a } = { down := f a }
            def ULift.pure {α : Type u} :
            αULift.{u_1, u} α

            Embedding of pure values.

            Instances For
              def ULift.seq {α : Type u_1} {β : Type u_2} (f : ULift.{u_3, max u_1 u_2} (αβ)) (x : UnitULift.{u_4, u_1} α) :
              ULift.{u, u_2} β

              Applicative sequencing.

              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
                  @[implicit_reducible]
                  instance ULift.instMonad_mathlib :
                  Monad ULift.{u_2, u_1}
                  instance ULift.instLawfulFunctor_mathlib :
                  LawfulFunctor ULift.{u_2, u_1}
                  instance ULift.instLawfulApplicative_mathlib :
                  LawfulApplicative ULift.{u_2, u_1}
                  instance ULift.instLawfulMonad_mathlib :
                  LawfulMonad ULift.{u_2, u_1}
                  @[simp]
                  theorem ULift.rec.constant {α : Type u} {β : Sort v} (b : β) :
                  (rec fun (x : α) => b) = fun (x : ULift.{u_1, u} α) => b