-
Notifications
You must be signed in to change notification settings - Fork 205
PackageRank #1091
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
base: master
Are you sure you want to change the base?
PackageRank #1091
Conversation
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 think you can avoid these partial functions by using NonEmpty. See comments.
versionList = sortBy (flip compare) | ||
$ map (pkgVersion . package . packageDescription) (pkgDesc <$> pkgs) | ||
packageEntr = do | ||
tarB <- packageTarball tarCache . head $ pkgs |
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.
Avoidable partial function
return (temp <> versS <> codeS <> authorScore maintainers pkg) | ||
|
||
where | ||
pkg = packageDescription <$> pkgDesc $ last pkgs |
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.
Avoidable partial function
constructItem :: [PkgInfo] -> IO (PackageName, PackageItem) | ||
constructItem pkgs = do | ||
let pkgname = packageName pkg | ||
pkg = last pkgs |
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.
Avoidable partial function
total | ||
. (<>) (rankPackagePage pkgD) | ||
<$> rankIO versions recentDownloads maintainers docs env tarCache pkgs | ||
where pkgD = packageDescription $ pkgDesc $ last pkgs |
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.
Avoidable partial function
False -> do | ||
index <- queryGetPackageIndex | ||
let pkgs = PackageIndex.lookupPackageName index pkgname | ||
case pkgs 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.
this can case on Data.NonEmpty.nonEmpty pkgs
instead. Then the Just nonEmptyList
case can pass that list on to constructItem
Thank you for the comments In my last two commits I fixed all the partial functions in PackageRank. The partial function in PackageList is in my opinion better left as is since it was that way even before my changes and on line 256 using NonEmpty would lead to Maybe PackageIndex. Which is not something that is wanted? |
At this moment PackageRank should be structure-wise complete. Some parameters will need to be adjusted and there may be some bugs. Caching some data (ex. freshness for dependencies would require parsing all their PkgInfo (not included)) is missing. UI is a bit arbitrary so that might also change. |
UI at the moment @ysangkok |
What's blocking us from having this merged? Looks like a great feature to have. |
The indirect dependencies feature was merged and it would be nice to use it here, adding a cache for the package values would be good and the parameters are somewhat arbitrary at the moment. I plan to get this into mergeable state in June. |
@kubaneko Good, that's great to hear. |
…ank will display as Int between 1000 and 0
I rebased and added some version of #1082 to PackageRank. I tested this by mirroring 600 package from hackage and the numbers it gives look reasonable. The performance implications are unclear to me, since I do not have the download speed to mirror the whole hackage but it was not too bad (I am unsure if adding indirect dependencies is a problem). There is definitely still work that can be done:
Currently I would like if someone with a hackage mirror would try what the slowdown is. If it is not noticable than I propose to merge this otherwise I will get to making the cache. Any more comments/suggestions are of course welcome |
This PR is for implementing #986 as an GSoC project. Mentored by @gbaz .
I will correct the error I made in the change.