-
Notifications
You must be signed in to change notification settings - Fork 141
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
Action/Server refactors #391
base: master
Are you sure you want to change the base?
Conversation
cc @smatting |
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.
Thanks very much for the PR! I suggest I review/land this one first, before looking at the others, so we can get through them in order. Let me know if that doesn't seem reasonable.
A few notes - I think the use of Wall makes the code worse in a few ways, but better in a bunch, so I think just winding back a few of them makes sense. Overall, looks good and some nice improvements. Thanks!
src/Action/Server.hs
Outdated
@@ -1,7 +1,10 @@ | |||
{-# LANGUAGE ViewPatterns, TupleSections, RecordWildCards, ScopedTypeVariables, PatternGuards #-} | |||
{-# LANGUAGE OverloadedStrings #-} | |||
{-# LANGUAGE MultiWayIf #-} | |||
{-# OPTIONS_GHC -Wall #-} |
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 generally find this a bad thing to put in the source code directly - what is in Wall changes, and not all the things in there are a good idea.
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 didn’t want to fix warnings in the whole codebase for now, so I only scoped it to this module; do you want to just remove -Wall
or have something else in mind?
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 opted for manually disabling the shadowing warnings & pattern warnings again
src/Action/Server.hs
Outdated
where k = key x | ||
|
||
data UrlOpts = IsHaddockUrl | IsLocalUrl | IsOtherUrl |
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.
Would be great if this data type had some comments as to what each of the types of url looked like or represented (I appreciate this was missing before, but now we have the type, it should be easy to add)
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 don’t actually know what these mean semantically, I just refactored. I’ll leave it up to you to document the cases :)
1cf7774
to
10ecb58
Compare
Okay, I addressed all the comments I think. |
10ecb58
to
612583a
Compare
I seem to be getting failures on newer GHC:
Happy with removing the wall, or fixing it. Also wouldn't be averse to using NonEmpty in the right places to fix it too. |
Ah yeah, must have improved the exhaustiveness checking. Will fix |
I opted for removing |
ok looks like the others are unrelated on MacOS:
on Ubuntu:
|
The `local` and `haddock` booleans are only used for determining the URLs to generate, so let’s make that clear.
The function does not really deduplicate the elements, it takes and groups. :)
Upstream does not think shadowing should be avoided, so let’s undo the changes to shadowing. Same with incomplete pattern warnings, we’ll just let it crash for now. Also drop the `Is*` prefix for the URL constructors.
CI unfortunately uses -Werror and tests against more modern versions of GHC, so any new errors will only appear on CI.
eac22f7
to
efd152e
Compare
Okay, I might have some time to work on these again, I rebased. I think most of the comments have been fixed, PTAL. |
Now all CI runs fail because of the copyright year :( |
A bunch of refactors that fell out of a study session of the module list generation code.
The original goal (at Munihac) was to change the sort order, so that the home module of a target is listed first, but we didn’t get that far.
So this is a bunch of refactors that do not (or should not) change any behavior. Any changes will be submitted in separate PRs.