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 : α → Nat → Std.Format
Turn a value of type
α
intoFormat
at a given precedence. The precedence value can be used to avoid parentheses if they are not necessary.
Instances
Equations
Instances For
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
- reprTuple : α → List Std.Format → List Std.Format
Instances
Equations
Instances For
Equations
Instances For
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
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', '*']
Equations
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
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
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
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
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 = "₃₅"