Terminating a Process
You can use IO.Process.exit to terminate current process with a specific exit code. By convention, an exit code of 0 indicates success, and any non-zero code indicates an error.
def terminateProcess (someCondition : Bool) : IO Unit := do
if someCondition then
IO.Process.exit 0 -- Success
else
IO.println s!"Condition not met. Terminating process..."
IO.Process.exit 1
You can also spawn a new process using IO.Process.forceExit to force kill current process abrupty.
Also, you can kill any other process by spawning a child process and giving PID of victim process using Linux's kill command(or your machine's version for it) too.