This commit fixes issue reported at https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Command.20terminator/near/257674790
15 lines
421 B
Text
15 lines
421 B
Text
import Lean
|
||
open Lean
|
||
|
||
local macro "ofNat_class" Class:ident n:num : command =>
|
||
let field := Lean.mkIdent <| Class.getId.eraseMacroScopes.getString!.toLower
|
||
`(class $Class:ident.{u} (α : Type u) where
|
||
$field:ident : α
|
||
|
||
instance {α} [$Class α] : OfNat α (nat_lit $n) where
|
||
ofNat := ‹$Class α›.1
|
||
|
||
instance {α} [OfNat α (nat_lit $n)] : $Class α where
|
||
$field:ident := $n)
|
||
|
||
ofNat_class Zero 0
|