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 : αNatLean.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
@[reducible, inline]
abbrev reprStr {α : Type u_1} [Repr α] (a : α) :
Equations
@[reducible, inline]
abbrev reprArg {α : Type u_1} [Repr α] (a : α) :
Equations
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
    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 α] :
    Equations
    instance instReprOption {α : Type u_1} [Repr α] :
    Equations
    • instReprOption = { reprPrec := Option.repr }
    def Sum.repr {α : Type u_1} {β : Type u_2} [Repr α] [Repr β] :
    α βNatLean.Format
    Equations
    instance instReprSum {α : Type u_1} {β : Type u_2} [Repr α] [Repr β] :
    Repr (α β)
    Equations
    • instReprSum = { reprPrec := Sum.repr }
    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 β] :
    α × βNatLean.Format
    Equations
    instance instReprProdOfReprTuple {α : Type u_1} {β : Type u_2} [Repr α] [ReprTuple β] :
    Repr (α × β)
    Equations
    • instReprProdOfReprTuple = { reprPrec := Prod.repr }
    instance instReprSigma {α : Type u_1} {β : αType v} [Repr α] [(x : α) → Repr (β x)] :
    Repr (Sigma β)
    Equations
    instance instReprSubtype {α : Type u_1} {p : αProp} [Repr α] :
    Equations
    Equations
    • One or more equations did not get rendered due to their size.
    def Nat.toDigitsCore (base : Nat) :
    NatNatList CharList Char
    Equations
    • base.toDigitsCore 0 x✝ x = x
    • base.toDigitsCore fuel.succ x✝ x = if x✝ / base = 0 then (x✝ % base).digitChar :: x else base.toDigitsCore fuel (x✝ / base) ((x✝ % base).digitChar :: x)
    def Nat.toDigits (base : Nat) (n : Nat) :
    Equations
    • base.toDigits n = base.toDigitsCore (n + 1) n []
    @[extern lean_string_of_usize]
    Equations
    @[implemented_by _private.Init.Data.Repr.0.Nat.reprFast]
    def Nat.repr (n : Nat) :
    Equations
    Equations
    • One or more equations did not get rendered due to their size.
    Equations
    • n.toSuperDigits = n.toSuperDigitsAux []
    Equations
    • n.toSuperscriptString = n.toSuperDigits.asString
    Equations
    • One or more equations did not get rendered due to their size.
    Equations
    • n.toSubDigits = n.toSubDigitsAux []
    Equations
    • n.toSubscriptString = n.toSubDigits.asString
    instance instReprNat :
    Equations
    Equations
    instance instReprInt :
    Equations
    Equations
    Equations
    • One or more equations did not get rendered due to their size.
    Equations
    • c.quote = "'" ++ c.quoteCore ++ "'"
    Equations
    def Char.repr (c : Char) :
    Equations
    • c.repr = c.quote
    Equations
    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
    instance instReprList {α : Type u_1} [Repr α] :
    Repr (List α)
    Equations
    • instReprList = { reprPrec := List.repr }
    def List.repr' {α : Type u_1} [Repr α] [ReprAtom α] (a : List α) (n : Nat) :
    Equations
    instance instReprListOfReprAtom {α : Type u_1} [Repr α] [ReprAtom α] :
    Repr (List α)
    Equations
    • instReprListOfReprAtom = { reprPrec := List.repr' }