-
Notifications
You must be signed in to change notification settings - Fork 37
Make rules generic (to reenable -c
flag as well).
#538
Comments
@angerman Awesome, thank you very much for recording your thoughts here. |
@snowleopard Would you be okay with defining simple parsers for this using |
@alpmestan I guess there is no way back for us in terms of dependency on Cabal, so yes -- I see no reasons to avoid using One slight issue is that Cabal's codebase seems to be quite turbulent: Hadrian is often broken by changes in Cabal, and |
@snowleopard I was actually just speaking about |
Ah, I see. Well, depending on one more GHC library seems like an unnecessary high cost, both complexity wise and compilation time wise -- there are two dozen extra modules to compile! If all we want is to parse |
Well, we already depend on Cabal, so we already build parsec whenever we build hadrian now. If you however still would like to avoid the direct dependency on parec, I'll do without it, using something like what you suggest. |
@alpmestan Ah, indeed -- that's a good point. So, you are saying that the cost of using |
@snowleopard Exactly, the cost is zero, but the usability/readability of the code will be greater IMO. I'm preparing a proof-of-concept patch with parsec that pretty much parses the |
@alpmestan Thanks, sounds good! Sorry for being slow today :) |
I know the feeling all too well myself, don't worry :-) |
@snowleopard @angerman I have a WIP branch at master...alpmestan:generic-library-rules that implements Moritz's suggestion. I still seem to be able to build a GHC just fine if I run the
(the first few lines come from debugging output I added -- see my branch) Do any of you have any idea of where that cycle comes from and why my patch makes this happen? I won't have a lot of time to look into this for the end of this week, just a little bit, so any help would be appreciated =) Note: I can already confirm we're not paying the boot-up cost anymore, since we're not reading cabal files just to generate the lib rules anymore. |
@alpmestan regarding the |
Yeah, I was hoping my patch would fix it but I'm missing something obviously. If anyone's got some spare time to help me debug/fix this, that'd be lovely! |
Sounds good! |
As noted in this comment, we currently generate specific rules for all known libraries. We would be better off to just build generic rules and then parse the details from the path.
That resolves on the one hand the need to know everything before hand to generate all specific rules, and I would expect this to also speedup the startup process of hadrian.
So what do we need? We'll need functions to extract at least:
from a path.
Example:
right now we generate
where
root
is aFilePath
computed frombuildRootRules
, and we also have:As such we basically want to match something like:
And use a pattern like
here. And then extract the details from
a
andfail
if it's not a match.Additional notes
maybe we want to reuse some URL-matcher/router from one of the web-frameworks to extract the details easily and not write the logic by hand, while using an already performance tuned library?
The text was updated successfully, but these errors were encountered: