Documentation

PrimParser.GradedMonad.Basic

Graded Monads #

Type classes for functors, applicatives, and monads indexed by a grade. The raw versions require only Mul and One; the Lawful* classes require a Monoid.

@[reducible, inline]
abbrev GradedType (G : Sort u_1) :
Sort (max 2 u_1)

A type family indexed by a grade and a type.

Equations
Instances For
    class GradedFunctor {G : Type} (f : GradedType G) :

    Graded functor.

    • gmap {i : G} {α β : Type} (h : αβ) : f i αf i β
    Instances
      class GradedApplicative {G : Type} [One G] [Mul G] (f : GradedType G) extends GradedFunctor f :

      Graded applicative.

      • gmap {i : G} {α β : Type} (h : αβ) : f i αf i β
      • gpure {α : Type} : αf 1 α
      • gseq {i j : G} {α β : Type} : f i (αβ)(Unitf j α)f (i * j) β
      Instances
        class GradedMonad {G : Type} [One G] [Mul G] (m : GradedType G) extends GradedApplicative m :

        Graded monad.

        • gmap {i : G} {α β : Type} (h : αβ) : m i αm i β
        • gpure {α : Type} : αm 1 α
        • gseq {i j : G} {α β : Type} : m i (αβ)(Unitm j α)m (i * j) β
        • gbind {i j : G} {α β : Type} : m i α(αm j β)m (i * j) β
        Instances
          def gcast {G : Type} {f : GradedType G} {i j : G} {α : Type} (h : i = j) (x : f i α) :
          f j α

          Cast the grade of a graded type

          Equations
          Instances For
            @[reducible, inline]
            abbrev gconst {G : Type} {f : GradedType G} [GradedFunctor f] {i : G} {α β : Type} (b : β) (x : f i α) :
            f i β

            Replace the result of a graded computation with a constant value.

            Equations
            Instances For
              Instances
                Instances
                  Instances