Safe Haskell | Safe-Inferred |
---|---|

Language | Haskell2010 |

## Synopsis

- class Printer p => NestingPrinter p where
- askingNesting :: (Int -> p) -> p
- localNesting :: (Int -> Int) -> p -> p
- applyNesting :: p -> p

- incrNesting :: NestingPrinter p => p -> p
- encloseNesting :: NestingPrinter p => p -> p -> p -> p
- module Silkscreen

# Printing with nesting levels

class Printer p => NestingPrinter p where Source #

askingNesting :: (Int -> p) -> p Source #

Make a printer informed by the current nesting level.

localNesting :: (Int -> Int) -> p -> p Source #

Locally change the nesting level for a printer.

applyNesting :: p -> p Source #

Apply the current nesting level to a printer.

Different instances can give different meanings to this, e.g. annotating the argument with the nesting level or some other means of rendering it differently.

#### Instances

Printer a => NestingPrinter (Rainbow a) Source # | |

Defined in Silkscreen.Printer.Rainbow | |

NestingPrinter b => NestingPrinter (a -> b) Source # | |

Defined in Silkscreen.Nesting askingNesting :: (Int -> a -> b) -> a -> b Source # localNesting :: (Int -> Int) -> (a -> b) -> a -> b Source # applyNesting :: (a -> b) -> a -> b Source # | |

(Bounded level, NestingPrinter p) => NestingPrinter (Prec level p) Source # | |

Defined in Silkscreen.Printer.Prec |

incrNesting :: NestingPrinter p => p -> p Source #

Increment the nesting level of a printer.

This should be used inside parentheses, brackets, braces, etc., and will inform the annotation of their delimiters.

encloseNesting :: NestingPrinter p => p -> p -> p -> p Source #

# Re-exports

module Silkscreen