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

Consider avoiding partial pattern matches in tests #495

Closed
fosskers opened this issue May 3, 2019 · 0 comments · Fixed by #494
Closed

Consider avoiding partial pattern matches in tests #495

fosskers opened this issue May 3, 2019 · 0 comments · Fixed by #494

Comments

@fosskers
Copy link
Contributor

fosskers commented May 3, 2019

GHC 8.6 is more strict that 8.4 regarding its analysis of incomplete pattern matches. I think this helps us more than it hinders us, as it lets us avoid foot-gun in the long term.

In the short term, this strictness causes warnings, and a few compilation errors. In particular, the following 4 locations in the test suites trigger errors involving missing MonadFail instances (arising from partial pattern matches):

See #494 for a branch where the errors can easily be reproduced.

We can approach a solution in few ways:

  1. Hope that this PR to hedgehog fixes all four issues (see also this issue for more info)
  2. Avoid the partial matches ourselves
joelburget added a commit that referenced this issue May 3, 2019
These locations trigger errors on ghc 8.6 for missing `MonadFail`
instances.

Fixes #495.
joelburget added a commit that referenced this issue May 3, 2019
These locations trigger errors on ghc 8.6 for missing `MonadFail`
instances.

Fixes #495.
fosskers pushed a commit that referenced this issue May 20, 2019
These locations trigger errors on ghc 8.6 for missing `MonadFail`
instances.

Fixes #495.
sirlensalot pushed a commit that referenced this issue May 24, 2019
* Massaging upper bounds

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.

* Remove partial pattern matches from hedgehog generators.

These locations trigger errors on ghc 8.6 for missing `MonadFail`
instances.

Fixes #495.

* Fix remaining monad pattern matches for ghc 8.6.

Tested with `stack test` (all passing).

Fixes #494.

* [stack] Bump `sbv` pin [skip ci]

* [stack] Bump resolver

* Fix compile errors

* [travis] Modify artefact paths

* Fix Analysis pattern match checks.

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
```

* Remove unneeded sections from `cabal.project`
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 a pull request may close this issue.

1 participant