-
Notifications
You must be signed in to change notification settings - Fork 37
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
WIP: GHC 8.2 revamp #182
WIP: GHC 8.2 revamp #182
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.
Some concerns inline.
@@ -552,6 +554,7 @@ promotePat (DBangPa pat) = do | |||
qReportWarning "Strict pattern converted into regular pattern in promotion" | |||
(ty, pat') <- promotePat pat | |||
return (ty, DBangPa pat') | |||
promotePat (DSigPa _pat _ty) = error "TODO: Handle SigPa" |
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.
To be honest, I'm not quite sure how one would promote a DSigPa
. Suggestions welcome.
@@ -499,6 +501,7 @@ singPat var_proms patCxt (DTildePa pat) = do | |||
singPat var_proms patCxt (DBangPa pat) = do | |||
(pat', ty) <- singPat var_proms patCxt pat | |||
return (DBangPa pat', ty) | |||
singPat _var_proms _patCxt (DSigPa _pat _ty) = error "TODO: Handle SigPa" |
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.
Similarly, how do we single DSigPa
s?
stock = case strat of | ||
Nothing -> True | ||
Just StockStrategy -> True | ||
Just _ -> False |
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 to only choose deriving
clauses with an explicit strategy when that strategy is stock
. We could make it more permissive and ignore the strategy, however.
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 agree with this choice.
-- implementation of permutations in base. However, it is needed | ||
-- here, since (at least in GHC 8.2.1) the singletonized version | ||
-- will fail to typecheck without it. See #13549 for the full story. | ||
interleave' :: ([a] -> b) -> [a] -> [b] -> ([a], [b]) |
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.
It turns out adding one type signature is enough to work around GHC Trac #13549. Hooray!
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.
See my comment to GHC's #13459. This type signature is indeed necessary: a type signature is required on a local function if its type is inferred differently depending on the presence of MonoLocalBinds
. This is the case here.
@@ -1,3 +1,6 @@ | |||
|
|||
Singletons/BadBoundedDeriving.hs:0:0: error: | |||
Can't derive Bounded instance for Foo_0 a_1. | |||
| | |||
6 | $(singletons [d| | |||
| ^^^^^^^^^^^^^^... |
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.
Do you think we should include these error message locations in golden files? They do add some degree of bloat.
Another TODO: the Travis build is failing because Perhaps we should just make the test suite depend on
I don't think making the test suite depend on |
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 is a large patch. I will review when I have a bit more time than I do at the moment -- perhaps tomorrow. Many thanks for doing this!
-- implementation of permutations in base. However, it is needed | ||
-- here, since (at least in GHC 8.2.1) the singletonized version | ||
-- will fail to typecheck without it. See #13549 for the full story. | ||
interleave' :: ([a] -> b) -> [a] -> [b] -> ([a], [b]) |
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.
See my comment to GHC's #13459. This type signature is indeed necessary: a type signature is required on a local function if its type is inferred differently depending on the presence of MonoLocalBinds
. This is the case here.
Somehow just saw your last comment, about Cabal and |
OK, adding |
Ah, here's a hunch. In the test suite, we do normalization with
In particular, we normalize this pattern: "-e", "'s/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/0123456789/g'" This works assuming that whenever you have something like |
Luckily, adding more patterns for |
Should this be closed now that 637fb4d has been committed? |
Don't close quite yet. I did merge (it passes the testsuite) but I haven't reviewed carefully yet. Will do so soon. |
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.
Reviewed. Looks great. Thanks.
stock = case strat of | ||
Nothing -> True | ||
Just StockStrategy -> True | ||
Just _ -> False |
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 agree with this choice.
This has been merged. |
Fixes #180 while I'm in town.