The minimal structure needed to represent "string with interesting (tagged) substrings".
Much like Lean 3 sf
,
but with indentation already stringified.
- text: {α : Type u} → String → Lean.Widget.TaggedText α
- append: {α : Type u} → Array (Lean.Widget.TaggedText α) → Lean.Widget.TaggedText α
- tag: {α : Type u} → α → Lean.Widget.TaggedText α → Lean.Widget.TaggedText α
Instances For
Equations
- Lean.Widget.instBEqTaggedText = { beq := Lean.Widget.beqTaggedText✝ }
Equations
- Lean.Widget.instReprTaggedText = { reprPrec := Lean.Widget.reprTaggedText✝ }
Equations
- Lean.Widget.instFromJsonTaggedText = { fromJson? := Lean.Widget.fromJsonTaggedText✝ }
Equations
- Lean.Widget.instToJsonTaggedText = { toJson := Lean.Widget.toJsonTaggedText✝ }
Instances For
def
Lean.Widget.TaggedText.appendTag
{α : Type u_1}
(acc : Lean.Widget.TaggedText α)
(t₀ : α)
(a₀ : Lean.Widget.TaggedText α)
:
Equations
- (Lean.Widget.TaggedText.append as).appendTag t₀ a₀ = Lean.Widget.TaggedText.append (as.push (Lean.Widget.TaggedText.tag t₀ a₀))
- (Lean.Widget.TaggedText.text "").appendTag t₀ a₀ = Lean.Widget.TaggedText.tag t₀ a₀
- acc.appendTag t₀ a₀ = Lean.Widget.TaggedText.append #[acc, Lean.Widget.TaggedText.tag t₀ a₀]
Instances For
partial def
Lean.Widget.TaggedText.mapM
{m : Type u_1 → Type u_2}
{α : Type u_3}
{β : Type u_1}
[Monad m]
(f : α → m β)
:
Lean.Widget.TaggedText α → m (Lean.Widget.TaggedText β)
partial def
Lean.Widget.TaggedText.rewrite
{α : Type u_1}
{β : Type u_2}
(f : α → Lean.Widget.TaggedText α → Lean.Widget.TaggedText β)
:
partial def
Lean.Widget.TaggedText.rewriteM
{m : Type u_1 → Type u_2}
{α : Type u_3}
{β : Type u_1}
[Monad m]
(f : α → Lean.Widget.TaggedText α → m (Lean.Widget.TaggedText β))
:
Lean.Widget.TaggedText α → m (Lean.Widget.TaggedText β)
Like mapM
but allows rewriting the whole subtree at tag
nodes.
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.Widget.TaggedText.instInhabitedTaggedState = { default := { out := default, tagStack := default, column := default } }
Equations
- One or more equations did not get rendered due to their size.
def
Lean.Widget.TaggedText.prettyTagged
(f : Lean.Format)
(indent : Nat := 0)
(w : Nat := Std.Format.defWidth)
:
The output is tagged with (tag, indent)
where tag
is from the input Format
and indent
is the indentation level at this point. The latter is used to print sub-trees accurately by passing
it again as the indent
argument.
Instances For
Remove tags, leaving just the pretty-printed string.
Equations
- tt.stripTags = Lean.Widget.TaggedText.stripTags.go "" #[tt]