mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-16 07:34:45 +03:00
2a75731916
So the type of Elab now gives the expected type that's being elaborated to, meaning that we can run 'check' in the middle of scripts and use the result.
15 lines
252 B
Idris
15 lines
252 B
Idris
import Language.Reflection
|
|
|
|
%language ElabReflection
|
|
|
|
powerFn : Nat -> TTImp
|
|
powerFn Z = `(const 1)
|
|
powerFn (S k) = `(\x => mult x (~(powerFn k) x))
|
|
|
|
%macro
|
|
power : Nat -> Elab (Nat -> Nat)
|
|
power n = check (powerFn n)
|
|
|
|
cube : Nat -> Nat
|
|
cube = power 3
|