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

Support building with GHC 9.2 #1349

Merged
merged 7 commits into from
May 5, 2022
Merged

Support building with GHC 9.2 #1349

merged 7 commits into from
May 5, 2022

Commits on May 4, 2022

  1. Support building with GHC 9.2

    This contains a variety of changes needed to make Cryptol compile with GHC 9.2:
    
    * In GHC 9.2, enabling `UndecidableInstances` no longer implies
      enabling `FlexibleContexts` (see
      [here](https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.2?version_id=7e2ce63ba042c1934654c4316dc02028d8d3dd31#undecidableinstances-no-longer-implies-flexiblecontexts-in-instance-declarations)).
      As a result, I had to enable `FlexibleContexts` in
      `Cryptol.ModuleSystem.Name`.
    * The `argo` submodule was bumped to bring in the changes from
      GaloisInc/argo#191, which allows it to build with GHC 9.2.
    * The upper version bounds on `base`, `bytestring`, `lens`, `base-compat`, and
      `sbv` were raised to allow building them with GHC 9.2.
    RyanGlScott committed May 4, 2022
    Configuration menu
    Copy the full SHA
    980e652 View commit details
    Browse the repository at this point in the history
  2. Fix -Woperator-whitespace-ext-conflict warnings

    GHC 9.2 now includes `-Woperator-whitespace-ext-conflict` as a part of `-Wall`.
    Thankfully, these warnings are simple to resolve: just put extra whitespace
    after the affected uses of `$`.
    RyanGlScott committed May 4, 2022
    Configuration menu
    Copy the full SHA
    5f01844 View commit details
    Browse the repository at this point in the history
  3. Fix -Wnoncanonical-{monad,monoid}-instances warnings

    GHC 9.2 adds `-Wnoncanonical-monad-instances` and
    `-Wnoncanonical-monoid-instances` to `-Wall`, which warn whenever one has
    explicit implementations of `return` or `mappend` that aren't simply
    `return = pure` or `mappend = (<>)`. This patch makes sure that all `Monad`
    and `Monoid` instances in Cryptol adhere to these conventions.
    RyanGlScott committed May 4, 2022
    Configuration menu
    Copy the full SHA
    e5ff87f View commit details
    Browse the repository at this point in the history
  4. Fix an -Woverlapping-patterns warning uncovered by GHC 9.2

    GHC 9.2 has a more aggressive pattern-match coverage checker than in previous
    versions, which reveals that the `detailedPrompt` case of `mkPrompt` is
    unreachable. This is technically true, as `detailedPrompt = False`, but it
    would be nice if we didn't get a warning just for keeping this code around.
    This simplest solution is to just change `detailedPrompt` to be `id False`,
    which defeats the coverage checker.
    
    An alternative would be to use `GHC.Exts`' newly added `considerAccessible`
    function (see https://gitlab.haskell.org/ghc/ghc/-/merge_requests/5100), but
    this would require CPP.
    RyanGlScott committed May 4, 2022
    Configuration menu
    Copy the full SHA
    634844f View commit details
    Browse the repository at this point in the history
  5. Fix -Wincomplete-uni-patterns warnings

    GHC 9.2 now includes `-Wincomplete-uni-patterns` as a part of `-Wall`. As a
    result, building Cryptol with GHC 9.2 uncovers some previously undetected
    warnings.
    
    Some warnings can be fixed by rewriting the code slightly. For example,
    changing a use of `Data.List.groupBy` to `Data.List.NonEmpty.groupBy` avoids
    the need for an incomplete match on `(_ : _)` on the value that `groupBy`
    returns. (Since `Data.List.NonEmpty` was added to `base` in `4.9`, this also
    requires bumping the lower version bounds on `base` slightly.)
    
    Other warnings were fixed by explicitly adding fall-through `error` cases.
    The resulting code is no less partial than before, but it avoids warnings and
    should provide a more specific error in the event that the fall-through cases
    are reached.
    
    Yet another class of warnings are those caused by the use of irrefutable
    patterns, such as the definition of `ar1 ~[x] = x` in
    `Cryptol.TypeCheck.TypePat`. It's rather unfortunate that
    `-Wincomplete-uni-patterns` warns about these
    (see https://gitlab.haskell.org/ghc/ghc/-/issues/14800), as the only way to
    avoid the warning would be to rewrite these functions to use refutable
    patterns, thereby changing their strictness properties. I've decided to simply
    disable `-Wincomplete-uni-patterns` in each module that uses irrefutable
    patterns to avoid this issue. I've written also written a Note explaining the
    reasoning and referenced it in the affected modules.
    RyanGlScott committed May 4, 2022
    Configuration menu
    Copy the full SHA
    1dd4311 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    86ee1c9 View commit details
    Browse the repository at this point in the history
  7. CI: Test GHC 9.2.2

    RyanGlScott committed May 4, 2022
    Configuration menu
    Copy the full SHA
    22c61d6 View commit details
    Browse the repository at this point in the history