[commit: ghc] master: Revamp Backpack/hs-boot handling of type class signatures. (5def07f)

git at git.haskell.org git at git.haskell.org
Wed Jan 11 14:54:35 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/5def07fadd386a7a7c3a12963c0736529e377a74/ghc

>---------------------------------------------------------------

commit 5def07fadd386a7a7c3a12963c0736529e377a74
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date:   Thu Jan 5 13:52:12 2017 -0800

    Revamp Backpack/hs-boot handling of type class signatures.
    
    Summary:
    A basket of fixes and improvements:
    
    - The permissible things that one can write in a type
      class definition in an hsig file has been reduced
      to encompass the following things:
    
        - Methods
        - Default method signatures (but NOT implementation)
        - MINIMAL pragma
    
      It is no longer necessary nor encouraged to specify
      that a method has a default if it is mentioned in
      a MINIMAL pragma; the MINIMAL pragma is assumed to
      provide the base truth as to what methods need to
      be implemented when writing instances of a type
      class.
    
    - Handling of default method signatures in hsig was
      previously buggy, as these identifiers were not exported,
      so we now treat them similarly to DFuns.
    
    - Default methods are merged, where methods with defaults
      override those without.
    
    - MINIMAL pragmas are merged by ORing together pragmas.
    
    - Matching has been relaxed: a method with a default can
      be used to fill a signature which did not declare the
      method as having a default, and a more relaxed MINIMAL
      pragma can be used (we check if the signature pragma
      implies the final implementation pragma, on the way
      fixing a bug with BooleanFormula.implies, see #13073)
    
    Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>
    
    Test Plan: validate
    
    Reviewers: simonpj, bgamari, austin
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2925
    
    GHC Trac Issues: #13041


>---------------------------------------------------------------

5def07fadd386a7a7c3a12963c0736529e377a74
 compiler/backpack/RnModIface.hs                    | 17 ++++++----
 compiler/basicTypes/OccName.hs                     |  8 ++++-
 compiler/iface/TcIface.hs                          | 14 ++++++++
 compiler/typecheck/TcClassDcl.hs                   | 29 ++++++++++++++---
 compiler/typecheck/TcRnDriver.hs                   | 35 +++++++++++++++++---
 compiler/utils/BooleanFormula.hs                   | 37 +++++++++++++++++++---
 testsuite/tests/backpack/should_compile/all.T      |  2 ++
 testsuite/tests/backpack/should_compile/bkp15.bkp  | 19 ++++-------
 .../tests/backpack/should_compile/bkp15.stderr     | 18 -----------
 testsuite/tests/backpack/should_compile/bkp46.bkp  | 32 +++++++++++++++++++
 .../tests/backpack/should_compile/bkp46.stderr     | 12 +++++++
 testsuite/tests/backpack/should_compile/bkp47.bkp  | 20 ++++++++++++
 .../should_compile/{bkp45.stderr => bkp47.stderr}  |  5 +++
 testsuite/tests/backpack/should_fail/all.T         |  3 ++
 testsuite/tests/backpack/should_fail/bkpfail39.bkp |  6 ++++
 testsuite/tests/backpack/should_fail/bkpfail40.bkp |  5 +++
 .../tests/backpack/should_fail/bkpfail40.stderr    |  6 ++++
 testsuite/tests/backpack/should_fail/bkpfail41.bkp | 13 ++++++++
 .../tests/backpack/should_fail/bkpfail41.stderr    | 22 +++++++++++++
 .../tests/rename/should_fail/rnfail055.stderr      |  1 +
 20 files changed, 252 insertions(+), 52 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 5def07fadd386a7a7c3a12963c0736529e377a74


More information about the ghc-commits mailing list