Zulip Chat Archive

Stream: lean4

Topic: TSyntax `num from a `Nat`?


Scott Morrison (Jun 22 2023 at 05:02):

How do I get a TSyntax `num from a Nat?

Scott Morrison (Jun 22 2023 at 05:04):

Ah, found my own post with an answer, although it seems a bit round-about.

Scott Morrison (Jun 22 2023 at 05:04):

let n : TSyntax `num := Syntax.mkNumLit <| toString n

Kyle Miller (Jun 22 2023 at 05:23):

I think the most straightfoward way is let n : TSyntax `num := quote n

Kyle Miller (Jun 22 2023 at 05:24):

This is doing exactly the same thing (the instance is instance : Quote Nat numLitKind := ⟨fun n => Syntax.mkNumLit <| toString n⟩), but the quote interface is nicer


Last updated: Dec 20 2023 at 11:08 UTC