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 : α → Nat → Std.Format
Turn a value of type
αinto aFormatat a given precedence. The precedence value can be used to avoid parentheses if they are not necessary.
Instances
Turns a into a Format using its Repr instance, with the precedence level set to that of
function application.
Together with Repr.addAppParen, this can be used to correctly parenthesize function application
syntax.
Instances For
Equations
Equations
Equations
- true.repr x✝ = Std.Format.text "true"
- false.repr x✝ = Std.Format.text "false"
Instances For
Adds parentheses to f if the precedence prec from the context is at least that of function
application.
Together with reprArg, this can be used to correctly parenthesize function application
syntax.
Instances For
Equations
- (isTrue h).repr x✝ = Repr.addAppParen (Std.Format.text "isTrue _") x✝
- (isFalse h).repr x✝ = Repr.addAppParen (Std.Format.text "isFalse _") x✝
Instances For
Equations
- instReprDecidable = { reprPrec := Decidable.repr }
Equations
- instReprPUnit = { reprPrec := fun (x : PUnit) (x : Nat) => Std.Format.text "PUnit.unit" }
Equations
- instReprULift = { reprPrec := fun (v : ULift α) (prec : Nat) => Repr.addAppParen (Std.Format.text "ULift.up " ++ reprArg v.down) prec }
Equations
- instReprUnit = { reprPrec := fun (x : Unit) (x : Nat) => Std.Format.text "()" }
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
- none.repr x✝ = Std.Format.text "none"
- (some a).repr x✝ = Repr.addAppParen (Std.Format.text "some " ++ reprArg a) x✝
Instances For
Equations
- instReprOption = { reprPrec := Option.repr }
Equations
- (Sum.inl a).repr x✝ = Repr.addAppParen (Std.Format.text "Sum.inl " ++ reprArg a) x✝
- (Sum.inr b).repr x✝ = Repr.addAppParen (Std.Format.text "Sum.inr " ++ reprArg b) x✝
Instances For
- reprTuple : α → List Std.Format → List Std.Format
Instances
Equations
- instReprTupleOfRepr = { reprTuple := fun (a : α) (xs : List Std.Format) => repr a :: xs }
Equations
- instReprTupleProdOfRepr = { reprTuple := Prod.reprTuple }
Equations
- (a, b).repr x✝ = Std.Format.bracket "(" (Std.Format.joinSep (reprTuple b [repr a]).reverse (Std.Format.text "," ++ Std.Format.line)) ")"
Instances For
Equations
- ⟨a, b⟩.repr x✝ = Std.Format.bracket "⟨" (repr a ++ Std.Format.text ", " ++ repr b) "⟩"
Instances For
Equations
- instReprSigma = { reprPrec := Sigma.repr }
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:
Nat.digitChar 5 = '5'Nat.digitChar 12 = 'c'Nat.digitChar 15 = 'f'Nat.digitChar 16 = '*'Nat.digitChar 85 = '*'
Equations
- One or more equations did not get rendered due to their size.
Instances For
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:
Nat.toDigits 10 0xff = ['2', '5', '5']Nat.toDigits 8 0xc = ['1', '4']Nat.toDigits 16 0xcafe = ['c', 'a', 'f', 'e']Nat.toDigits 80 200 = ['2', '*']
Instances For
Converts a word-sized unsigned integer into a decimal string.
This function is overridden at runtime with an efficient implementation.
Examples:
USize.repr 0 = "0"USize.repr 28 = "28"USize.repr 307 = "307"
Equations
- n.repr = (Nat.toDigits 10 n.toNat).asString
Instances For
Equations
- n.reprFast = if h : n < Nat.reprArray✝.size then Nat.reprArray✝¹.getInternal n h else if h : n < USize.size then (USize.ofNatLT n h).repr else (Nat.toDigits 10 n).asString
Instances For
Converts a natural number less than 10 to the corresponding Unicode superscript digit character.
Returns '*' for other numbers.
Examples:
Nat.superDigitChar 3 = '³'Nat.superDigitChar 7 = '⁷'Nat.superDigitChar 10 = '*'
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:
Nat.toSuperDigits 0 = ['⁰']Nat.toSuperDigits 35 = ['³', '⁵']
Equations
Instances For
Converts a natural number to a string that contains the its decimal representation as Unicode superscript digit characters.
Examples:
Nat.toSuperscriptString 0 = "⁰"Nat.toSuperscriptString 35 = "³⁵"
Equations
Instances For
Converts a natural number less than 10 to the corresponding Unicode subscript digit character.
Returns '*' for other numbers.
Examples:
Nat.subDigitChar 3 = '₃'Nat.subDigitChar 7 = '₇'Nat.subDigitChar 10 = '*'
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:
Nat.toSubDigits 0 = ['₀']Nat.toSubDigits 35 = ['₃', '₅']
Equations
- n.toSubDigits = n.toSubDigitsAux []
Instances For
Converts a natural number to a string that contains the its decimal representation as Unicode subscript digit characters.
Examples:
Nat.toSubscriptString 0 = "₀"Nat.toSubscriptString 35 = "₃₅"
Equations
Instances For
Equations
- instReprNat = { reprPrec := fun (n x : Nat) => Std.Format.text n.repr }
Equations
- instReprInt = { reprPrec := fun (i : Int) (prec : Nat) => if i < 0 then Repr.addAppParen (Std.Format.text i.repr) prec else Std.Format.text i.repr }
Equations
Instances For
Quotes the character to its representation as a character literal, surrounded by single quotes and escaped as necessary.
Examples:
Equations
- c.quote = String.Internal.append (String.Internal.append "'" c.quoteCore) "'"
Instances For
Equations
- instReprChar = { reprPrec := fun (c : Char) (x : Nat) => Std.Format.text c.quote }
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
- One or more equations did not get rendered due to their size.
Instances For
Equations
- instReprString = { reprPrec := fun (s : String) (x : Nat) => Std.Format.text s.quote }
Equations
- instReprPos = { reprPrec := fun (p : String.Pos) (x : Nat) => Std.Format.text "{ byteIdx := " ++ repr p.byteIdx ++ Std.Format.text " }" }
Equations
- instReprSubstring = { reprPrec := fun (s : Substring) (x : Nat) => Std.Format.text (String.Internal.append (Substring.Internal.toString s).quote ".toSubstring") }
Equations
- [].repr n = Std.Format.text "[]"
- a.repr n = Std.Format.bracket "[" (Std.Format.joinSep a (Std.Format.text "," ++ Std.Format.line)) "]"
Instances For
Equations
- [].repr' n = Std.Format.text "[]"
- a.repr' n = Std.Format.bracketFill "[" (Std.Format.joinSep a (Std.Format.text "," ++ Std.Format.line)) "]"
Instances For
Equations
- instReprListOfReprAtom = { reprPrec := List.repr' }
Equations
- One or more equations did not get rendered due to their size.
- instReprSourceInfo.repr Lean.SourceInfo.none prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "Lean.SourceInfo.none")).group prec✝
Instances For
Equations
- instReprSourceInfo = { reprPrec := instReprSourceInfo.repr }