Skip to content
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

Massaging Upper Bounds #494

Merged
merged 9 commits into from
May 24, 2019
Merged

Massaging Upper Bounds #494

merged 9 commits into from
May 24, 2019

Conversation

fosskers
Copy link
Contributor

@fosskers fosskers commented May 3, 2019

This branch forks off from Pact right before the breaking changes of #482 . It tickles some of Pact's upper bounds, which allows for a simpler stack.yaml which full GHC 8.6 support, and eventually a simpler default.nix.

In general, this should probably not be merged. It could potentially be the basis of a 2.6.2 release, but we need not spend time on that now. Chainweb's own 8.6 support could be based off this branch in the short-term.

This branch also revealed some compilation issues, as explained in #495 .

Closes #495

joelburget added a commit that referenced this pull request May 3, 2019
Tested with `stack test` (all passing).

Fixes #494.
@fosskers
Copy link
Contributor Author

fosskers commented May 6, 2019

This passes tests locally (while on z3-4.8.3 of course)

Copy link
Contributor

@sirlensalot sirlensalot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks good to me, and doesn't touch default.nix so I would think it's safe to merge.

@fosskers
Copy link
Contributor Author

So long as we're okay with stack pointing to GHC 8.6, while Nix does not.

@sirlensalot
Copy link
Contributor

@mightybyte any opinion here?

@mightybyte
Copy link
Contributor

I don't have a problem with this. It could end up requiring more of our work to support both versions simultaneously, but as long as we're staying away from CPP territory it probably won't be a huge problem.

fosskers and others added 6 commits May 20, 2019 08:55
This allows the library to build (and be depended on) without "breaking open"
the build with heavy-hammers like `--allow-newer` when compiling with
GHC 8.6. The test suite still does not build, due to some naughty
partial pattern matches.
These locations trigger errors on ghc 8.6 for missing `MonadFail`
instances.

Fixes #495.
Tested with `stack test` (all passing).

Fixes #494.
ModuleData mod1 _refs <- ExceptT $ stateModuleData "mod1" replState0
ModuleData mod2 _refs <- ExceptT $ stateModuleData "mod2" replState0
ExceptT . fmap (first show) . serveAndRequest 3001 $
Remote.Request [derefDef <$> mod2, derefDef <$> mod1] "mod2"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An example of how to avoid partial pattern matches, as well as wanton error calls.


# Linux build
- env: BUILD=stack ARGS="-j1" Z3VERSION="4.8.3"
addons:
apt: {packages: [libgmp-dev]}
artifacts:
paths:
- .stack-work/dist/x86_64-linux/Cabal-2.2.0.1/build/pact/pact
- .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/pact/pact
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These paths would change with the bump to lts-13.*. Does another tool / integration expect these paths to have an exact shape (say 2.2 vs 2.4), say for deployment? I wouldn't want to break anything here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe windows? Trying to find out where our windows life is at currently elsewhere too. @vaibhavsagar ?

@fosskers
Copy link
Contributor Author

fosskers commented May 20, 2019

This PR is now current with master.

@slpopejoy Unfortunately, the Analyze code still contains a number of instances of "running out the exhaustion checker". We currently have this in the updated stack.yaml:

# GHC 8.6 has a more aggressive Pattern Match exhaustion checker. A number of
# Pact's `Analysis` modules cause seeming infinite loops in the compiler during
# this analysis, so here we limit the depth to 5000, then override `-Werror`
# with `-Wwarn` to avoid failing the build.
ghc-options:
  pact: -fmax-pmcheck-iterations=5000 -Wwarn

This smooths things over for devs who use Stack during their day-to-day, but our Travis CI config reinforces -Werror, regardless of what's in stack.yaml or pact.cabal. So, these builds fail in Travis. The warnings themselves aren't strictly errors, and the pattern of code that leads to the warnings has always been there, it's just that GHC 8.6 in particular is smart enough to detect them, whereas 8.4 is not.

Thoughts about how this PR should proceed?

@joelburget
Copy link
Contributor

@fosskers I can take a look at the Analyze problem in a few days when I get back from vacation

@fosskers
Copy link
Contributor Author

Thanks @joelburget , no rush.

GHC 8.6's pattern match checker seems to have some bugs related to
pattern synonyms (eg https://gitlab.haskell.org/ghc/ghc/issues/14253).
We remove a few places where the `SObject` pattern synonym erroneously
triggered a failure. We can also remove the
`-fmax-pmcheck-iterations=5000` option.

Tested via:

```
cabal clean; cabal test
stack clean; stack test
```
@joelburget
Copy link
Contributor

I was able to remove the -fmax-pmcheck-iterations options by removing some pattern synonyms. Do let me know if there are more analysis issues.

@fosskers
Copy link
Contributor Author

Thanks @joelburget , testing now.

@fosskers fosskers changed the title [side branch] Massaging Upper Bounds Massaging Upper Bounds May 24, 2019
Copy link
Contributor

@sirlensalot sirlensalot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. We might need to figure out how this impacts the Windows build but since we're delayed getting an answer would be good to get this in.

@sirlensalot sirlensalot merged commit e1889e9 into master May 24, 2019
@sirlensalot sirlensalot deleted the colin/ghc86-massaging branch May 24, 2019 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider avoiding partial pattern matches in tests
4 participants