Wish: support for rendering with newlines #161
Replies: 2 comments
-
I think this is possible by outputting a Seq of tagged events in the internal StateT. And then one can decide how to layout those events. There might be a performance hit compared with directly outputting to a Builder. I’d have to benchmark it and see if it’s a big hit or a little hit. It might not be much different, don’t know until you bench it. lucid doesn’t bill itself as a high performance library, but e.g. a 2x slow down would probably be considered a regression. blaze-markup’s pretty printer goes via String, so if you’re using that you might not be concerned about performance. Apparently it doesn’t work correctly, so you might need to fix it first: haskell-servant/servant-blaze#2 jaspervdj/blaze-html#111 jaspervdj/blaze-html#103 It doesn’t look very easy to do it properly. I know the blaze authors added it for debugging, but such is the way of things that it gets held to a standard of complete correctness. 😂 |
Beta Was this translation helpful? Give feedback.
-
Maybe you could provide a reformatting function in a module like .Debug that did the naive thing on a ByteString, which would let you write a trivial pretty printer without people having the wrong expectations? |
Beta Was this translation helpful? Give feedback.
-
As inspecting diffs or troubleshooting with one huge line of output is hard.
Pretty indented output like blaze-html's would be a bonus.
Related: simonmichael/hledger#2321
Beta Was this translation helpful? Give feedback.
All reactions