Idris2/tests/idris2/reflection/reflection001/quote.idr

38 lines
701 B
Idris
Raw Normal View History

import Language.Reflection
add : TTImp -> TTImp -> TTImp
add x y = `(~(x) + ~(y))
test : TTImp
test = add `(3) `(4)
bigger : TTImp -> TTImp
bigger val
= `(let xfn : Int -> Int
xfn var = var * 2 in
xfn ~(val))
bigger' : Int -> TTImp
bigger' val
= `(let xfn : Int -> Int
xfn var = var * 2 in
xfn ~(IPrimVal EmptyFC (I val)))
bad : Int -> TTImp
bad val
= `(let xfn : Int -> Int
xfn var = var * 2 in
xfn ~(val))
names : List Name
names = [ `{ names }, `{ Prelude.(+) } ]
2020-09-16 00:29:48 +03:00
noExtension : Elab ()
noExtension = fail "Should not print this message"
%runElab noExtension
%language ElabReflection
%runElab noExtension