-
Notifications
You must be signed in to change notification settings - Fork 74
Adding a haskell-gi-overloading
package to hackage
#107
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
Comments
I completely agree with the goal, but I am not so sure about the design. As a possibility, would it be workable to include the autogenerated bindings without overloading as part of the |
I don't think that would work:
Leksah is not the only place this problem comes up by the way. @luigy spent quite some time trying to figure out why his reflex application was taking so long to load in ghci. It turned out he was using Most people using
If you have a package that needs overloading it can include |
Would be great to find a solution for this that doesn't require manual configuration :)
Indeed, the slow down was obscure to debug and not immediately obvious that overloading in some other package was causing it. In the team I encountered this the speed was disregarded as normal and I would of thought the same if I hadn't seen an app with overloading turned off. |
Thanks for the explanation, I agree with what you say.
I think I like this option best, but I am not sure how it would interact with
Wouldn't this have the same problem as the previous option? In any case, doing the changes in |
By the way, there is a related Also, the root problem is the slowness in |
I was hoping that since each I think we should consider deprecating the flags and having overloading support on whenever the build plan includes This would simplify reasoning about the problem. For instance it would be clear that any package with
One problem with that is how do we express the constraint that all I guess we could probably have a single overloading flag on I think using a |
Yes, I agree. I am still not entirely happy about the approach, and would prefer to fix the root cause, but better having something working now. Would you like sending a pull request? You need to modify https://github.com/haskell-gi/haskell-gi/blob/master/lib/Data/GI/CodeGen/CabalHooks.hs. Otherwise I can try to do it early next week (I am traveling this week). Just one comment about the default behavior: I think that it is better for newcomers to have access to the overloaded API, so in the case that no explicit dependency is given in the user's cabal file it would be good to default to include overloading. I think that this would be automatic in your design, but just wanted to bring it up. |
Sorry, I was flat out working on improving support for project files (cabal.project and stack.yaml) in Leksah.
That would be awesome if you have time (I still have a few things I would like to tidy up in Leksah).
Agreed. The default should be to use I would like to change the default in |
This should now be implemented in ca3d4b2. There are some small differences with respect to the design sketched above. Mainly, instead of generating different code depending on whether the flag was set, the overloading code is now wrapped by a CPP conditional The main reason for this is that we can avoid adding magic in the
which should achieve the same as the design above, but it should be more transparent. Could you please check whether the above works for you? I have not yet uploaded new versions of the |
This is useful in particular for wrapping with #ifdef ENABLE_OVERLOADING blocks of code associated with overloading, as in #107.
It seems to work very nicely! I generated the haskell-gi bindings packages then added them all to leksah's cabal.project and it built nice and fast and the We will need two versions of a |
Awesome! :)
I was planning on uploading to hackage basically what's in https://github.com/haskell-gi/haskell-gi/tree/master/overloading as version |
|
I have just released the new versions of the |
@peti would it make sense to add the haskell-gi-overloading 0.0 version of this package to nixpkgs in configuration-hackage2nix.yaml. Something like:
I presume then we would be able to use something like |
This is rather perplexing. Why does one need to add a dependency in order to disable a feature? |
The details are in this issue, but the TLDR is that it allows us to put |
Yes, I've seen that. It still makes very little sense to me. Or rather, it feels like an abuse of the package system to do something that's supposed to be done with Cabal flags. Anyhow, it's probably not my concern. If you want to add haskell-gi-overloading-0.0 to Nixpkgs, then that's fine IMHO. |
Agreed, but you can't specify a dependency on a particular cabal flag setting. In this case it is very important that the flag is set the same for all haskell-gi packages (or you get very confusing build errors). Another option might have been to split the overloaded functions out of the haskell-gi packages. Unfortunately that would create a record number of orphans. |
Using this version turns off overloading in all the haskell-gi packages. See haskell-gi/haskell-gi#107 for details.
It seems that leksah really does want this empty package: haskell-gi/haskell-gi#107 Disable overloading with only 0.0 for leksah
I would like to start uploading Leksah to hackage again, but I really don't like that it will take something like 5x longer to build from hackage than it does from github because of the use of overloading.
The problem is there is no way for leksah to indicate in
leksah.cabal
that it does not want overloading to be enabled (since there is nocabal.project
file). I don't like the idea of splitting thegi-*
packages and creating lots of orphans.So what if we added a
haskell-gi-overloading
package to hackage. This would have two branches0.0.0.0
(meaning no overloading support) and1.x.x.x
(yes we want overloading). We don't need to put anything in these packages (it might need one module so it is not completely empty), but perhaps there is some code inhaskell-gi-base
only needed when using overloading that would make sense to put in the 1.x.x.x branch.For cabal files that do not use overloading (like leksah.cabal) we would add:
One (probably bad) way to make it work would be to change the
gi-*.cabal
files to include:The solver should switch off all the flags as they are set to automatic. I suspect it will have little impact on the speed of the cabal solver for packages without the
<1.0
constraint, but switching off those three automatic flags on so manygi-*
packages is likely to be really bad for the solver.Instead could the code generation in the custom setup of the
gi-*
packages askCabal
for the version ofhaskell-gi-overloading
that is in the build plan (not the one insetup-depends
of course) and disable output of the overloading code if the version is<1.0
? So the flag settings would just have no impact when the version ofhaskell-gi-overloading
in the build plan was<1.0
.If that is not possible, could we output
#if MIN_VERSION_haskell_gi_overloading(1,0,0)
around the offending overloading code?The text was updated successfully, but these errors were encountered: