Safe Haskell | Safe-Inferred |
---|
Pretty printer state, used within a state monad computation.
- data PPState = PPState {}
- render :: PPState -> State PPState () -> Builder
- renderBytes :: PPState -> State PPState () -> ByteString
- nlCol :: Word -> PPState
- data PPOp
- op :: PPState -> PPOp -> PPState
- opM :: [PPOp] -> State PPState ()
- nl :: State PPState ()
- hang :: ByteString -> State PPState ()
- hangWord :: ByteString -> State PPState ()
- word :: ByteString -> State PPState ()
- wordcat :: [ByteString] -> State PPState ()
- outdent :: State PPState ()
- inword :: ByteString -> State PPState ()
- outword :: ByteString -> State PPState ()
- curlyOpen :: State PPState ()
- curlyClose :: State PPState ()
- roundOpen :: State PPState ()
- roundClose :: State PPState ()
- indentPadToNextWord :: State PPState ()
- cast :: (Integral a, Num b) => a -> b
- renderIndents :: (Eq a, Num a, IsString c, Monoid c) => [a] -> c
Documentation
State of pretty printing -- string being built, indent levels, present column, brace nesting.
render :: PPState -> State PPState () -> BuilderSource
Produce a builder from a pretty printer state computation.
renderBytes :: PPState -> State PPState () -> ByteStringSource
nlCol :: Word -> PPStateSource
Pretty printer state starting on a new line indented to the given column.
Operations we can perform while pretty printing.
hang :: ByteString -> State PPState ()Source
hangWord :: ByteString -> State PPState ()Source
word :: ByteString -> State PPState ()Source
wordcat :: [ByteString] -> State PPState ()Source
inword :: ByteString -> State PPState ()Source
outword :: ByteString -> State PPState ()Source
curlyClose :: State PPState ()Source
roundClose :: State PPState ()Source
indentPadToNextWord :: State PPState ()Source
This procedure is used in printing statements within evals, to set up
indentation correctly for lines following the first line. It ensures
that the second and following lines are printed aligned with the first
character of the first line of the statement, not the first character of
the $(
, >(
or <(
enclosing the eval.