-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-mode pretty-printer #13
Comments
It is my understanding that BlazeBuilder (as well as Data.Text.Builder and Data.ByteString.Builder) is the king when it comes to performance and memory usage in generating text programmatically, so, perhaps, we could consider switching to it as a part of the effort to update the pretty-printer for ECMAScript5. |
https://hackage.haskell.org/package/annotated-wl-pprint seems helpful for pretty-printing comments and, potentially, generating source maps. See https://hackage.haskell.org/package/annotated-wl-pprint-0.7.0/docs/Text-PrettyPrint-Annotated-Leijen.html#v:displayDecorated and https://hackage.haskell.org/package/annotated-wl-pprint-0.7.0/docs/Text-PrettyPrint-Annotated-Leijen.html#v:displaySpans. Note, that |
Wouldn't it be nice if we could use the same pretty-printer to generate well-formatted, "pretty" source representation -- as well as the minified source representation (for use in minifiers, compilers back-ends etc)?
Another use case is pretty-printing annotation fields as comments (useful in debugging, generating type annotations etc.). I'm using a private fork where the pretty-printer does that. I'd like the functionality to be available to everyone, but I want the possibility to disable it.
Yet another use-case is generating source-maps which would also require a modified pretty-printer. I'm not sure of the scope of the modifications, but I'm certain it's not limited to merely omitting certain characters depending on flags (which seems the case for the previous two use-cases).
Anyway, I've been tinkering with a multi-mode pretty-printing library that would, hopefully, help in writing a multi-mode printer for language-ecmascript. But I'd like feedback on the idea as a whole and any additional use-cases you can think of.
The text was updated successfully, but these errors were encountered: