A small control-flow utility for unbounded loops with support for break
and
continue
ing loops.
By default it will loop infinitely, but it won't get in the way of unbounded exceptions or other unhandled effects.
opam install loop
The usage should feel rather natural:
- start a loop
- call
continue
orbreak
as you see fit
Here's a small REPL:
let repl () =
let open Loop in
loop (fun () ->
let expr = read () in
let result = eval expr in
print result;
match result with
| Exit -> break ()
| _ -> ())