-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmoduledeps.lean
33 lines (30 loc) · 972 Bytes
/
moduledeps.lean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import LeanAide.ImportList
import Lean.Meta
import LeanAide.Config
open Lean Meta
set_option maxHeartbeats 10000000
set_option maxRecDepth 1000
set_option compiler.extract_closed false
def main (args: List String) : IO Unit := do
initSearchPath (← Lean.findSysroot) initFiles
let nameStr := args.head!
let name : Name := nameStr.toName
let env ←
importModules #[
{module:= `LeanAide.ImportList},
{module:= name}] {}
let core : CoreM Nat :=
writeImport nameStr
let io? :=
core.run' {fileName := "", fileMap := {source:= "", positions := #[]}, maxHeartbeats := 100000000000, maxRecDepth := 1000000, openDecls := [Lean.OpenDecl.simple `LeanAide.Meta []]
}
{env := env}
match ← io?.toIO' with
| Except.ok cursor =>
IO.println s!"Success: got {cursor} names"
| Except.error e =>
do
IO.println "Ran with error"
let msg ← e.toMessageData.toString
IO.throwServerError msg
return ()