-
Notifications
You must be signed in to change notification settings - Fork 30
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
Optimized rendering function for infinite band width case #44
Comments
@adinapoli I think you were interested in picking this up. |
Hey Ben, indeed I am! Do you have any pointers on where I should start looking? 😉 |
I have only vague recollections of when I briefly looked into this. Sadly, I seem to remember that the way the library is currently structured makes the change a bit invasive. Namely, there are a few points where we do layout during AST construction. Looking briefly at the code, I think You may want to take inspiration from I think this approach of having a "cheap" AST, with a set of interpreters to do layout to produce in simpler AST is a good one. Doing this in |
To clarify, note that the AST of |
Thanks Ben, this is quite useful and more than I hoped! It looks like I need to finally delve into the guts of pretty and actually understand what I'm doing 😁 |
Alfredo Di Napoli <[email protected]> writes:
Thanks Ben, this is quite useful and more than I hoped! It looks like I need to finally delve into the guts of pretty and _actually_ understand what I'm doing 😁
Indeed, I think that reading through the Hughes paper (and perhaps the
Wadler paper which ansi-wl-pprint is based on) would be a great place to
start.
|
For what it’s worth, I modified the WL prettyprinting algorithm in my own Relevant source: |
Awesome! I think that having this reference implementation will really help. |
In the case of rendering for an infinite band width we needn't do any layout (e.g. backtracking) at all. Providing a rendering function which optimizes for this case should improve performance in these cases considerably. In particular GHC would benefit greatly from this as it uses pretty to produce large quantities of assembler code.
The text was updated successfully, but these errors were encountered: