-
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
Replace GHC copy #1
Comments
Isn't GHC using upstream |
No, when I started on this it highlighted a choice that you can make in pretty that is ambiguous by the laws pretty uses. GHC makes the choice one way and external pretty makes it the other. That blocked me at the time and now the internal GHC pretty has diverged further I believe. Not hard to resolve, but it isn't. |
For future reference: GHC's internal copy of pretty. |
GHC moved away from using literate haskell recently, the module has moved here. |
Is the only thing blocking GHC adoption of the external pretty library someone doing the work? |
No also blocking is a slight difference in behavior. There is one situation where the laws for pretty are ambiguous and leave room for choice. GHC decided one way and pretty the other. I may just close this ticket as the downside of ghc having its own copy is very small
|
Ah, dang. I was hoping to extend the GHC pretty printer with the annotations, to get functionality like in the idris repl. Maybe extending their forked version with the annotations is the right path forward for that work :) |
Well if you're going to be putting effort into the pretty fork in GHC, then it may make sense to try to unify the two. It's an easy attempt, just try using the pretty library instead of GHC's forked version and see if any GHC output breaks and why. Especially as pretty now has support for annotations in HEAD. |
Yes, I was reluctant to start until the package had been released, hence #21. |
I am working on making GHC's Edit: see https://ghc.haskell.org/trac/ghc/ticket/10735 Some obvious differences:
Edit: more differences, GHC's version defines:
|
Great! Thanks for doing this thomie. |
@thomie What's the status of your work? Is the only difference now with |
Status: I don't know how to proceed.
Notable differences:
Other difference are minor. Both copies define some extra functions and instances not defined in the other copy. GHC performance is very sensitive to Pretty changes. That As mentioned in https://ghc.haskell.org/trac/ghc/ticket/10735#comment:23, for parity with
After that come the |
OK, thanks for the update. Would supporting |
Given |
obvious side remark (but it's really a separate issue): is this "ByteString with a hash associated with it for faster Eq" worthy of becoming a stand-alone library? I take it that |
Maybe, if it doesn't exist someone can just create it on Hackage, not really much point discussing it here. The alternative would be to pull |
I guess so. @bgamari has been toying with the idea of using a different pretty printing library than Pretty (https://ghc.haskell.org/trac/ghc/ticket/8809#comment:21), you might want to discuss with him. Maybe switching to a different library would give better performance also? |
@thomie: Do you understand why that is? My intuition fails me here, I'd expect pretty printing speed to not matter in practice. |
@niteria: you can probably ask @simonmar more about it, I know he's aware of the problem. Subtle performance issues I've encountered:
My guess: there is a simply a lot of code to prettyprint (cmm, assembly, llvm). Combine that with nobody really understanding the HughesPJ algorithm or the Pretty source code, and it is very easy to introduce an "accidentally quadratic". |
The The fast way should probably use a |
Thank you @thomie and @simonmar for context! I profiled GHC while compiling one of the |
I'm currently looking at modifying the |
GHC has an internal copy of pretty. I've gone and merged any improvements from GHC into pretty, so we can be safe that the code in pretty is the best code. However GHC uses some different base types for performance. We need to offer better base types than String. Say ByteString and Text and also offer a builder approach to the render function for performance. After that improvement should be able to change GHC to use the pretty library.
The text was updated successfully, but these errors were encountered: