Documentation

Init.Data.Repr

class Repr (α : Type u) :

A typeclass that specifies the standard way of turning values of some type into Format.

When rendered this Format should be as close as possible to something that can be parsed as the input value.

  • reprPrec : αNatStd.Format

    Turn a value of type α into Format at a given precedence. The precedence value can be used to avoid parentheses if they are not necessary.

Instances
    @[reducible, inline]
    abbrev repr {α : Type u_1} [Repr α] (a : α) :

    Turn a into Format using its Repr instance. The precedence level is initially set to 0.

    Equations
    Instances For
      @[reducible, inline]
      abbrev reprStr {α : Type u_1} [Repr α] (a : α) :
      Equations
      Instances For
        @[reducible, inline]
        abbrev reprArg {α : Type u_1} [Repr α] (a : α) :
        Equations
        Instances For
          class ReprAtom (α : Type u) :

          Auxiliary class for marking types that should be considered atomic by Repr methods. We use it at Repr (List α) to decide whether bracketFill should be used or not.

            Instances
              instance instReprId {α : Type u_1} [Repr α] :
              Repr (id α)
              Equations
              instance instReprId_1 {α : Type u_1} [Repr α] :
              Repr (Id α)
              Equations
              Equations
              Equations
              Equations
              Instances For
                instance instReprDecidable {p : Prop} :
                Equations
                • One or more equations did not get rendered due to their size.
                Equations
                instance instReprULift {α : Type u_1} [Repr α] :
                Repr (ULift α)
                Equations
                Equations
                def Option.repr {α : Type u_1} [Repr α] :
                Option αNatStd.Format

                Returns a representation of an optional value that should be able to be parsed as an equivalent optional value.

                This function is typically accessed through the Repr (Option α) instance.

                Equations
                Instances For
                  instance instReprOption {α : Type u_1} [Repr α] :
                  Equations
                  def Sum.repr {α : Type u_1} {β : Type u_2} [Repr α] [Repr β] :
                  α βNatStd.Format
                  Equations
                  Instances For
                    instance instReprSum {α : Type u_1} {β : Type u_2} [Repr α] [Repr β] :
                    Repr (α β)
                    Equations
                    class ReprTuple (α : Type u) :
                    Instances
                      instance instReprTupleOfRepr {α : Type u_1} [Repr α] :
                      Equations
                      instance instReprTupleProdOfRepr {α : Type u_1} {β : Type u_2} [Repr α] [ReprTuple β] :
                      ReprTuple (α × β)
                      Equations
                      def Prod.repr {α : Type u_1} {β : Type u_2} [Repr α] [ReprTuple β] :
                      α × βNatStd.Format
                      Equations
                      Instances For
                        instance instReprProdOfReprTuple {α : Type u_1} {β : Type u_2} [Repr α] [ReprTuple β] :
                        Repr (α × β)
                        Equations
                        instance instReprSigma {α : Type u_1} {β : αType v} [Repr α] [(x : α) → Repr (β x)] :
                        Repr (Sigma β)
                        Equations
                        instance instReprSubtype {α : Type u_1} {p : αProp} [Repr α] :
                        Equations

                        Returns a single digit representation of n, which is assumed to be in a base less than or equal to 16. Returns '*' if n > 15.

                        Examples:

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          def Nat.toDigitsCore (base : Nat) :
                          NatNatList CharList Char
                          Equations
                          Instances For
                            def Nat.toDigits (base n : Nat) :

                            Returns the decimal representation of a natural number as a list of digit characters in the given base. If the base is greater than 16 then '*' is returned for digits greater than 0xf.

                            Examples:

                            Equations
                            Instances For
                              @[extern lean_string_of_usize]

                              Converts a word-sized unsigned integer into a decimal string.

                              This function is overridden at runtime with an efficient implementation.

                              Examples:

                              Equations
                              Instances For
                                @[implemented_by _private.Init.Data.Repr.0.Nat.reprFast]
                                def Nat.repr (n : Nat) :

                                Converts a natural number to its decimal string representation.

                                Equations
                                Instances For

                                  Converts a natural number less than 10 to the corresponding Unicode superscript digit character. Returns '*' for other numbers.

                                  Examples:

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For

                                    Converts a natural number to the list of Unicode superscript digit characters that corresponds to its decimal representation.

                                    Examples:

                                    Equations
                                    Instances For

                                      Converts a natural number to a string that contains the its decimal representation as Unicode superscript digit characters.

                                      Examples:

                                      Equations
                                      Instances For

                                        Converts a natural number less than 10 to the corresponding Unicode subscript digit character. Returns '*' for other numbers.

                                        Examples:

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For

                                          Converts a natural number to the list of Unicode subscript digit characters that corresponds to its decimal representation.

                                          Examples:

                                          Equations
                                          Instances For

                                            Converts a natural number to a string that contains the its decimal representation as Unicode subscript digit characters.

                                            Examples:

                                            Equations
                                            Instances For
                                              instance instReprNat :
                                              Equations

                                              Returns the decimal string representation of an integer.

                                              Equations
                                              Instances For
                                                instance instReprInt :
                                                Equations
                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For

                                                  Quotes the character to its representation as a character literal, surrounded by single quotes and escaped as necessary.

                                                  Examples:

                                                  Equations
                                                  Instances For
                                                    Equations
                                                    def Char.repr (c : Char) :
                                                    Equations
                                                    Instances For

                                                      Converts a string to its corresponding Lean string literal syntax. Double quotes are added to each end, and internal characters are escaped as needed.

                                                      Examples:

                                                      Equations
                                                      Instances For
                                                        Equations
                                                        Equations
                                                        Equations
                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        instance instReprFin (n : Nat) :
                                                        Repr (Fin n)
                                                        Equations
                                                        Equations
                                                        Equations
                                                        Equations
                                                        Equations
                                                        Equations
                                                        def List.repr {α : Type u_1} [Repr α] (a : List α) (n : Nat) :
                                                        Equations
                                                        Instances For
                                                          instance instReprList {α : Type u_1} [Repr α] :
                                                          Repr (List α)
                                                          Equations
                                                          def List.repr' {α : Type u_1} [Repr α] [ReprAtom α] (a : List α) (n : Nat) :
                                                          Equations
                                                          Instances For
                                                            instance instReprListOfReprAtom {α : Type u_1} [Repr α] [ReprAtom α] :
                                                            Repr (List α)
                                                            Equations