mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-24 12:14:26 +03:00
08b56e9e75
Allows quoting a term back to a TTImp. Test reflection007 shows one possible use for this, building a reflected, type safe, representation of an expression.
9 lines
403 B
Plaintext
9 lines
403 B
Plaintext
1/1: Building NatExpr (NatExpr.idr)
|
|
Main> Main.test1 : (x : Nat) -> (y : Nat) -> NatExpr (plus x (plus y x))
|
|
test1 x y = Plus (Val x) (Plus (Val y) (Val x))
|
|
Main> Main.test2 : (x : Nat) -> (y : Nat) -> NatExpr (plus x (mult y x))
|
|
test2 x y = Plus (Val x) (Mult (Val y) (Val x))
|
|
Main> Main.test3 : (x : Nat) -> Nat -> NatExpr (plus x (mult 2 x))
|
|
test3 x y = Plus (Val x) (Dbl (Val x))
|
|
Main> Bye for now!
|