[Haskell-beginners] How to construct complex string
martin
martin.drautzburg at web.de
Mon Aug 5 21:37:18 CEST 2013
Hello all,
recently I was working on a haskell program, which does some
calculations and the produces a "plot", i.e. a set of Tikz (a LaTeX
thing) commands.
While this was not a problem in itself, it lacked composability. While
all my plots show a grid, a caption and some data points, some of them
additionally show a line with a legend, some of them show two.
Now I clearly do not want to duplicate the entire function just to add
another line. I'd rather construct the Tikz commands (which at the end
of the day is just a String) in a stepwise fashion.
When constructing the set of Tikz commands, I cannot rely that
additional commands are placed at the end. It is typically more an
inside-out thing. The last thing I need to do is wrap the whole thing in
\begin and \end directives.
Additionally there may be "global" values (like the scale) which need to
be known at more than one step. I had a brief look at the "Diagrams"
package, which MUST have similar issues, and they "do everything with
monoids", but I fail to see the light.
Could anyone point me in the right direction?
More information about the Beginners
mailing list