execStackMachine :: [styles] -> StackMachine output styles a -> (output, [styles])
Run the renderer and retrieve the writing end
Use \ Prettyprinter.Render.Util.StackMachine\ instead.
Prettyprinter.Render.Util.StackMachine prettyprinter-1.7.2 · 8 declarationsexecStackMachine :: [styles] -> StackMachine output styles a -> (output, [styles])Run the renderer and retrieve the writing end
pushStyle :: Monoid output => style -> StackMachine output style ()Add a new style to the style stack.
renderSimplyDecorated :: Monoid out => (Text -> out) -> (ann -> out) -> (ann -> out) -> SimpleDocStream ann -> outSimplest possible stack-based renderer.
For example, here is a document annotated with (), and the behaviour is to
write »>>>« at the beginning, and »<<<« at the end of the annotated region:
>>> let doc = "hello" <+> annotate () "world" <> "!"
>>> let sdoc = layoutPretty defaultLayoutOptions doc
>>> T.putStrLn (renderSimplyDecorated id (\() -> ">>>") (\() -> "<<<") sdoc)
hello >>>world<<<!The monoid will be concatenated in a right associative fashion.
(Text -> out)Render plain Text
(ann -> out)How to render an annotation
(ann -> out)How to render the removed annotation
renderSimplyDecoratedA :: (Applicative f, Monoid out) => (Text -> f out) -> (ann -> f out) -> (ann -> f out) -> SimpleDocStream ann -> f outVersion of renderSimplyDecoratedA that allows for Applicative effects.
(Text -> f out)Render plain Text
(ann -> f out)How to render an annotation
(ann -> f out)How to render the removed annotation
unsafePeekStyle :: Monoid output => StackMachine output style styleView the topmost style, but do not modify the stack.
If the stack is empty, this raises an error.
unsafePopStyle :: Monoid output => StackMachine output style styleGet the topmost style.
If the stack is empty, this raises an error.
writeOutput :: output -> StackMachine output style ()Append a value to the output end.
newtype StackMachine output style aWriting your own stack machine is probably more efficient and customizable; also consider using »renderSimplyDecorated(A)« instead
WriterT output StateT [style] a, but with a strict Writer value.
The output type is used to append data chunks to, the style is the member
of a stack of styles to model nested styles with.
Community contribution. The service has not verified this documentation. The generator reported 21 diagnostics.
Target: Linux on x86-64. Some inferred types and resolved links are not available.
Generator: aihc-haddock-858b1951-web-1
Metadata snapshot: 19f659e0fd2a9606431ae6a3ec65f9ace725052e19ca6a9f9e9f2759e30fd129
Open the dependency plan · Download the documentation model