-
Notifications
You must be signed in to change notification settings - Fork 175
Add 'imported-from' command. #823
base: master
Are you sure you want to change the base?
Conversation
So I'm right to clone the main repo and push directly to this branch? |
Yeah, you can just add this repo as a remote to your existing repo though, no need to re-clone. |
WRT tests, I should probably tweak test code so it fails early, but here's an actual problem:
|
Okay, 7.10 fixed. 7.8 is still failing, in part due to test files not compiling under 7.8 (f.ex. |
The failures on 7.8.4 are my fault, have reproduced them on my laptop. I'll look into it. |
@DanielG I've gone through all your comments, happy for final review now. |
I'm doing a cleanup pass right now so don't bother fixing any of the things I'm about to comment on. Those are just FYI. |
refineAs (MySymbolUserQualified userQualSym) exports = filterM f exports | ||
where | ||
-- f :: ModuleExports -> Bool | ||
f export = case modas of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced this entire function with modAs == moduleOfQualifiedName userQualSym
. Don't you think a datatype called MySymbolUserQualified should maintain the invariant that the module it contains is actually qualified ;)
The way we deal with this usually is by using smart constructors (mkSymbolUserQualified
etc.) that check this invariant and only use those to construct that type. (optionally moving the type definition to a separate module that doesn't export the constructor so the mkFun in the only way to make a value of that type.
refineRemoveHiding exports = | ||
map (\e -> e { qualifiedExports = removeHiding e }) exports | ||
where | ||
removeHiding export = filter (`notElem` hiding') thisExports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thisExports :: [FullyQualifiedName]
but hiding' :: [QualifiedName]
, those will never match AFAIU. The type system could've saved you here. Next time use it :p
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm nevermind, but I just realized the whole parsing below is completely pointless. Just keeping more information by making FullyQualifiedName a record is much easier.
Case when this is relevant: consider a query for source point like this: something other ^--- queryed here Which one do we choose, former or latter? I would argue we choose both and let the client decide.
Apparently, ghc 7.8 can be picky when to give you a package version. It can return just empty version for wired-in packages like base, etc. So I suppose we have to guess those from haddock file path if we can...
I think at this point this is "good enough". I could probably refine this ad infinum given the chance, but I think I have to stop at some point, and this particular point seems as good as any. @DanielG, if you could review this, that would be cool. |
de6e711
to
ab14d5e
Compare
ab14d5e
to
87808c9
Compare
Looks good, though we had a mode to just print the package+module name instead of the full haddock path (see comments following #810 (comment)) . @lierdakil did you remove that? Also we seem to have reverted to using |
Yep, missed that bit. I basically reimplemented the whole deal from scratch while stealing bits and pieces from @carlohamalainen's implementation when appropriate, so I was bound to miss something. Although I should point out that while hackage url can be, in general, inferred from package id, module and symbol, local haddock path can not, and current implementation prefers the latter if it's available. So there's that. I think we can solve this problem in another way though, see below.
Reason being, those Also while on the topic of library users. I've been bitching about library interface for a while (#696), and now seems as good a time as any to start imposing at least some structure on the returned values. So what do you think about returning |
Returning proper datatypes instead of strings sounds lovely actually I don't see why we shouldn't. |
I updated this PR against the master branch but I'm not seeing any status from travis - is there something else that I have to do? |
We've stopped using travis a while ago. The builds are now on Gitlab(CI) but it looks like the repo mirroring has broken, I'm looking into that. If you have a gitlab account I can add you there so you can push this branch to the other repo as well, which will trigger a build. FYI you can actually configure git to push to multiple repos at once when you push to a remote, see https://gist.github.com/bjmiller121/f93cd974ff709d2b968f |
Just made an account: https://gitlab.com/carlohamalainen |
Done |
@carlohamalainen are you still working on this? Do you need help with the new CI setup or something? |
No description provided.