dataframe-core-2.2.0.0: Core data structures for the dataframe library.
Safe HaskellSafe-Inferred
LanguageHaskell2010

DataFrame.Internal.Pretty

Description

A minimal Wadler/Leijen-style document combinator and width-aware renderer. A Doc describes a layout abstractly; render chooses where soft breaks become newlines to fit a target width. Group lays a region flat when it fits.

Synopsis

Documentation

data Doc Source #

Instances

Instances details
Monoid Doc Source # 
Instance details

Defined in DataFrame.Internal.Pretty

Methods

mempty :: Doc #

mappend :: Doc -> Doc -> Doc #

mconcat :: [Doc] -> Doc #

Semigroup Doc Source # 
Instance details

Defined in DataFrame.Internal.Pretty

Methods

(<>) :: Doc -> Doc -> Doc #

sconcat :: NonEmpty Doc -> Doc #

stimes :: Integral b => b -> Doc -> Doc #

text :: String -> Doc Source #

A literal chunk of text. Must not contain newlines (use line/hardline).

line :: Doc Source #

A soft break: a single space when its enclosing group fits the width, otherwise a newline + current indentation.

hardline :: Doc Source #

A hard break that never flattens; any enclosing group is forced to break.

nest :: Int -> Doc -> Doc Source #

Add k spaces to the indentation applied at line breaks inside d.

group :: Doc -> Doc Source #

Lay the document out flat if it fits the remaining width, broken otherwise.

(<+>) :: Doc -> Doc -> Doc infixr 6 Source #

Concatenate two documents separated by a single space.

hcat :: [Doc] -> Doc Source #

punctuate :: Doc -> [Doc] -> [Doc] Source #

Append sep after every element but the last.

parensWhenBroken :: Doc -> Doc Source #

Render d bare when it fits flat on the current line, wrapped in parens when it must break across lines. Keeps operator grouping unambiguous once a sub-expression wraps, without parenthesis noise on one-line expressions.

render :: Int -> Doc -> String Source #

Render a document, breaking soft lines so output fits width columns.