Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
A strict State/Writer monad to implement a stack machine for rendering
SimpleDoc
s.
- data StackMachine output style a
- execStackMachine :: [styles] -> StackMachine output styles a -> (output, [styles])
- pushStyle :: Monoid output => style -> StackMachine output style ()
- unsafePopStyle :: Monoid output => StackMachine output style style
- unsafePeekStyle :: Monoid output => StackMachine output style style
- writeOutput :: output -> StackMachine output style ()
Documentation
data StackMachine output style a Source #
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.
Monoid output => Monad (StackMachine output style) Source # | |
Functor (StackMachine output style) Source # | |
Monoid output => Applicative (StackMachine output style) Source # | |
execStackMachine :: [styles] -> StackMachine output styles a -> (output, [styles]) Source #
Run the renderer and retrive the writing end
pushStyle :: Monoid output => style -> StackMachine output style () Source #
Add a new style to the style stack.
unsafePopStyle :: Monoid output => StackMachine output style style Source #
Get the topmost style.
If the stack is empty, this raises an error
.
unsafePeekStyle :: Monoid output => StackMachine output style style Source #
View the topmost style, but do not modify the stack.
If the stack is empty, this raises an error
.
writeOutput :: output -> StackMachine output style () Source #
Append a value to the output end.