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 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 # | |
Defined in Silkscreen.Printer.Prec 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 # | |
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 # |
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