1. 21 Sep, 2015 4 commits
    • Edward Z. Yang's avatar
      Unify hsig and hs-boot; add preliminary "hs-boot" merging. · 06d46b1e
      Edward Z. Yang authored
      This patch drops the file level distinction between hs-boot and hsig;
      we figure out which one we are compiling based on whether or not there
      is a corresponding hs file lying around.
      
      To make the "import A" syntax continue to work for bare hs-boot
      files, we also introduce hs-boot merging, which takes an A.hi-boot
      and converts it to an A.hi when there is no A.hs file in scope.
      This will be generalized in Backpack to merge multiple A.hi files together;
      which means we can jettison the "load multiple interface files" functionality.
      
      This works automatically for --make, but for one-shot compilation
      we need a new mode: ghc --merge-requirements A will generate an A.hi/A.o
      from a local A.hi-boot file; Backpack will extend this mechanism further.
      
      Has Haddock submodule update to deal with change in msHsFilePath behavior.
      
          - This commit drops support for the hsig extension. Can
            we support it?  It's annoying because the finder code is
            written with the assumption that where there's an hs-boot
            file, there's always an hs file too.  To support hsig, you'd
            have to probe two locations.  Easier to just not support it.
      
          - #10333 affects us, modifying an hs-boot still doesn't trigger
            recomp.
      
          - See compiler/main/Finder.hs: this diff is very skeevy, but
            it seems to work.
      
          - This code cunningly doesn't drop hs-boot files from the
            "drop hs-boot files" module graph, if they don't have a
            corresponding hs file.  I have no idea if this actually is useful.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: validate
      
      Reviewers: simonpj, austin, bgamari, spinda
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1098
      06d46b1e
    • Edward Z. Yang's avatar
      09d214dc
    • eir@cis.upenn.edu's avatar
      Refactor BranchLists. · cd2840a7
      eir@cis.upenn.edu authored
      Now we use Array to store branches. This makes sense because we often
      have to do random access (once inference is done). This also vastly
      simplifies the awkward BranchList type.
      
      This fixes #10837 and updates submodule utils/haddock.
      cd2840a7
    • eir@cis.upenn.edu's avatar
      Perform a validity check on assoc type defaults. · e27b267f
      eir@cis.upenn.edu authored
      This fixes #10817 and #10899. A knock-on effect is that we must
      now remember locations of associated type defaults for error
      messages during validity checking. This isn't too bad, but it
      increases the size of the diff somewhat.
      
      Test cases: indexed-types/should_fail/T108{17,99}
      e27b267f
  2. 19 Sep, 2015 1 commit
    • eir@cis.upenn.edu's avatar
      Fix #10815 by kind-checking type patterns against known kinds. · 2d4db40a
      eir@cis.upenn.edu authored
      tcFamTyPats now must take information about the instantiation of any
      class variables, when checking the instance of an associated type.
      
      Getting this to work out required some unexpected refactoring in
      TcDeriv. TcDeriv needs to look at class instances because of the
      possibility of associated datatypes with `deriving` specs. TcDeriv
      worked over the user-specified instances. But any data family instances
      were already processed, and TcDeriv had no way of finding the rep
      tycons. Indeed, TcDeriv *re-type-checked* any data family instances
      in an attempt to rediscover what GHC already knew. So, this commit
      introduces better tracking of compiled data families between TcInstDcls
      and TcDeriv to streamline all of this.
      2d4db40a
  3. 03 Sep, 2015 1 commit
  4. 26 Aug, 2015 1 commit
  5. 05 Aug, 2015 2 commits
    • Simon Peyton Jones's avatar
      Fix quantification for inference with sigs · 28096b27
      Simon Peyton Jones authored
      When we are *inferring* the type of a let-bound function,
      we might still have a type signature.  And we must be sure
      to quantify over its type variables, else you get the crash
      in Trac #10615.
      
      See Note [Which type variables to quantify] in TcSimplify
      28096b27
    • Simon Peyton Jones's avatar
      Tidy up and refactor wildcard handling · 95364812
      Simon Peyton Jones authored
      When examining #10615, I found the wildcard handling hard
      to understand.  This patch refactors quite a bit, but with
      no real change in behaviour.
      
       * Split out TcIdSigInfo from TcSigInfo, as a separate type,
         like TcPatSynInfo.
      
       * Make TcIdSigInfo express more invariants by pushing the
         wildard info into TcIdSigBndr
      
       * Remove all special treatment of unification variables that arise
         from wildcards; so the TauTv of TcType.MetaInfo loses its Bool
         argument.
      
      A ton of konck on changes.  The result is significantly simpler, I think.
      95364812
  6. 27 Jul, 2015 1 commit
    • Adam Sandberg Eriksson's avatar
      Implementation of StrictData language extension · f842ad6c
      Adam Sandberg Eriksson authored
      This implements the `StrictData` language extension, which lets the
      programmer default to strict data fields in datatype declarations on a
      per-module basis.
      
      Specification and motivation can be found at
      https://ghc.haskell.org/trac/ghc/wiki/StrictPragma
      
      This includes a tricky parser change due to conflicts regarding `~` in
      the type level syntax: all ~'s are parsed as strictness annotations (see
      `strict_mark` in Parser.y) and then turned into equality constraints at
      the appropriate places using `RdrHsSyn.splitTilde`.
      
      Updates haddock submodule.
      
      Test Plan: Validate through Harbormaster.
      
      Reviewers: goldfire, austin, hvr, simonpj, tibbe, bgamari
      
      Reviewed By: simonpj, tibbe, bgamari
      
      Subscribers: lelf, simonpj, alanz, goldfire, thomie, bgamari, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D1033
      
      GHC Trac Issues: #8347
      f842ad6c
  7. 21 Jul, 2015 2 commits
    • Simon Peyton Jones's avatar
      Refactor self-boot info · 3c44a46b
      Simon Peyton Jones authored
      This patch is a simple refactoring that prepares for a later one,
      related to Trac #10083.
      
      * Add a field tcg_self_boot :: SelfBootInfo to TcGblEnv,
        where SelfBootInfo is a new data type, describing the
        hi-boot file, if any, for the module being compiled.
      
      * Make tcHiBootIface return SelfBootInfo, a new data type
      
      * Make other functions get SelfBootInfo from the monad.
      
      * Remove tcg_mod_name from TcGblEnv; it was barely used and
        simpler to pass around explicitly.
      3c44a46b
    • Edward Z. Yang's avatar
      0c6c015d
  8. 16 Jun, 2015 1 commit
  9. 11 Jun, 2015 2 commits
  10. 09 Jun, 2015 1 commit
    • thomasw's avatar
      Refactor wild card renaming · 058af6c9
      thomasw authored
      Summary:
      Refactor wild card error reporting
      
      * Merge `HsWildcardTy` and `HsNamedWildcardTy` into one constructor
        `HsWildCardTy` with as field the new type `HsWildCardInfo`, which has two
        constructors: `AnonWildCard` and `NamedWildCard`.
      
      * All partial type checks are removed from `RdrHsSyn.hs` and are now done
        during renaming in order to report better error messages. When wild cards
        are allowed in a type, the new function `rnLHsTypeWithWildCards` (or
        `rnHsSigTypeWithWildCards`) should be used. This will bring the named wild
        cards into scope before renaming them. When this is not done, renaming will
        trigger "Unexpected wild card..." errors.
      
        Unfortunately, this has to be done separately for anonymous wild cards
        because they are given a fresh name during renaming, so they will not cause
        an out-of-scope error. They are handled in `tc_hs_type`, as a special case
        of a lookup that fails.
      
        The previous opt-out approach is replaced with an opt-in approach. No more
        panics because of forgotten checks!
      
      * `[t| _ |]` isn't caught by the above two checks, so it is currently handled
        by a special case. The error message (generated in the `DsM` monad) doesn't
        provide as much context information as the other cases.
      
      * Instead of three (!) functions that walk `HsType`, there is now only one
        pure function called `collectWildCards`.
      
      * Alternative approach: catch all unwanted wild cards in `rnHsTyKi` by looking
        at the `HsDocContext`. This will reduce the number of places to catch
        unwanted wild cards form three to one, and make the error messages more
        uniform, albeit less informative, as the error context for renaming is not
        as informative as the one for type checking. A new constructor of
        `HsDocContext` will be required for pattern synonyms signatures.
      
        Small problem: currently type-class type signatures can't be distinguished
        from type signatures using the `HsDocContext`.
      
      This requires an update to the Haddock submodule.
      
      Test Plan: validate
      
      Reviewers: goldfire, simonpj, austin
      
      Reviewed By: simonpj
      
      Subscribers: bgamari, thomie, goldfire
      
      Differential Revision: https://phabricator.haskell.org/D613
      
      GHC Trac Issues: #10098
      058af6c9
  11. 03 Jun, 2015 1 commit
    • Simon Peyton Jones's avatar
      Refactor RdrName.Provenance, to fix #7672 · 7ea156ae
      Simon Peyton Jones authored
      Trac #7672 has a data type T in module A that is in scope
      *both* locally-bound *and* imported (with a qualified) name.
      The Provenance of a GlobalRdrElt simply couldn't express that
      before. Now you can.
      
      In doing so, I flattened out Provenance into GlobalRdrElt,
      so quite a lot of modules are touched in a not-very-interesting
      way.
      7ea156ae
  12. 02 Jun, 2015 1 commit
  13. 01 Jun, 2015 2 commits
    • Simon Peyton Jones's avatar
      Refactor the GlobalRdrEnv, fixing #7672 · 9b73cb16
      Simon Peyton Jones authored
      This patch started innocently enough, by deleting a single
      call from rnImportDecl, namely
      
          let gbl_env = mkGlobalRdrEnv (filterOut from_this_mod gres)
      
      The 'filterOut' makes no sense, and was the cause of #7672.
      
      But that little loose end led to into a twisty maze of little
      passages, all alike, which has taken me an unreasonably long
      time to straighten out. Happily, I think the result is really
      much better.
      
      In particular:
      
       * INVARIANT 1 of the GlobalRdrEnv type was simply not true:
         we had multiple GlobalRdrElts in a list with the same
         gre_name field. This kludgily implmented one form of
         shadowing.
      
       * Meanwhile, extendGlobalRdrEnvRn implemented a second form of
         shadowing, by deleting stuff from the GlobalRdrEnv.
      
       * In turn, much of this shadowing stuff depended on the Names of
         the Ids bound in the GHCi InteractiveContext being Internal
         names, even though the TyCons and suchlike all had External
         Names. Very confusing.
      
      So I have made the following changes
      
       * I re-established INVARIANT 1 of GlobalRdrEnv.  As a result
         some strange code in RdrName.pickGREs goes away.
      
       * RnNames.extendGlobalRdrEnvRn now makes one call to deal with
         shadowing, where necessary, and another to extend the
         environment.  It deals separately with duplicate bindings.
      
         The very complicated RdrName.extendGlobalRdrEnv becomes much
         simpler; we need to export the shadowing function, now called
         RdrName.shadowNames; and we can nuke
         RdrName.findLocalDupsRdrEnv altogether.
      
         RdrName Note [GlobalRdrEnv shadowing] summarises the shadowing
         story
      
       * The Names of the Ids bound in the GHCi interactive context are
         now all External.  See Note [Interactively-bound Ids in GHCi]
         in HscTypes.
      
       * Names for Ids created by the debugger are now made by
         IfaceEnv.newInteractiveBinder.  This fixes a lurking bug which
         was that the debugger was using mkNewUniqueSupply 'I' to make
         uniques, which does NOT guarantee a fresh supply of uniques on
         successive calls.
      
       * Note [Template Haskell ambiguity] in RnEnv shows that one TH-related
         error is reported lazily (on occurrences) when it might be better
         reported when extending the environment.  In some (but not all) cases
         this was done before; but now it's uniformly at occurrences.  In
         some ways it'd be better to report when extending the environment,
         but it's a tiresome test and the error is rare, so I'm leaving it
         at the lookup site for now, with the above Note.
      
       * A small thing: RnNames.greAvail becomes RdrName.availFromGRE, where
         it joins the dual RdrName.gresFromAvail.
      9b73cb16
    • Adam Gundry's avatar
      Add constraint creation functions to TcPluginM API · e8a72548
      Adam Gundry authored
      Summary:
      This extends the TcPluginM API with functions to create new constraints,
      as described here:
      https://ghc.haskell.org/trac/ghc/wiki/Plugins/TypeChecker#Post-7.10changestoTcPluginMAPI
      
      Test Plan: validate and hope
      
      Reviewers: austin, yav, christiaanb
      
      Reviewed By: christiaanb
      
      Subscribers: bgamari, thomie
      
      Differential Revision: https://phabricator.haskell.org/D909
      e8a72548
  14. 06 May, 2015 4 commits
    • Austin Seipp's avatar
      Revert "API Annotations : add Locations in hsSyn were layout occurs" · 97d320f5
      Austin Seipp authored
      This reverts commit fb54b2c1.
      
      As Alan pointed out, this will make cherry picking a lot harder until
      7.10.2, so lets back it out until after the release.
      97d320f5
    • Alan Zimmerman's avatar
      API Annotations : add Locations in hsSyn were layout occurs · fb54b2c1
      Alan Zimmerman authored
      At the moment ghc-exactprint, which uses the GHC API Annotations to
      provide a framework for roundtripping Haskell source code with optional
      AST edits, has to implement a horrible workaround to manage the points
      where layout needs to be captured.
      
      These are
      
          MatchGroup
          HsDo
          HsCmdDo
          HsLet
          LetStmt
          HsCmdLet
          GRHSs
      
      To provide a more natural representation, the contents subject to layout
      rules need to be wrapped in a SrcSpan.
      
      This commit does this.
      
      Trac ticket #10250
      
      Reviewed By: austin
      
      Differential Revision: https://phabricator.haskell.org/D815
      
      GHC Trac Issues: #10250
      fb54b2c1
    • Zejun Wu's avatar
      Retain ic_monad and ic_int_print from external packages after load · 03c4893e
      Zejun Wu authored
      Retain ic_monad and ic_int_print in InteractiveContext after load
      when they are defined in external packages. This is supposed to be
      the desired behavior that the interactive-print and setGHCiMonad
      will survive after :cd, :add, :load, :reload and :set in GHCi.
      
      Test Plan:
      Install a interactive-print function and GHCi monad from extenal
      pacakge. Try :cd, :load and other commands, make sure that the
      interactive-print function and GHCi monad always keep the same.
      
      Reviewed By: simonmar
      
      Differential Revision: https://phabricator.haskell.org/D867
      03c4893e
    • Christiaan Baaij's avatar
      Normalise type families in the type of an expression · f7daf5af
      Christiaan Baaij authored
      Before, the type of an expression, and the type of a variable
      binding that expression used to be different in GHCi. The
      reason being that types of bound variables were already normalised.
      Now, both are normalised.
      
      This implements the suggestions as given in Trac #10321
      Also adds an expected output for test T10321
      
      Reviewed By: goldfire, simonpj
      
      Differential Revision: https://phabricator.haskell.org/D870
      
      GHC Trac Issues: #10321
      f7daf5af
  15. 04 May, 2015 1 commit
    • Adam Gundry's avatar
      Permit empty closed type families · 4efa4213
      Adam Gundry authored
      Fixes #9840 and #10306, and includes an alternative resolution to #8028.
      This permits empty closed type families, and documents them in the user
      guide. It updates the Haddock submodule to support the API change.
      
      Test Plan: Added `indexed-types/should_compile/T9840` and updated
      `indexed-types/should_fail/ClosedFam4` and `th/T8028`.
      
      Reviewers: austin, simonpj, goldfire
      
      Reviewed By: goldfire
      
      Subscribers: bgamari, jstolarek, thomie, goldfire
      
      Differential Revision: https://phabricator.haskell.org/D841
      
      GHC Trac Issues: #9840, #10306
      4efa4213
  16. 24 Apr, 2015 1 commit
  17. 22 Apr, 2015 2 commits
  18. 07 Apr, 2015 1 commit
  19. 01 Apr, 2015 1 commit
  20. 17 Mar, 2015 1 commit
  21. 02 Mar, 2015 1 commit
    • Simon Peyton Jones's avatar
      Two kind-polymorphism fixes (Trac #10122) · cabe1748
      Simon Peyton Jones authored
      * The original fix was to improve the documentation, in
        line with the suggestions on Trac #10122
      
      * But in doing so I realised that the kind generalisation in
        TcRnDriver.tcRnType was completely wrong.  So I fixed that
        and updated Note [Kind-generalise in tcRnType] to explain.
      cabe1748
  22. 23 Feb, 2015 2 commits
    • jbracker's avatar
      Fix for ticket #10078: ensure that tcPluginStop is called even in case of type errors · fd581a73
      jbracker authored
      Summary:
      Remove unused variable that appeared through the fix for ticket #10078
      
      Merge branch 'master' of git://git.haskell.org/ghc
      
      Added comment with bug ID.
      
      Reviewers: adamgundry, gridaphobe, austin
      
      Reviewed By: austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D667
      
      GHC Trac Issues: #10078
      fd581a73
    • thomie's avatar
      Error out on `Main` without `main` in GHCi (#7765) · 0fa20726
      thomie authored
      Summary:
      GHC does 2 validation checks for module `Main`:
      * does `main` exist
      * is `main` exported (#414)
      
      The second check is done in ghc as well as in ghci (and runghc and ghc -e).
      The first check however is currently not done in ghci, to prevent "'main' is
      not in scope" errors when loading simple scripts. See commit d28ba8c8 for
      more information.
      
      This commit tightens the special case for ghci. When the file does not contain
      a main function, but does contain an explicit module header (i.e. "module Main
      where"), then /do/ raise an error in ghci (and runghc and ghc -e) as well
      
      Test Plan:
      module/T7765: a module Main with an explicit module header but without a
      main function should be an error for all Ways.
      
      Additionaly: delete test module/mod174. It was added in commit 5a54c38e, but it
      is a duplicate of module/T414.
      
      Reviewers: austin
      
      Reviewed By: austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D649
      
      GHC Trac Issues: #7765
      0fa20726
  23. 11 Feb, 2015 1 commit
    • Simon Peyton Jones's avatar
      nameIsLocalOrFrom should include interactive modules · 6ff3db92
      Simon Peyton Jones authored
      The provoking cause was Trac #10019, but it revealed that nameIsLocalOrFrom
      should really include all interactive modules (ones from the 'interactive'
      package).  Previously we had some ad-hoc 'isInteractiveModule' tests with
      some (but not all) the calls to nameIsLocalOrFrom.
      
      See the new comments with Name.nameIsLocalOrFrom.
      6ff3db92
  24. 10 Feb, 2015 1 commit
    • Simon Peyton Jones's avatar
      Refactor the handling of quasi-quotes · f46360ed
      Simon Peyton Jones authored
      As Trac #10047 points out, a quasi-quotation [n|...blah...|] is supposed
      to behave exactly like $(n "...blah...").  But it doesn't!  This was outright
      wrong: quasiquotes were being run even inside brackets.
      
      Now that TH supports both typed and untyped splices, a quasi-quote is properly
      regarded as a particular syntax for an untyped splice. But apart from that
      they should be treated the same.  So this patch refactors the handling of
      quasiquotes to do just that.
      
      The changes touch quite a lot of files, but mostly in a routine way.
      The biggest changes by far are in RnSplice, and more minor changes in
      TcSplice.  These are the places where there was real work to be done.
      Everything else is routine knock-on changes.
      
      * No more QuasiQuote forms in declarations, expressions, types, etc.
        So we get rid of these data constructors
          * HsBinds.QuasiQuoteD
          * HsExpr.HsSpliceE
          * HsPat.QuasiQuotePat
          * HsType.HsQuasiQuoteTy
      
      * We get rid of the HsQuasiQuote type altogether
      
      * Instead, we augment the HsExpr.HsSplice type to have three
        consructors, for the three types of splice:
          * HsTypedSplice
          * HsUntypedSplice
          * HsQuasiQuote
        There are some related changes in the data types in HsExpr near HsSplice.
        Specifically: PendingRnSplice, PendingTcSplice, UntypedSpliceFlavour.
      
      * In Hooks, we combine rnQuasiQuoteHook and rnRnSpliceHook into one.
        A smaller, clearer interface.
      
      * We have to update the Haddock submodule, to accommodate the hsSyn changes
      f46360ed
  25. 16 Jan, 2015 1 commit
    • Alan Zimmerman's avatar
      API Annotations tweaks. · 11881ec6
      Alan Zimmerman authored
      Summary:
      HsTyLit now has SourceText
      
      Update documentation of HsSyn to reflect which annotations are attached to which element.
      
      Ensure that the parser always keeps HsSCC and HsTickPragma values, to
      be ignored in the desugar phase if not needed
      
      Bringing in SourceText for pragmas
      
      Add Location in NPlusKPat
      
      Add Location in FunDep
      
      Make RecCon payload Located
      
      Explicitly add AnnVal to RdrName where it is compound
      
      Add Location in IPBind
      
      Add Location to name in IEThingAbs
      
      Add Maybe (Located id,Bool) to Match to track fun_id,infix
        This includes converting Match into a record and adding a note about why
        the fun_id needs to be replicated in the Match.
      
      Add Location in KindedTyVar
      
      Sort out semi-colons for parsing
      
        - import statements
        - stmts
        - decls
        - decls_cls
        - decls_inst
      
      This updates the haddock submodule.
      
      Test Plan: ./validate
      
      Reviewers: hvr, austin, goldfire, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D538
      11881ec6
  26. 13 Jan, 2015 1 commit
    • GregWeber's avatar
      add -th-file which generates a th.hs file · 07ace5c2
      GregWeber authored
      Summary:
      see Trac #8624
      
      similar functionality is now available
      with -ddump-to-file -ddump-splices
      
      However, users are already accustomed to -ddump-splices
      having a particular format, and this format is not completely valid code
      The goal of -th-file is to dump valid Haskell code
      
      Additionally, the convention of -ddump-to-file is to name the file after
      the flag, so the file is .dump-splices
      Given that the goal of the new flag is to generate valid Haskell,
      The extension should be .hs
      
      Additionally, -ddump-to-file effects all other dump flags
      
      Test Plan:
      look at the output of using the -th-file flag
      and compare it to the output of using -ddump-to-file and -ddump-splices
      I want to add test cases, but just need some pointers on getting started there
      
      Reviewers: thomie, goldfire, simonpj, austin
      
      Reviewed By: simonpj, austin
      
      Subscribers: thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D518
      
      GHC Trac Issues: #8624
      07ace5c2
  27. 08 Jan, 2015 1 commit
    • Simon Peyton Jones's avatar
      Improve HsBang · 9564bb8c
      Simon Peyton Jones authored
      Provoked by questions from Johan
      
       - Improve comments, fix misleading stuff
       - Add commented synonyms for HsSrcBang, HsImplBang, and use them throughout
       - Rename HsUserBang to HsSrcBang
       - Rename dataConStrictMarks to dataConSrcBangs
                dataConRepBangs    to dataConImplBangs
      
      This renaming affects Haddock in a trivial way, hence submodule update
      9564bb8c
  28. 06 Jan, 2015 1 commit
    • Simon Peyton Jones's avatar
      Major patch to add -fwarn-redundant-constraints · 32973bf3
      Simon Peyton Jones authored
      The idea was promted by Trac #9939, but it was Christmas, so I did
      some recreational programming that went much further.
      
      The idea is to warn when a constraint in a user-supplied context is
      redundant.  Everything is described in detail in
        Note [Tracking redundant constraints]
      in TcSimplify.
      
      Main changes:
      
       * The new ic_status field in an implication, of type ImplicStatus.
         It replaces ic_insol, and includes information about redundant
         constraints.
      
       * New function TcSimplify.setImplicationStatus sets the ic_status.
      
       * TcSigInfo has sig_report_redundant field to say whenther a
         redundant constraint should be reported; and similarly
         the FunSigCtxt constructor of UserTypeCtxt
      
       * EvBinds has a field eb_is_given, to record whether it is a given
         or wanted binding. Some consequential chagnes to creating an evidence
         binding (so that we record whether it is given or wanted).
      
       * AbsBinds field abs_ev_binds is now a *list* of TcEvBiinds;
         see Note [Typechecking plan for instance declarations] in
         TcInstDcls
      
       * Some significant changes to the type checking of instance
         declarations; Note [Typechecking plan for instance declarations]
         in TcInstDcls.
      
       * I found that TcErrors.relevantBindings was failing to zonk the
         origin of the constraint it was looking at, and hence failing to
         find some relevant bindings.  Easy to fix, and orthogonal to
         everything else, but hard to disentangle.
      
      Some minor refactorig:
      
       * TcMType.newSimpleWanteds moves to Inst, renamed as newWanteds
      
       * TcClassDcl and TcInstDcls now have their own code for typechecking
         a method body, rather than sharing a single function. The shared
         function (ws TcClassDcl.tcInstanceMethodBody) didn't have much code
         and the differences were growing confusing.
      
       * Add new function TcRnMonad.pushLevelAndCaptureConstraints, and
         use it
      
       * Add new function Bag.catBagMaybes, and use it in TcSimplify
      32973bf3