chore: Code cleanup #164

Merged
aniva merged 5 commits from chore/cleanup into dev 2025-01-26 22:04:13 -08:00
1 changed files with 2 additions and 3 deletions
Showing only changes of commit 976646fb67 - Show all commits

View File

@ -23,10 +23,10 @@ def parseCommand (s: String): Except String Command := do
return { cmd := s.take offset, payload := payload } return { cmd := s.take offset, payload := payload }
| .none => throw "Command is empty" | .none => throw "Command is empty"
partial def loop : MainM Unit := do partial def loop : MainM Unit := do repeat do
let state ← get let state ← get
let command ← (← IO.getStdin).getLine let command ← (← IO.getStdin).getLine
if command.trim.length = 0 then return () if command.trim.length = 0 then break
match parseCommand command with match parseCommand command with
| .error error => | .error error =>
let error := Lean.toJson ({ error := "command", desc := error }: InteractionError) let error := Lean.toJson ({ error := "command", desc := error }: InteractionError)
@ -43,7 +43,6 @@ partial def loop : MainM Unit := do
let message ← e.toMessageData.toString let message ← e.toMessageData.toString
let error := Lean.toJson ({ error := "main", desc := message }: InteractionError) let error := Lean.toJson ({ error := "main", desc := message }: InteractionError)
IO.println error.compress IO.println error.compress
loop
unsafe def main (args: List String): IO Unit := do unsafe def main (args: List String): IO Unit := do