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
    Equations
    Equations
    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
      Equations
      instance instToStringULift {α : Type u} [ToString α] :
      Equations
      Equations
      Equations
      Equations
      Equations
      instance instToStringFin (n : Nat) :
      Equations
      Equations
      Equations
      Equations
      Equations
      Equations
      Equations
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        instance instToStringOption {α : Type u} [ToString α] :
        Equations
        • One or more equations did not get rendered due to their size.
        instance instToStringSum {α : Type u} {β : Type v} [ToString α] [ToString β] :
        ToString (α β)
        Equations
        • One or more equations did not get rendered due to their size.
        instance instToStringProd {α : Type u} {β : Type v} [ToString α] [ToString β] :
        ToString (α × β)
        Equations
        • One or more equations did not get rendered due to their size.
        instance instToStringSigma {α : Type u} {β : αType v} [ToString α] [(x : α) → ToString (β x)] :
        Equations
        • One or more equations did not get rendered due to their size.
        instance instToStringSubtype {α : Type u} {p : αProp} [ToString α] :
        Equations
        instance instToStringExcept {ε : Type u_1} {α : Type u_2} [ToString ε] [ToString α] :
        Equations
        • One or more equations did not get rendered due to their size.
        instance instReprExcept {ε : Type u_1} {α : Type u_2} [Repr ε] [Repr α] :
        Repr (Except ε α)
        Equations
        • One or more equations did not get rendered due to their size.