package alba
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=439b1dce07c86e914d1ebf1712c5581418314b0c8d13594f27a698b1d25fe272
md5=5cf58d4ed4eacbe6f330e9d2378ef5c6
doc/alba.fmlib/Fmlib/Readable_printer/index.html
Module Fmlib.Readable_printer
A readable printer is a structure you can issue print commands on and which returns a readable structure which can be read character by character.
Principles
A readable printer is a very lightweight and lazy structure. Issuing a command like string "hello"
just stores the string and does nothing else.
Since the printer is organized as a monoid you chain to printers p1
and p2
by p1 <+> p2
.
If you printed all your stuff to the printer p
you use readable p
to generate a readable structure. The readable structure is lazy as well. It just has the first item (string, substring, fill or character) explicitly and a function to generate the rest if needed. So the actual output is generated on demand.
Readable Structure
module R : Module_types.READABLE
The readable structure returned by the printer.
Basics
val empty : t
The readable printer printing nothing.
Print Commands
val string : string -> t
string s
prints the string s
.
val substring : string -> int -> int -> t
substring s start len
prints the substring of s
starting at position start
with length len
.
val fill : int -> char -> t
fill n c
prints the character c
n
times.
val char : char -> t
char c
prints the character c
.