Continuation representation of documents.
The operations provided by a pretty-printable document that don't depend on the document's representation type.
Indentation is expressed as integer space units.
Indentation is expressed as integer space units.
The final layout of a document as a string.
The final layout of a document as a string.
Interface for pretty-printable values.
Output medium width
Output medium width
An ampersand document.
An ampersand document.
Return a document that encloses a given document between left and right angle brackets.
Return a document that encloses a given document between left and right angle brackets.
Generic pretty-printer document for any type of value.
Generic pretty-printer document for any type of value. If a
is a
Vector
, Map
, List
or Product
, print it in a prefix list style,
with the exception that Nil
prints as Nil
. Tuples are pretty-printed
using arrow notation. Strings are pretty-printed surrounded by double
quotes. If none of these cases apply, use the toDoc
method on a
.
null
prints as null
.
Convert any value into a pretty-printable value.
Convert any value into a pretty-printable value. The value will
be pretty-printed using the value
combinator.
An asterisk document.
An asterisk document.
An at-sign document.
An at-sign document.
A backquote document.
A backquote document.
A backslash document.
A backslash document.
Return a document that encloses a given document between left and right braces.
Return a document that encloses a given document between left and right braces.
Return a document that encloses a given document between left and right square brackets.
Return a document that encloses a given document between left and right square brackets.
A caret document.
A caret document.
Return a document that concatenates the documents in the given sequence
either horizontally with <>
if they fit in the output medium width,
or if not, vertically with <@@>
.
Return a document that concatenates the documents in the given sequence
either horizontally with <>
if they fit in the output medium width,
or if not, vertically with <@@>
.
Convert a character to a document.
Convert a character to a document. The character can be a newline.
A colon document.
A colon document.
A comma document.
A comma document.
Default indentation is four spaces.
Default indentation is four spaces.
Default layout width is 75 characters.
Default layout width is 75 characters.
A dollar sign document.
A dollar sign document.
A dot (period) document.
A dot (period) document.
A double quote document.
A double quote document.
Return a document that encloses a given document between double quotes.
Return a document that encloses a given document between double quotes.
An empty document.
An empty document. This is a left and right unit for the concatenation
method. Called nil
in the paper.
Return a document that encloses a given document between left and right documents.
Return a document that encloses a given document between left and right documents.
An equal sign document.
An equal sign document.
An exclamation mark document.
An exclamation mark document.
Return a document that concatenates the documents in the given sequence
horizontally with <>
as long as they fit the output width, then
inserts a linebreak
and continues to the end of the sequence.
Return a document that concatenates the documents in the given sequence
horizontally with <>
as long as they fit the output width, then
inserts a linebreak
and continues to the end of the sequence.
Return a document that concatenates the documents in the given sequence
horizontally with <+>
as long as they fit the output width, then
inserts a line
and continues with the rest of the sequence.
Return a document that concatenates the documents in the given sequence
horizontally with <+>
as long as they fit the output width, then
inserts a line
and continues with the rest of the sequence. Separates
documents with the given separator before the <+>
.
Return a document that concatenates the documents in the given sequence
horizontally with <+>
as long as they fit the output width, then
inserts a line
and continues with the rest of the sequence.
Return a document that concatenates the documents in the given sequence
horizontally with <+>
as long as they fit the output width, then
inserts a line
and continues with the rest of the sequence.
Return a document that is the result of folding f
over the sequence
ds
.
Return a document that is the result of folding f
over the sequence
ds
. Returns the empty document is ds
is empty.
A forward slash document.
A forward slash document.
A document representing a choice among different ways to print a structure.
A document representing a choice among different ways to print a structure.
A hash mark document.
A hash mark document.
Return a document that concatenates the documents in the given sequence
horizontally with <>
.
Return a document that concatenates the documents in the given sequence
horizontally with <>
.
Return a document that concatenates the documents in the given sequence
horizontally with <+>
.
Return a document that concatenates the documents in the given sequence
horizontally with <+>
. Separates documents with the given separator
before the <+>
.
Return a document that concatenates the documents in the given sequence
horizontally with <+>
.
Return a document that concatenates the documents in the given sequence
horizontally with <+>
.
A left angle bracket document.
A left angle bracket document.
A left brace document.
A left brace document.
A left square bracket document.
A left square bracket document.
A document representing a potential line break.
A document representing a potential line break. Behaves like a space character if the break is omitted by a group.
A document representing a potential line break.
A document representing a potential line break. Behaves like the
string repl
if the break is omitted by a group.
A document representing a potential line break.
A document representing a potential line break. Behaves like an empty string if the break is omitted by a group.
Return a document that pretty-prints a list in Scala notation, inserting line breaks between elements as necessary.
Return a document that pretty-prints a list in Scala notation,
inserting line breaks between elements as necessary.
The prefix
string can be changed from the default "List"
.
The elemToDoc
argument can be used to alter the way each element
is converted to a document (default: use the value
combinator).
sep
defaults to comma
.
A left parenthesis document.
A left parenthesis document.
Return a pretty-printer document for a separated sequence.
Return a pretty-printer document for a separated sequence.
sep
is the separator. Line breaks are allowed before the sequence
and after the separators between the elements of the sequence. The
before line break turns into nothing if omitted. The internal line
breaks turn into space
if omitted.
Return a pretty-printer document for a separated sequence.
Return a pretty-printer document for a separated sequence.
sep
is the separator. Line breaks are allowed before the separators
between the elements of the sequence and at the end. A space
is
inserted after each separator. The internal line breaks turn into
space
if omitted. The end line break turns into nothing if omitted.
Return a pretty-printer document for a sequence where each element
is terminated by term
.
Return a pretty-printer document for a sequence where each element
is terminated by term
. Line breaks are allowed before the sequence
and after the terminator between the elements of the sequence. The
before line break turns into nothing if omitted. The internal line
breaks turn into space
if omitted.
An minus sign document.
An minus sign document.
Nest a document by an indentation increment on top of the current nesting.
Nest a document by an indentation increment on top of the current nesting. In the paper version, the indentation parameter comes first, but we put it second here so that it can be given a default value.
Return a document that encloses a given document between left and right parentheses.
Return a document that encloses a given document between left and right parentheses.
A percent sign document.
A percent sign document.
Return a document that pretty-prints a list of pretty-printables in Scala notation, inserting line breaks between elements as necessary.
Return a document that pretty-prints a list of pretty-printables
in Scala notation, inserting line breaks between elements as necessary.
The prefix
string can be changed from the default "List"
.
The elemToDoc
argument can be used to alter the way each element
is converted to a document (default: call the element's toDoc
method).
sep
defaults to a comma
.
An plus sign document.
An plus sign document.
Pretty print a document assuming a given output medium width.
Pretty print a document assuming a given output medium width. In the paper the width is the first parameter, but here we put it second so we can provide a default value.
Pretty-print a pretty-printable value.
Pretty-print a pretty-printable value. If the value passed is not a
pretty-printable document, it will be converted to one using the implicit
conversion anyToPrettyPrintable
.
Pretty-print any value using the any
method.
Pretty-print any value using the any
method.
Return a document that pretty-prints a sequence of pretty-printables in Scala notation, inserting line breaks between elements as necessary.
Return a document that pretty-prints a sequence of pretty-printables
in Scala notation, inserting line breaks between elements as necessary.
The prefix
string can be changed from the default "Seq"
.
The elemToDoc
argument can be used to alter the way each element
is converted to a document (default: call the element's toDoc
method).
sep
defaults to a comma
.
A question mark document.
A question mark document.
A right angle bracket document.
A right angle bracket document.
A right brace document.
A right brace document.
A right square bracket document.
A right square bracket document.
A right parenthesis document.
A right parenthesis document.
A semicolon document.
A semicolon document.
Return a document that concatenates the documents in the given sequence
either horizontally with <+>
if they fit in the output medium width,
or if not, vertically with <@>
.
Return a document that concatenates the documents in the given sequence
either horizontally with <+>
if they fit in the output medium width,
or if not, vertically with <@>
.
Return a document that pretty-prints a sequence in Scala notation, inserting line breaks between elements as necessary.
Return a document that pretty-prints a sequence in Scala notation,
inserting line breaks between elements as necessary.
The prefix
string can be changed from the default "Seq"
.
The elemToDoc
argument can be used to alter the way each element
is converted to a document (default: use the value
combinator).
sep
defaults to comma
.
Return a document that behaves like empty
if the resulting output
fits the page, otherwise it behaves like line
.
Return a document that behaves like empty
if the resulting output
fits the page, otherwise it behaves like line
.
Return a document that behaves like space
if the resulting output
fits the page, otherwise it behaves like line
.
Return a document that behaves like space
if the resulting output
fits the page, otherwise it behaves like line
.
A space document.
A space document.
Return a document representing n
spaces if n
s greater than zero,
otherwise return an empty document.
Return a document representing n
spaces if n
s greater than zero,
otherwise return an empty document.
A single quote document.
A single quote document.
Return a document that encloses a given document between single quotes.
Return a document that encloses a given document between single quotes.
Return a document that concatenates the documents in the given sequence
and separates adjacent documents with sep
with no space around the
separator.
Return a document that concatenates the documents in the given sequence
and separates adjacent documents with sep
with no space around the
separator.
Return a document that concatenates the documents in the given sequence
and terminates each document with term
.
Return a document that concatenates the documents in the given sequence
and terminates each document with term
.
Convert a string to a document.
Convert a string to a document. The string is allowed to contain
newline characters. If no newlines are included, it is best to
use text
directly instead.
Return a document that encloses a given document d
between two
occurrences of another document b
.
Return a document that encloses a given document d
between two
occurrences of another document b
.
Convert a string to a document.
Convert a string to a document. The string should not contain any
newline characters. Use line
instead.
A tilde document.
A tilde document.
An underscore document.
An underscore document.
Return a document representing a value formatted using toString
and
the string
combinator.
Return a document representing a value formatted using toString
and
the string
combinator. As a special case, if the value is a null
reference it is formatted as null
.
Return a document that concatenates the documents in the given sequence
vertically with <@@>
.
Return a document that concatenates the documents in the given sequence
vertically with <@@>
.
A vertical bar document.
A vertical bar document.
Return a document that concatenates the documents in the given sequence
vertically with <@>
.
Return a document that concatenates the documents in the given sequence
vertically with <@>
. Separates documents with the given separator
before the <@>
.
Return a document that concatenates the documents in the given sequence
vertically with <@>
.
Return a document that concatenates the documents in the given sequence
vertically with <@>
.
(Since version 1.2.1) Use PrettyPrinter.any instead.
A pretty-printer implemented using the continuation-based approach from Section 3.3 of Swierstra, S., and Chitil, O. Linear, bounded, functional pretty-printing. Journal of Functional Programming 19, 01 (2008), 1–16.
defaultIndent
specifies the indentation to use if none is specified in uses of thenest
method (default: 4).defaultWidth
specifies the default output width (default: 75).