Skip to content
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

?self implicit param under GHC 9.0.2 #371

Open
jchia opened this issue Dec 13, 2021 · 6 comments
Open

?self implicit param under GHC 9.0.2 #371

jchia opened this issue Dec 13, 2021 · 6 comments

Comments

@jchia
Copy link

jchia commented Dec 13, 2021

Recent versions of packages in this project started using a ?self implicit parameter in many functions. GHC 9.0.2 has "simplied subsumption", which requires eta-expansion in some cases where GHC 8.10.7 did not require it, in particular when a function taking ?self is passed as an argument in function call. There is a related GHC issue that gives an example of the new problem.

The result of all this is that functions that take implicit parameters are harder to use in GHC 9.0.2. Until this issue is somehow address, is there anything simple that can be done when using the packages in this project to salvage some usability for functions in this project that use ?self?

@garetxe
Copy link
Collaborator

garetxe commented Dec 13, 2021

Thanks for the report!

"Salvage some usability" seems a bit strong: I have been using the new versions for a while with simplified subsumption and I didn't encounter anything too painful, type inference did most of the work for me. But it is definitely possible that some things got harder. Would you have some example of code that is giving you problems?

Unfortunately the ?self thing is more or less forced upon us by gtk4, there is a longer explanation in the commit: 0acac7c .

@garetxe
Copy link
Collaborator

garetxe commented Dec 13, 2021

(Also, your second link to "issue" points to the same place as the explanation of subsumption.)

@jchia
Copy link
Author

jchia commented Dec 13, 2021

"Salvage some usability" is not meant as a characterization of the current general usability or lack thereof, but specific to the actual problematic cases that exist because of the changes in GHC 9.0.1.

While trying to build taffybar master, I encountered some errors that were quite confusing to me and the GHC error message were not very helpful. Now that I have experience this issue, these cases are not as confusing. So, I was wondering if there are ways to reduce the confusion for someone not expecting these problems.

As for specific changes required, I had to make this change in taffybar for it to build with GHC 9.0.1:
jchia/taffybar@1260137

I've fixed the second link.

@garetxe
Copy link
Collaborator

garetxe commented Dec 13, 2021

Thanks for filing the GHC issue! I cannot think of anything that we could do to improve on this, other than not using implicit parameters (but then we need a solution to the gtk4 issue, and I cannot think of anything better).

Hopefully there is something that can be done, this simplified subsumption business has also forced me to modify a bunch of code, even without implicit parameters: 15d6b30

@garetxe
Copy link
Collaborator

garetxe commented Sep 10, 2023

Just a quick note to record (for anyone finding this issue after getting a mystifying compilation error relating to the ?self parameter) that the DeepSubsumption extension has now been implemented. Turning this extension on will probably help.

I will still leave the issue open in case anyone can come up with a way of fixing things in the case of simplified subsumption.

@garetxe
Copy link
Collaborator

garetxe commented Sep 10, 2023

I have been looking into this a bit more. Just for the record, taffybar now seems to compile fine without the (\x y -> GI.Gdk.afterScreenMonitorsChanged y x) change, which was in fact undone recently: taffybar/taffybar@b570068 . The other change is still needed if DeepSubsumption is not on. (By default it is for taffybar, because it's using Haskell2010, and this implies DeepSubsumption.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants