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
The final layout of a document
Interface for pretty-printable values.
Output medium width
Output medium width
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.
Convert any value into a pretty-printable value.
Convert any value into a pretty-printable value. The value will be pretty-print using the value combinator.
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 parentheses.
Return a document that encloses a given document between left and right parentheses.
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 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.
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.
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.
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 <+>.
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 space if the break is omitted by a group.
A document representing a potential line break.
A document representing a potential line break. Behaves like empty 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: call the element's toDoc method). sep defaults to a 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 a 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 a space if omitted. The end line break turns into nothing if omitted.
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.
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.
Return a pretty-printer document for p.
Return a pretty-printer document for p. If p is a Product, print it in standard prefix list form, otherwise use p's toDoc method. As a special case, print lists as List (...) and Nil instead of using ::. Also, strings are printed with surrounding double quotes.
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 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 > 0, otherwise return an empty document.
Return a document representing n spaces if n > 0, 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.
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.
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 <@@>.
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 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 the nest method (defaults to 4). defaultWidth specifies the default output medium width (defaults to 75).