package loop

  1. Overview
  2. Docs
Unbounded loops with continues and breaks

Install

Dune Dependency

Authors

Maintainers

Sources

loop-0.0.1.tbz
sha256=2b1ca83ae07257212f4dccd962a33d84a28fa33c792134bb1d2f8b65dff8b2ac
sha512=ae285fd979a47702108fbf30f2d257a7190c308c6ea71e707a9d7cad29d9ed42f469696ff140c75867648450b482b66238ae79b1b4ac051de12dd07685061a9d

README.md.html

loop

A small control-flow utility for unbounded loops with support for break and continueing loops.

By default it will loop infinitely, but it won't get in the way of unbounded exceptions or other unhandled effects.

Getting Started

opam install loop

Usage

The usage should feel rather natural:

  1. start a loop

  2. call continue or break as you see fit

Examples

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 ()
    | _ -> ())
OCaml

Innovation. Community. Security.