miscelleaneous

Random Lean experiments

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
def main : IO Unit := do
  -- Read input immediately without waiting for newline
  _  IO.Process.run {
    cmd := "stty"
    args := #["-F", "/dev/tty", "cbreak", "min", "1"],
  }
  -- Hide user input
  _  IO.Process.run {
    cmd := "stty"
    args := #["-F", "/dev/tty", "-echo"],
  }
  let stdin  IO.getStdin
  while true do
    let a  stdin.read 1
    match String.fromUTF8? a with
    | some str => IO.println s!"Hello {str}"
    | none => return