Idris2Doc : Text.PrettyPrint.Bernardy.Combinators

Text.PrettyPrint.Bernardy.Combinators

(source)

Definitions

symbol : Char -> Doc opts
  Creates a single-line document from the given character.

@c A printable non-control character.

Totality: total
Visibility: export
space : Doc opts
  A single space character.

Totality: total
Visibility: export
squote : Doc opts
Totality: total
Visibility: export
dquote : Doc opts
Totality: total
Visibility: export
lparen : Doc opts
Totality: total
Visibility: export
rparen : Doc opts
Totality: total
Visibility: export
langle : Doc opts
Totality: total
Visibility: export
rangle : Doc opts
Totality: total
Visibility: export
lbracket : Doc opts
Totality: total
Visibility: export
rbracket : Doc opts
Totality: total
Visibility: export
lbrace : Doc opts
Totality: total
Visibility: export
rbrace : Doc opts
Totality: total
Visibility: export
semi : Doc opts
Totality: total
Visibility: export
colon : Doc opts
Totality: total
Visibility: export
comma : Doc opts
Totality: total
Visibility: export
dot : Doc opts
Totality: total
Visibility: export
slash : Doc opts
Totality: total
Visibility: export
backslash : Doc opts
Totality: total
Visibility: export
equals : Doc opts
Totality: total
Visibility: export
pipe : Doc opts
Totality: total
Visibility: export
enclose : Doc opts -> Doc opts -> Doc opts -> Doc opts
  Encloses the document between two other documents using `(<+>)`.

Totality: total
Visibility: export
squotes : Doc opts -> Doc opts
  Encolses a document in single quotes.

Totality: total
Visibility: export
dquotes : Doc opts -> Doc opts
  Encolses a document in double quotes.

Totality: total
Visibility: export
parens : Doc opts -> Doc opts
  Encolses a document in parentheses.

Totality: total
Visibility: export
parenthesise : Bool -> Doc opts -> Doc opts
  Encolses a document in parentheses if `b` equals `True`.

Totality: total
Visibility: export
angles : Doc opts -> Doc opts
  Encolses a document in angles (`<` and `>`).

Totality: total
Visibility: export
braces : Doc opts -> Doc opts
  Encolses a document in curly braces.

Totality: total
Visibility: export
brackets : Doc opts -> Doc opts
  Encolses a document in brackets.

Totality: total
Visibility: export
ifMultiline : Doc opts -> Doc opts -> Doc opts
  Tries to layout the first document on a single line, replacing
it with the alternative if a) it does not fit the page with or b)
it inherently is placed on several lines.

This combinator is very useful for pretty printing Idris values
(data constructors, lists, records), because we typically try to
place them on a single line if and only if they fit the page width
and none of their arguments is placed on several lines.

Totality: total
Visibility: export
(<++>) : Doc opts -> Doc opts -> Doc opts
  Concatenates two documents horizontally with a single space between them.

Totality: total
Visibility: export
Fixity Declaration: infixl operator, level 8
(<+?+>) : Doc opts -> Doc opts -> Doc opts
  Concatenates two documents horizontally with a space between them, if both
documents are not empty.

Totality: total
Visibility: export
Fixity Declaration: infixl operator, level 8
vappend : Doc opts -> Doc opts -> Doc opts
Totality: total
Visibility: export
hcat : List (Doc opts) -> Doc opts
  Concatenate a sequence of documents horizontally using `(<+>)`.

Totality: total
Visibility: export
hsep : List (Doc opts) -> Doc opts
  Concatenate a sequence of documents horizontally using `(<++>)`.

Totality: total
Visibility: export
vsep : List (Doc opts) -> Doc opts
  Concatenate a list of documents vertically.

Totality: total
Visibility: export
hang : Nat -> Doc opts -> Doc opts -> Doc opts
  Tries to layout the two documents horizontally, but appends
the second indented by the given number of spaces below the
first if the horizontal version exceeds the width limit.

Totality: total
Visibility: export
hangSep : Nat -> Doc opts -> Doc opts -> Doc opts
  Like `hang` but separates the two documents by a space in case of
a horizontal alignment.

Totality: total
Visibility: export
hang' : Nat -> Doc opts -> Doc opts -> Doc opts
  Tries to layout the two documents horizontally, but appends
the second indented by the given number of spaces below the
first if the horizontal version exceeds the width limit, or
if needs several lines.

Totality: total
Visibility: export
hangSep' : Nat -> Doc opts -> Doc opts -> Doc opts
  Like `hang'` but separates the two documents by a space in case of
a horizontal alignment.

Totality: total
Visibility: export
sep : List (Doc opts) -> Doc opts
  Tries to separate the given documents horizontally, but
concatenates them vertically if the horizontal layout exceeds the
width limit.

Totality: total
Visibility: export
sep' : List (Doc opts) -> Doc opts
  Tries to separate the given documents horizontally, but
concatenates them vertically if the horizontal layout exceeds the
width limit, or horizontal layout leads to a multiline document.

Totality: total
Visibility: export
when : Bool -> Doc opts -> Doc opts
  Add the given document only when condition is true

Totality: total
Visibility: export
generalList : Doc opts -> Doc opts -> Doc opts -> List (Doc opts) -> Doc opts
  Pretty prints a list of documents separated by the given delimiter
and wrapping them in opening and closing symbols.

If it fits the page width, the document is layed out horizontally,
otherwise it's layed out vertically with leading commas.

Horizontal layout for `generalList "[" "]" "," [1,2,3]:

```
[1, 2, 3]
```

Vertical layout:

```
[ 1
, 2
, 3
]
```

Totality: total
Visibility: export
list : List (Doc opts) -> Doc opts
  Pretty prints a list of documents separated by commas
and wrapping them in brackets.

If it fits the page width, the document is layed out horizontally,
otherwise it's layed out vertically with leading delimiters.

Horizontal layout:

```
[1, 2, 3]
```

Vertical layout:

```
[ 1
, 2
, 3
]
```

Totality: total
Visibility: export
snocList : List (Doc opts) -> Doc opts
  Pretty prints a `SnocList` of documents separated by commas
and wrapping them in brackets.

If it fits the page width, the document is layed out horizontally,
otherwise it's layed out vertically with leading commas.

Horizontal layout:

```
[<1, 2, 3]
```

Vertical layout:

```
[<1
, 2
, 3
]
```

Totality: total
Visibility: export
tuple : List (Doc opts) -> Doc opts
  Pretty prints a list of documents separated by commas
and wrapping them in parentheses.

Horizontal layout:

```
(x, y, z)
```

Vertical layout:

```
( x
, y
, z
)
]

Totality: total
Visibility: export
fields : List (Doc opts) -> Doc opts
  Pretty prints a list of documents separated by commas
and wrapping them in curly braces.

Horizontal layout:

```
{x, y, z}
```

Vertical layout:

```
{ x
, y
, z
}
]

Totality: total
Visibility: export