floskell-0.10.0: A flexible Haskell source code pretty printer

Safe HaskellNone
LanguageHaskell98

Floskell.Printers

Contents

Synopsis

Documentation

getConfig :: (Config -> b) -> Printer b Source #

Query part of the pretty printer config

getOption :: (OptionConfig -> a) -> Printer a Source #

Query pretty printer options

cut :: Printer a -> Printer a Source #

Try only the first (i.e. locally best) solution to the given pretty printer. Use this function to improve performance whenever the formatting of an AST node has no effect on the penalty of any following AST node, such as top-level declarations or case branches.

Basic printing

write :: ByteString -> Printer () Source #

Write out a string, updating the current position information.

string :: String -> Printer () Source #

Write a string.

int :: Int -> Printer () Source #

Write an integral.

space :: Printer () Source #

Write a space.

newline :: Printer () Source #

Output a newline.

Tab stops

Combinators

mayM_ :: Maybe a -> (a -> Printer ()) -> Printer () Source #

withPrefix :: Applicative f => f a -> (x -> f b) -> x -> f b Source #

withPostfix :: Applicative f => f a -> (x -> f b) -> x -> f b Source #

inter :: Printer () -> [Printer ()] -> Printer () Source #

Indentation

getNextColumn :: Printer Int Source #

Get the column for the next printed character.

column :: Int -> Printer a -> Printer a Source #

Set the (newline-) indent level to the given column for the given printer.

indentedBy :: Int -> Printer a -> Printer a Source #

Increase indentation level by n spaces for the given printer.

onside :: Printer a -> Printer a Source #

Increase indentation level b n spaces for the given printer, but ignore increase when computing further indentations.

parens :: Printer () -> Printer () Source #

Wrap in parens.

brackets :: Printer () -> Printer () Source #

Wrap in brackets.

Wrapping

Operators