Idris2/tests/idris2/reflection/reflection021/QuoteSearch.idr
2023-09-07 14:57:22 +01:00

23 lines
470 B
Idris

module QuoteSearch
import Language.Reflection
%language ElabReflection
x : Elab Nat
x = check `(%search)
defy : Elab ()
defy = do
let fc = EmptyFC
val <- quote !x
logTerm "" 0 "Quoted term:" val
declare [
IClaim fc MW Private [] (MkTy fc fc (UN (Basic "y")) (IVar fc (UN (Basic "Nat")))),
IDef fc (UN (Basic "y")) [PatClause fc (IVar fc (UN (Basic "y"))) (IApp fc (IApp fc (IVar fc (UN (Basic "+"))) val) val)]
]
%runElab defy