This is the first set of polymorphic methods. I will add more later, and keep reducing code duplication. cc @Kha
21 lines
320 B
Text
21 lines
320 B
Text
import Lean
|
|
open Lean
|
|
|
|
def x := 10
|
|
|
|
unsafe def tst : CoreM Unit := do
|
|
env ← getEnv;
|
|
IO.println $ env.evalConst Nat `x;
|
|
pure ()
|
|
|
|
#eval tst
|
|
|
|
def f (x : Nat) := x + 1
|
|
|
|
unsafe def tst2 : CoreM Unit := do
|
|
env ← getEnv;
|
|
f ← liftIO $ IO.ofExcept $ env.evalConst (Nat → Nat) `f;
|
|
IO.println $ (f 10);
|
|
pure ()
|
|
|
|
#eval tst2
|