Packages

package pp

Pretty-printer library based on the Wadler's paper "A Prettier Printer".

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. pp
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. final case class AlignDoc (inner: Doc) extends Doc with Product with Serializable

    Align document: aligns the document on the current column.

  2. final case class ColumnDoc (f: (Int) ⇒ Doc) extends Doc with Product with Serializable

    Column document: creates a document depending on the current column.

  3. final case class ConsDoc (first: Doc, second: Doc) extends Doc with Product with Serializable

    Cons document: Concatenation of two documents.

  4. sealed trait CountUnit extends AnyRef
  5. sealed trait Doc extends AnyRef

    A document that can then be laid out.

  6. final case class LineDoc (repl: Doc) extends Doc with Product with Serializable

    Line document: renders as a new line except if discarded by a group.

  7. final case class NestDoc (indent: Int, inner: Doc) extends Doc with Product with Serializable

    Nest document: new lines are indented by the given indentation.

  8. class PrettyRenderer extends (Doc) ⇒ SimpleDoc

    A pretty printer, that tries to make the document fit in the page width

  9. final case class SLine (indent: Int, next: SimpleDoc) extends SimpleDoc with Product with Serializable

    A new line document with the indentation level to print right after.

    A new line document with the indentation level to print right after. If the next document is empty, the indentation is not printed.

  10. final case class SText (text: String, next: SimpleDoc) extends SimpleDoc with Product with Serializable

    A text document.

    A text document. Should never contain new lines

  11. sealed trait SimpleDoc extends AnyRef

    A simple document is the normalized form of a document.

    A simple document is the normalized form of a document.

    This is what is produced by the renderers depending on their rendering algorithm.

  12. final case class TextDoc (text: String) extends Doc with Product with Serializable

    Text document: shall not contain any new lines.

  13. class TruncateRenderer extends (Doc) ⇒ SimpleDoc

    A renderer that truncates the result (once rendered by the inner renderer) with the given limit.

    A renderer that truncates the result (once rendered by the inner renderer) with the given limit. It makes the assumption that the following invariants are respected:

  14. final case class UnionDoc (long: Doc, short: Doc) extends Doc with Product with Serializable

    Union document: two variations of the same document.

    Union document: two variations of the same document. Note: The long-document's first lines must be longer that the short-document's ones.

Value Members

  1. def align(doc: Doc): Doc

    Renders the document with nesting level set to the current column

    Renders the document with nesting level set to the current column

    Annotations
    @inline()
  2. implicit def c2doc(c: Char): Doc
    Annotations
    @inline()
  3. def cat(docs: TraversableLike[Doc, _]): Doc

    Renders a document that trie to append the documents in the collection horizontally, otherwise append them vertically

    Renders a document that trie to append the documents in the collection horizontally, otherwise append them vertically

    Annotations
    @inline()
  4. def char(c: Char): Doc

    Creates a document from the given character

  5. implicit def d2doc(d: Double): Doc
    Annotations
    @inline()
  6. def double(d: Double): Doc

    Creates a document from the given double

    Creates a document from the given double

    Annotations
    @inline()
  7. val empty: Doc

    Renders as an empty string

  8. implicit def f2doc(f: Float): Doc
    Annotations
    @inline()
  9. def fill(until: Int)(doc: Doc): Doc

    Renders the document as usual, and then fills until width with spaces if necessary

    Renders the document as usual, and then fills until width with spaces if necessary

    Annotations
    @inline()
  10. def fillCat(docs: TraversableLike[Doc, _]): Doc

    Renders a document that appends all document in the collection horizontally, separated by a softbreak

    Renders a document that appends all document in the collection horizontally, separated by a softbreak

    Annotations
    @inline()
  11. def fillSep(docs: TraversableLike[Doc, _]): Doc

    Renders a document in which all documents in the collection are appended vertically, separated by a softline

    Renders a document in which all documents in the collection are appended vertically, separated by a softline

    Annotations
    @inline()
  12. def float(f: Float): Doc

    Creates a document from the given float

    Creates a document from the given float

    Annotations
    @inline()
  13. def group(doc: Doc): Doc

    Discards all line breaks in the given document if the result fits in the page, otherwise, renders without any changes

    Discards all line breaks in the given document if the result fits in the page, otherwise, renders without any changes

    Annotations
    @inline()
  14. def hang(indent: Int)(doc: Doc): Doc

    Renders the document with nesting level set to the current column plus indent

    Renders the document with nesting level set to the current column plus indent

    Annotations
    @inline()
  15. def hcat(docs: TraversableLike[Doc, _]): Doc

    Renders a document that appends the document in the collection horizontally

    Renders a document that appends the document in the collection horizontally

    Annotations
    @inline()
  16. def hsep(docs: TraversableLike[Doc, _]): Doc

    Renders a document in which all documents in the collection are appended horizontally, separated by a space

    Renders a document in which all documents in the collection are appended horizontally, separated by a space

    Annotations
    @inline()
  17. implicit def i2doc(i: Int): Doc
    Annotations
    @inline()
  18. def indent(i: Int)(doc: Doc): Doc

    Renders the document with prepending n spaces to the current column

    Renders the document with prepending n spaces to the current column

    Annotations
    @inline()
  19. def int(i: Int): Doc

    Creates a document from the given integer

    Creates a document from the given integer

    Annotations
    @inline()
  20. implicit def l2doc(l: Long): Doc
    Annotations
    @inline()
  21. val line: Doc

    Renders as a new line unless it is discarded by a group, in which case behaves like space

  22. def lineOr(replacement: ⇒ Doc): Doc

    Behaves like a new line unless it is discarded by a group, in which case, behaves like the replacement document

    Behaves like a new line unless it is discarded by a group, in which case, behaves like the replacement document

    Annotations
    @inline()
  23. val linebreak: Doc

    Renders as a new line unless it is discarded by a group, in which case behaves like empty

  24. def long(l: Long): Doc

    Creates a document from the given long

    Creates a document from the given long

    Annotations
    @inline()
  25. def nest(indent: Int)(inner: Doc): Doc

    Indents the document

    Indents the document

    Annotations
    @inline()
  26. implicit def opt2doc[T](o: Option[T])(implicit ev: (T) ⇒ Doc): Doc
  27. implicit def s2doc(s: String): Doc
    Annotations
    @inline()
  28. def sep(docs: TraversableLike[Doc, _]): Doc

    Renders a document that tries to append the documents in the collection horizontally separated by a space if it fits, otherwise append them vertically

    Renders a document that tries to append the documents in the collection horizontally separated by a space if it fits, otherwise append them vertically

    Annotations
    @inline()
  29. val softbreak: Doc

    Behaves like empty if the result fits in the page, otherwise behaves like line

  30. val softline: Doc

    Behaves like space if the result fits in the page, otherwise behaves like line

  31. val space: Doc

    Renders as a space

  32. def string(s: String): Doc

    Concatenates all characters, using line for new lines and text for other blocks

  33. def text(s: String): Doc

    Renders the text as is.

    Renders the text as is. If it contains new lines, string should be used.

  34. def unnest(indent: Int)(inner: Doc): Doc

    Deindent the document

    Deindent the document

    Annotations
    @inline()
  35. def vcat(docs: TraversableLike[Doc, _]): Doc

    Renders a document that appends all documents in the collection vertically, separated by a linebreak

    Renders a document that appends all documents in the collection vertically, separated by a linebreak

    Annotations
    @inline()
  36. def vsep(docs: TraversableLike[Doc, _]): Doc

    Renders a document in which all documents in the collection are appended vertically, separated by a line

    Renders a document in which all documents in the collection are appended vertically, separated by a line

    Annotations
    @inline()
  37. def width(f: (Int) ⇒ Doc)(doc: Doc): Doc

    Renders a document followed by some other document computed depending on the current width

    Renders a document followed by some other document computed depending on the current width

    Annotations
    @inline()
  38. def words(s: String): List[Doc]

    Splits the string into words and create a document for each word

  39. object Characters extends CountUnit with Product with Serializable

    Truncates after the count in non space characters

  40. object CompactRenderer extends (Doc) ⇒ SimpleDoc

    This printer is not really pretty (but should be faster than pretty printers!): it does not insert any indentation and discards all groups, just renders everything as compact as possible

  41. object EmptyDoc extends Doc with Product with Serializable

    Empty document.

  42. object Lines extends CountUnit with Product with Serializable

    Truncates after the count in lines

  43. object SEmpty extends SimpleDoc with Product with Serializable

    An empty document.

  44. object Words extends CountUnit with Product with Serializable

    Truncates after the count in words

Inherited from AnyRef

Inherited from Any

Ungrouped