package notty

Not available on OCaml 5.5
  1. Overview
  2. Docs
Declaring terminals

Install

dune-project
 Dependency

Authors

Maintainers

Sources

notty-0.2.3.tbz
sha256=74659fb14073db4438989891ab24f24bef81aa497dac16d9a67f9a1c9c200824
sha512=6e21d44fe39f3d80884b87635bebae55cb2b931ef74f9184ba4d74cc3e51cb0b3e976c3b6dc61d377288504e8bfabe21acdc1069eacb30df1fbf6686b80f7c6b

Description

Notty is a declarative terminal library for OCaml structured around a notion of composable images. It tries to abstract away the basic terminal programming model, providing something simpler and more expressive.

Added to opam-repository:

README

Notty — Declaring terminals

Notty is a declarative terminal library for OCaml structured around a notion of composable images. It tries to abstract away the basic terminal programming model, providing something simpler and more expressive.

The core layout engine and IO codecs are pure platform-independent OCaml. Distribution includes modules with input and output facilities for Unix, and Lwt on Unix.

As an attempt to redefine terminal programming, Notty has to be opinionated. It assumes Unicode throughout, does not have universal support for various terminals out there, and has a peculiar programming and rendering model.

Notty's core API was heavily influenced by Haskell's Vty.

Where to start

Check out the documentation, examples, or peek directly into the interface file.

Building with dune build @ex will produce several little example programs that also double as tests.

(* Game of Life with ZX Spectrum kitsch. *)

let dot : image = I.uchar A.(fg lightred) (Uchar.of_int 0x25cf) 1 1

let background step (n, m) =
  let k = 24. *. sin (float (step + m + n) /. 10.) |> truncate in
  if k > 0 then I.char A.(fg (gray k)) '.' 1 1 else I.void 1 1

let render (w, h) step life : image =
  I.tabulate w (h - 1) @@ fun x y ->
    let pt = (x, y) in
    if CSet.mem pt life then dot else background step pt

What?

  • Notty?

    Terminals are tedious to program for. Notty tries to abstract the tedium away, leaving you with a more pleasant programming surface that's quite unlike a TTY. Hence, No-TTY.

  • A new kind of Rust terminal?

    This Notty has no connection to any other body of code named Notty.

  • Why make yet another terminal output library?

    Because:

    • It allows one to describe what should be seen, as opposed to commanding a terminal.
    • It's pretty compact. Both bells and whistles can be implemented separately.
    • Core is easy to glue onto various IO backends.
    • Pure platform-independent OCaml.

Dependencies (4)

  1. uutf >= "1.0.0"
  2. cppo build & >= "1.1.0"
  3. dune >= "1.7"
  4. ocaml >= "4.08.0" & < "5.4"

Dev Dependencies

None

Optional Dependencies (1)

  1. lwt

Conflicts (1)

  1. lwt < "2.6.0"

Build status

Results of building notty with each compiler on check.ci.ocaml.org, run of against opam-repository 78c202b. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
0.2.3 (this version) good good good n/a n/a
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure