Essentially, I use the template twice: once to extract the Java
imports and once to generate the result Text. Then I replace a magic
string in the result Text with the import code. It works but makes me
I will probably pull out the JavaImport list from Line and use
something like State to keep track of the necessary imports. (Now that
I understand Reader, maybe State is no longer a bridge too far.)
My main issue is how to avoid the magic string. I thought about adding
an extra entry to Template [something like Imports ((Set JavaImport)
-> Text or maybe Template)] but then I don't know how to implement
"instance Monoid Template". Similarly if I use something Reader like.
Any design advice or ideas would be appreciated. If it's of any help,
the full code is at  (it's tiny). Any and all comments are welcome,
by the way: I'm still a Haskell beginner.