package alba
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=4817038301d3e45bac9edf7e6f2fc8bf0a6d78e76e02ad7ea33ef69bcc17df3b
md5=25234357587126685d64f16236167937
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
.