style: Lean 4 compiler style in LeanInk

main
Henrik Böving 2023-01-01 19:53:21 +01:00
parent f74443a673
commit d5ef8006b7
2 changed files with 18 additions and 18 deletions

View File

@ -23,7 +23,7 @@ def getNextButtonLabel : AlectryonM String := do
let val ← get
let newCounter := val.counter + 1
set { val with counter := newCounter }
pure s!"plain-lean4-lean-chk{val.counter}"
return s!"plain-lean4-lean-chk{val.counter}"
def TypeInfo.toHtml (tyi : TypeInfo) : AlectryonM Html := do
pure
@ -106,7 +106,7 @@ def Goal.toHtml (g : Goal) : AlectryonM Html := do
let conclusionHtml ←
match g.conclusion with
| .typed info _ => infoFormatToHtml info
| .untyped str => pure <| #[Html.text str]
| .untyped str => pure #[Html.text str]
pure
<blockquote class="alectryon-goal">
@ -210,6 +210,6 @@ def annotationsToFragments (as : List Annotation.Annotation) : AnalysisM (List F
def renderAnnotations (as : List Annotation.Annotation) : HtmlT AnalysisM Html := do
let fs ← annotationsToFragments as
let (html, _) ← fs.mapM Fragment.toHtml >>= (baseHtml ∘ List.toArray) |>.run { counter := 0 }
pure html
return html
end LeanInk.Annotation.Alectryon

View File

@ -21,7 +21,7 @@ def docGenOutput (as : List LeanInk.Annotation.Annotation) : HtmlT LeanInk.Analy
let srcPath := moduleNameToFile srcBasePath modName
IO.FS.createDirAll srcDir
IO.FS.writeFile srcPath srcHtml.toString
pure 0
return 0
def execAuxM : HtmlT LeanInk.AnalysisM UInt32 := do
let ctx ← readThe SiteContext
@ -36,7 +36,7 @@ def execAux (config : LeanInk.Configuration) : HtmlT IO UInt32 := do
execAuxM.run (← readThe SiteContext) (← readThe SiteBaseContext) |>.run config
@[implemented_by enableInitializersExecution]
private def enableInitializersExecutionWrapper : IO Unit := pure ()
private def enableInitializersExecutionWrapper : IO Unit := return ()
def runInk (sourceFilePath : System.FilePath) : HtmlT IO Unit := do
let contents ← IO.FS.readFile sourceFilePath