Documentation

Init.Data.ToString.Basic

class ToString (α : Type u) :

Types that can be converted into a string for display.

There is no expectation that the resulting string can be parsed back to the original data (see Repr for a similar class with this expectation).

  • toString : αString

    Converts a value into a string.

Instances
    instance instToStringId {α : Type u_1} [ToString α] :
    Equations
      instance instToStringId_1 {α : Type u_1} [ToString α] :
      Equations
        Equations
          def List.toString {α : Type u_1} [ToString α] :
          List αString

          Converts a list into a string, using ToString.toString to convert its elements.

          The resulting string resembles list literal syntax, with the elements separated by ", " and enclosed in square brackets.

          The resulting string may not be valid Lean syntax, because there's no such expectation for ToString instances.

          Examples:

          Equations
            Instances For
              instance instToStringList {α : Type u} [ToString α] :
              Equations
                instance instToStringULift {α : Type u} [ToString α] :
                Equations
                  instance instToStringFin (n : Nat) :
                  Equations
                    Equations
                      Instances For
                        instance instToStringOption {α : Type u} [ToString α] :
                        Equations
                          instance instToStringSum {α : Type u} {β : Type v} [ToString α] [ToString β] :
                          ToString (α β)
                          Equations
                            instance instToStringProd {α : Type u} {β : Type v} [ToString α] [ToString β] :
                            ToString (α × β)
                            Equations
                              instance instToStringSigma {α : Type u} {β : αType v} [ToString α] [(x : α) → ToString (β x)] :
                              Equations
                                instance instToStringSubtype {α : Type u} {p : αProp} [ToString α] :
                                Equations
                                  instance instToStringExcept {ε : Type u_1} {α : Type u_2} [ToString ε] [ToString α] :
                                  Equations
                                    instance instReprExcept {ε : Type u_1} {α : Type u_2} [Repr ε] [Repr α] :
                                    Repr (Except ε α)
                                    Equations