silkscreen-0.0.0.4: Prettyprinting transformers.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Silkscreen.Nesting

Synopsis

Printing with nesting levels

class Printer p => NestingPrinter p where Source #

Methods

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

Instances details
Printer a => NestingPrinter (Rainbow a) Source # 
Instance details

Defined in Silkscreen.Printer.Rainbow

Methods

askingNesting :: (Int -> Rainbow a) -> Rainbow a Source #

localNesting :: (Int -> Int) -> Rainbow a -> Rainbow a Source #

applyNesting :: Rainbow a -> Rainbow a Source #

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

Defined in Silkscreen.Printer.Prec

Methods

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

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

applyNesting :: Prec level p -> Prec level p Source #

NestingPrinter b => NestingPrinter (a -> b) Source # 
Instance details

Defined in Silkscreen.Nesting

Methods

askingNesting :: (Int -> a -> b) -> a -> b Source #

localNesting :: (Int -> Int) -> (a -> b) -> a -> b Source #

applyNesting :: (a -> b) -> a -> b Source #

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