Created
August 18, 2025 07:18
-
-
Save cppio/44fc86752e41eccc0436184594d4d2ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Lean.Elab.Term | |
deriving instance Lean.ToExpr for String.Pos | |
deriving instance Lean.ToExpr for Substring | |
deriving instance Lean.ToExpr for Lean.SourceInfo | |
deriving instance Lean.ToExpr for Lean.Syntax | |
syntax "log! " (interpolatedStr(term) <|> term:arg) : term | |
@[term_elab termLog!__] | |
def elabLog! : Lean.Elab.Term.TermElab | |
| `(log!%$tk $m:interpolatedStr), expectedType? => do | |
let tk ← Lean.Elab.Term.exprToSyntax (Lean.toExpr tk) | |
Lean.Elab.Term.elabTerm (← ``(Lean.logInfoAt $tk m!$m)) expectedType? | |
| `(log!%$tk $m:term), expectedType? => do | |
let tk ← Lean.Elab.Term.exprToSyntax (Lean.toExpr tk) | |
Lean.Elab.Term.elabTerm (← ``(Lean.logInfoAt $tk $m)) expectedType? | |
| _, _ => Lean.Elab.throwUnsupportedSyntax |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment