import Language.Reflection %language ElabReflection powerFn : Nat -> TTImp powerFn Z = `(const 1) powerFn (S k) = `(\x => mult x (~(powerFn k) x)) cube : Nat -> Nat cube = %runElab check (powerFn 3)