Skip to content

Commit

Permalink
chore: more robust empty line handling
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-em committed Nov 1, 2023
1 parent 474db93 commit 4a1196a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions REPL/Main.lean
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,11 @@ open REPL

/-- Get lines from stdin until a blank line is entered. -/
partial def getLines : IO String := do
match (← (← IO.getStdin).getLine) with
| "" => pure ""
| "\n" => pure "\n"
| line => pure <| line ++ (← getLines)
let line ← (← IO.getStdin).getLine
return if line.trim.isEmpty then
line
else
line ++ (← getLines)

instance [ToJson α] [ToJson β] : ToJson (α ⊕ β) where
toJson x := match x with
Expand Down

0 comments on commit 4a1196a

Please sign in to comment.