fix: remove redundant argument

main
Henrik Böving 2022-07-21 02:25:26 +02:00
parent 9962e5037a
commit fbbdb21795
4 changed files with 10 additions and 9 deletions

View File

@ -19,7 +19,7 @@ Sets up a lake workspace for the current project. Furthermore initialize
the Lean search path with the path to the proper compiler from lean-toolchain
as well as all the dependencies.
-/
def lakeSetup (imports : List String) : IO (Except UInt32 (Lake.Workspace × String)) := do
def lakeSetup (imports : List String) : IO (Except UInt32 Lake.Workspace) := do
let (leanInstall?, lakeInstall?) ← Lake.findInstall?
match ←(EIO.toIO' $ Lake.mkLoadConfig {leanInstall?, lakeInstall?}) with
| .ok config =>
@ -30,7 +30,7 @@ def lakeSetup (imports : List String) : IO (Except UInt32 (Lake.Workspace × Str
let ctx ← Lake.mkBuildContext ws
(ws.root.buildImportsAndDeps imports *> pure ()) |>.run Lake.MonadLog.eio ctx
initSearchPath (←findSysroot) ws.leanPaths.oleanPath
pure $ Except.ok (ws, libraryLeanGitHash)
pure $ Except.ok ws
| .error err =>
throw $ IO.userError err.toString

View File

@ -82,10 +82,10 @@ def Process.Module.toJson (module : Module) : HtmlM (Array Json) := do
jsonDecls := jsonDecls.push json
pure jsonDecls
def htmlOutputResults (baseConfig : SiteBaseContext) (result : AnalyzerResult) (ws : Lake.Workspace) (leanHash: String) (inkPath : Option System.FilePath) : IO Unit := do
def htmlOutputResults (baseConfig : SiteBaseContext) (result : AnalyzerResult) (ws : Lake.Workspace) (inkPath : Option System.FilePath) : IO Unit := do
let config : SiteContext := {
result := result,
sourceLinker := ←sourceLinker ws leanHash
sourceLinker := ←sourceLinker ws
leanInkEnabled := inkPath.isSome
}
let basePath := FilePath.mk "." / "build" / "doc"
@ -136,10 +136,10 @@ def getSimpleBaseContext (hierarchy : Hierarchy) : SiteBaseContext :=
The main entrypoint for outputting the documentation HTML based on an
`AnalyzerResult`.
-/
def htmlOutput (result : AnalyzerResult) (hierarchy : Hierarchy) (ws : Lake.Workspace) (leanHash: String) (inkPath : Option System.FilePath) : IO Unit := do
def htmlOutput (result : AnalyzerResult) (hierarchy : Hierarchy) (ws : Lake.Workspace) (inkPath : Option System.FilePath) : IO Unit := do
let baseConfig := getSimpleBaseContext hierarchy
htmlOutputSetup baseConfig
htmlOutputResults baseConfig result ws leanHash inkPath
htmlOutputResults baseConfig result ws inkPath
end DocGen4

View File

@ -54,7 +54,8 @@ Given a lake workspace with all the dependencies as well as the hash of the
compiler release to work with this provides a function to turn names of
declarations into (optionally positional) Github URLs.
-/
def sourceLinker (ws : Lake.Workspace) (leanHash : String): IO (Name → Option DeclarationRange → String) := do
def sourceLinker (ws : Lake.Workspace) : IO (Name → Option DeclarationRange → String) := do
let leanHash := ws.env.lean.githash
-- Compute a map from package names to source URL
let mut gitMap := Std.mkHashMap
let projectBaseUrl := getGithubBaseUrl (←getProjectGithubUrl)

View File

@ -22,7 +22,7 @@ def runDocGenCmd (p : Parsed) : IO UInt32 := do
let res ← lakeSetup modules
let modules := modules.map Name.mkSimple
match res with
| Except.ok (ws, leanHash) =>
| Except.ok ws =>
IO.println s!"Loading modules from: {←searchPathRef.get}"
--if p.hasFlag "single" then
-- if modules.length ≠ 1 then
@ -47,7 +47,7 @@ def runDocGenCmd (p : Parsed) : IO UInt32 := do
--else
let (doc, hierarchy) ← load modules true
IO.println "Outputting HTML"
htmlOutput doc hierarchy ws leanHash (←findLeanInk? p)
htmlOutput doc hierarchy ws (←findLeanInk? p)
pure 0
| Except.error rc => pure rc