-
Notifications
You must be signed in to change notification settings - Fork 90
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
Add support for Debug
type class
#272
Comments
Just to be clear - I would also love to see this happen, but I personally don't have the time/energy to make it happen myself right now. |
That's fine! Also, I believe you said previously that supporting Meaning, the work needed to add this would be:
|
I did think that Debug would require compiler support at one point - in particular, without RowToList, compiler support would have been necessary - but I don't think it is required any more. I think we should try to avoid building knowledge of Debug into the compiler unless we really have to. |
I looked at this briefly. Here are the steps I followed when migrating As for porting that library over here, it doesn't look like we can port over the entire thing as is. Rather, we'd have to port half of it to enable instances for the The rest of this comment explains how the port would work.
The
The
The The The To summarize, here's what would change if we did this:
If one wants to diff and/or pretty-print things produced by the |
There's another issue I missed in my initial review. The |
I realized that we use FFI for I forked the |
We talked about this briefly in the Contributors meeting last week, and I'm also a 👍 for adding My reading of
I'm primarily in support of the "De-prioritize I'm also in favor of switching |
In our codebases we have a redefined |
Could you clarify this? |
I mean in the
So if we wanted to de-prioritise show we could perhaps start adding a constraint like that to the instances that now have proper print/debug functions, to ensure that we don't end up with two parallel hierarchies that end up doing the same thing indefinitely. Or we could add it to |
Even getting Debug into core and updating the compiler to use it is not a small project, so I’d suggest not worrying too much about the future of Show until Debug is in core and has real-world use. We will have more information by that point, and also if we decide we do want to deprecate Show, it’s going to be much easier to justify that to the user base if users can already see concrete benefits from Debug. |
My motivation in asking is that if, for example, we just want them to live side-by-side without intending to phase out the usage of |
Right, I see. I wouldn’t want them to live side by side indefinitely either, so I think it’s just a question of how gentle we are about deprecating and removing Show. I do think that Show is enough of a footgun in production code that deprecating it justifies the breakage, if we can manage the deprecation process well. For example, we could be very gentle about it by marking Show as deprecated and leaving it there for two or three breaking releases before actually removing it. I’d also argue that the cost of having Show in prelude is fairly minimal; the code has barely changed in years. Maybe once a big chunk of the ecosystem has moved away from Show, instead of removing the class entirely, we could move it out to a separate library? I agree that option 3 probably makes the most sense at first, but I also think we should remove it completely if, say, the migration goes well and in a few major releases’ time we think we can remove it without creating too much hassle. |
This is currently where my thinking is at, too. I'm thinking a rollout could be something like:
I think this rollout would be long and gentle enough to reduce breakage issues. |
Any other feedback on this? |
It's been sometime since any discussion has happened on this issue. But I've had a few thoughts since then:
|
Perhaps, but it's a minor, one-time annoyance, and Also I don't think this is blocked by any compiler work. The only part of the compiler which potentially needs to be aware of |
Ah, ok. I'll mark this as an enhancement rather than something that is blocked. |
What about a distinct
|
I think a Display class would suffer from most of the same issues as Show, so I think it would be really unfortunate if we did introduce one in the process of deprecating Show. I think there are two possibilities for Display: either it has very few instances (in which case it doesn’t add much value over monomorphic functions) or it falls into the same Show pitfall which I already mentioned, where stuff continues to typecheck after types change and then does the wrong thing. For example, a |
Show
with Debug
Debug
type class
I'd like to work on this again. |
See #46 for context.
Drop
Show
and replace it withDebug
as defined here: https://github.com/hdgarrood/purescript-debuggedFor context:
The text was updated successfully, but these errors were encountered: