1. 23 Mar, 2018 2 commits
    • Ryan Scott's avatar
      Allow PartialTypeSignatures in standalone deriving contexts · affdea82
      Ryan Scott authored
      Summary:
      At its core, this patch is a simple tweak that allows a user
      to write:
      
      ```lang=haskell
      deriving instance _ => Eq (Foo a)
      ```
      
      Which is functionally equivalent to:
      
      ```lang=haskell
      data Foo a = ...
        deriving Eq
      ```
      
      But with the added flexibility that `StandaloneDeriving` gives you
      (namely, the ability to use it anywhere, not just in the same module
      that `Foo` was declared in). This fixes #13324, and should hopefully
      address a use case brought up in #10607.
      
      Currently, only the use of a single, extra-constraints wildcard is
      permitted in a standalone deriving declaration. Any other wildcard
      is rejected, so things like
      `deriving instance (Eq a, _) => Eq (Foo a)` are currently forbidden.
      
      There are quite a few knock-on changes brought on by this change:
      
      * The `HsSyn` type used to represent standalone-derived instances
        was previously `LHsSigType`, which isn't sufficient to hold
        wildcard types. This needed to be changed to `LHsSigWcType` as a
        result.
      
      * Previously, `DerivContext` was a simple type synonym for
        `Maybe ThetaType`, under the assumption that you'd only ever be in
        the `Nothing` case if you were in a `deriving` clause. After this
        patch, that assumption no longer holds true, as you can also be
        in this situation with standalone deriving when an
        extra-constraints wildcard is used.
      
        As a result, I changed `DerivContext` to be a proper datatype that
        reflects the new wrinkle that this patch adds, and plumbed this
        through the relevant parts of `TcDeriv` and friends.
      
      * Relatedly, the error-reporting machinery in `TcErrors` also assumed
        that if you have any unsolved constraints in a derived instance,
        then you should be able to fix it by switching over to standalone
        deriving. This was always sound advice before, but with this new
        feature, it's possible to have unsolved constraints even when
        you're standalone-deriving something!
      
        To rectify this, I tweaked some constructors of `CtOrigin` a bit
        to reflect this new subtlety.
      
      This requires updating the Haddock submodule. See my fork at
      https://github.com/RyanGlScott/haddock/commit/067d52fd4be15a1842cbb05f42d9d482de0ad3a7
      
      Test Plan: ./validate
      
      Reviewers: simonpj, goldfire, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: goldfire, rwbarton, thomie, mpickering, carter
      
      GHC Trac Issues: #13324
      
      Differential Revision: https://phabricator.haskell.org/D4383
      affdea82
    • Ryan Scott's avatar
      Special-case record fields ending with hash when deriving Read · d5577f44
      Ryan Scott authored
      Summary:
      In commit dbd81f7e, a
      regression was inadvertently introduced which caused derived `Read`
      instances for record data types with fields ending in a `#` symbol
      (using `MagicHash`) would no longer parse on valid output. This
      is ultimately due to the same reasons as #5041, as we cannot parse
      a field name like `foo#` as a single identifier. We fix this issue
      by employing the same workaround as in #5041: first parse the
      identifier name `foo`, then then symbol `#`.
      
      This is accomplished by the new `readFieldHash` function in
      `GHC.Read`. This will likely warrant a `base-4.11.1.0` release.
      
      Test Plan: make test TEST=T14918
      
      Reviewers: tdammers, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14918
      
      Differential Revision: https://phabricator.haskell.org/D4502
      d5577f44
  2. 22 Mar, 2018 2 commits
    • Simon Peyton Jones's avatar
      Improve shortOutIndirections slightly · 034c32f6
      Simon Peyton Jones authored
      I found (when investigating Trac #14955) a binding looking like
      
         Rec { exported_id = ....big...lcl_id...
             ; lcl_id = exported_id }
      
      but bizarrely 'lcl_id' was chosen as the loop breaker, and never
      inlined.  It turned out to be an unintended consequence of the
      shortOutIndirections code in SimplCore.  Easily fixed.
      034c32f6
    • Simon Peyton Jones's avatar
      Fix over-eager constant folding in bitInteger · efc844f5
      Simon Peyton Jones authored
      The RULE for bitInteger was trying to constant-fold
      
          bitInteger 9223372036854775807#
      
      which meant constructing a gigantic Integer at compile
      time.  Very bad idea!  Easily fixed.
      
      Fixes Trac #14959, #14962.
      efc844f5
  3. 21 Mar, 2018 3 commits
    • Simon Peyton Jones's avatar
      Fix two obscure bugs in rule matching · 3446cee0
      Simon Peyton Jones authored
      This patch fixes Trac #14777, a compiler crash.
      
      There were actually two bugs.
      
      1. In Rules.matchN, I was (consciously) not rename the template binders
         of the rule. Sadly, in rare cases an accidental coincidence of
         uniques could mean that a term variable was mapped to a type
         variable, utterly bogusly.  See "Historical note" in
         Note [Cloning the template binders] in Rules.
      
         This was hard to find, but easy to fix.
      
      2. The fix to (1) showed up a bug in Unify.hs.  The test in
         Unify.tvBindFlag was previously using the domain of the RnEnv2
         to detect locally-bound variables (e.g. when unifying under
         a forall).  That's fine when teh RnEnv2 starts empty, as it
         does in most entry points.  But the tcMatchTyKisX entry point,
         used from the rule matcher, passes in a non-empty RnEnv2 (by
         design).  Now the domain of the RnEnv doesn't idenfity those
         locally-bound variables any more :-(.
      
         Solution: extend UmEnv with a new field um_skols, to capture
         the skolems directly.  Simple, easy, works.
      3446cee0
    • Simon Peyton Jones's avatar
      Allow as-patterns in unidirectional patttern synonyms · 411a97e2
      Simon Peyton Jones authored
      This patch implements GHC Proposal #94, described here
         https://github.com/ghc-proposals/ghc-proposals/pull/94
      
      The effect is simply to lift a totally-undocumented restriction to
      unidirecional pattern synonyms, namely that they can't have as-patterns
      or n+k patterns.
      
      The fix is easy: just remove the checks.
      
      I also took the opportunity to improve the manual entry for
      the semantics of pattern matching for pattern synonyms.
      411a97e2
    • Ryan Scott's avatar
      Fix #14869 by being more mindful of Type vs. Constraint · 49ac3f0f
      Ryan Scott authored
      Summary:
      Before, we were using `isLiftedTypeKind` in `reifyType`
      before checking if a type was `Constraint`. But as it turns out,
      `isLiftedTypeKind` treats `Constraint` the same as `Type`, so every
      occurrence of `Constraint` would be reified as `Type`! To make things
      worse, the documentation for `isLiftedTypeKind` stated that it
      treats `Constraint` //differently// from `Type`, which simply isn't
      true.
      
      This revises the documentation for `isLiftedTypeKind` to reflect
      reality, and defers the `isLiftedTypeKind` check in `reifyType` so
      that it does not accidentally swallow `Constraint`.
      
      Test Plan: make test TEST=T14869
      
      Reviewers: goldfire, bgamari
      
      Reviewed By: goldfire
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14869
      
      Differential Revision: https://phabricator.haskell.org/D4474
      49ac3f0f
  4. 20 Mar, 2018 1 commit
  5. 19 Mar, 2018 17 commits
    • Matthew Pickering's avatar
      Add -flate-specialise which runs a later specialisation pass · afad5561
      Matthew Pickering authored
      Runs another specialisation pass towards the end of the optimisation
      pipeline. This can catch specialisation opportunities which arose from
      the previous specialisation pass or other inlining.
      
      You might want to use this if you are you have a type class method
      which returns a constrained type. For example, a type class where one
      of the methods implements a traversal.
      
      It is not enabled by default or any optimisation level. Only by
      manually enabling the flag `-flate-specialise`.
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4457
      afad5561
    • Ryan Scott's avatar
      Don't permit data types with return kind Constraint · f748c529
      Ryan Scott authored
      Previously, GHC allowed all of the following:
      
      ```lang=haskell
      data Foo1 :: Constraint
      data family Foo2 :: Constraint
      data family Foo3 :: k
      data instance Foo3 :: Constraint
      ```
      
      Yikes! This is because GHC was confusing `Type` with `Constraint`
      due to careless use of the `isLiftedTypeKind` function. To respect
      this distinction, I swapped `isLiftedTypeKind` out for
      `tcIsStarKind`—which does respect this distinction—in the right
      places.
      
      Test Plan: make test TEST="T14048a T14048b T14048c"
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: goldfire, rwbarton, thomie, carter
      
      GHC Trac Issues: #14048
      
      Differential Revision: https://phabricator.haskell.org/D4479
      f748c529
    • Ryan Scott's avatar
      Fix #14934 by including axSub0R in typeNatCoAxiomRules · c3aea396
      Ryan Scott authored
      For some reason, `axSub0R` was left out of `typeNatCoAxiomRules` in
      `TcTypeNats`, which led to disaster when trying to look up `Sub0R` from
      an interface file, as demonstrated in #14934.
      
      The fix is simple—just add `axSub0R` to that list. To help prevent
      an issue like this happening in the future, I added a
      `Note [Adding built-in type families]` to `TcTypeNats`, which
      contains a walkthrough of all the definitions in `TcTypeNats` you
      need to update when adding a new built-in type family.
      
      Test Plan: make test TEST=T14934
      
      Reviewers: bgamari, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, rwbarton, thomie, carter
      
      GHC Trac Issues: #14934
      
      Differential Revision: https://phabricator.haskell.org/D4508
      c3aea396
    • Chaitanya Koparkar's avatar
      Turn a TH Name for built-in syntax into an unqualified RdrName · 9868f91f
      Chaitanya Koparkar authored
      Previously, the Renamer would turn any fully qualified Template Haskell
      name into a corresponding fully qualified `RdrName`. But this is not
      what we want for built-in syntax, as it produces unnecessarily qualified
      names (eg. GHC.Types.[], GHC.Tuple.(,) etc.).
      
      Test Plan: ./validate
      
      Reviewers: RyanGlScott, bgamari, goldfire
      
      Reviewed By: RyanGlScott, bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #13776
      
      Differential Revision: https://phabricator.haskell.org/D4506
      9868f91f
    • David Feuer's avatar
      Implement equalKeysUFM the right way · fbd9b886
      David Feuer authored
      Originally, we compared the key lists, which was kind of silly.
      Then I changed it to something fancier ... and also silly.
      This is much more reasonable, should be faster, and is nice and
      clear.
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4500
      fbd9b886
    • Michal Terepeta's avatar
      CmmUtils: get rid of insertBlock · 256577fb
      Michal Terepeta authored
      `Hoopl.Graph` has almost exactly the same function, so let's use that.
      Also, use `IntMap.alter` to make it more efficient.
      
      Also switch `Hoopl` to use strict maps.
      Signed-off-by: Michal Terepeta's avatarMichal Terepeta <michal.terepeta@gmail.com>
      
      Test Plan: ./validate
      
      Reviewers: bgamari, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: dfeuer, rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4493
      256577fb
    • Ben Gamari's avatar
      Improve accuracy of get/setAllocationCounter · 20cbb016
      Ben Gamari authored
      Summary:
      get/setAllocationCounter didn't take into account allocations in the
      current block. This was known at the time, but it turns out to be
      important to have more accuracy when using these in a fine-grained
      way.
      
      Test Plan:
      New unit test to test incrementally larger allocaitons.  Before I got
      results like this:
      
      ```
      +0
      +0
      +0
      +0
      +0
      +4096
      +0
      +0
      +0
      +0
      +0
      +4064
      +0
      +0
      +4088
      +4056
      +0
      +0
      +0
      +4088
      +4096
      +4056
      +4096
      ```
      
      Notice how the results aren't always monotonically increasing.  After
      this patch:
      
      ```
      +344
      +416
      +488
      +560
      +632
      +704
      +776
      +848
      +920
      +992
      +1064
      +1136
      +1208
      +1280
      +1352
      +1424
      +1496
      +1568
      +1640
      +1712
      +1784
      +1856
      +1928
      +2000
      +2072
      +2144
      ```
      
      Reviewers: hvr, erikd, simonmar, jrtc27, trommler
      
      Reviewed By: simonmar
      
      Subscribers: trommler, jrtc27, rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4363
      20cbb016
    • Ben Gamari's avatar
      [RFC] nativeGen: Add support for MO_SS_Conv_W32_W64 on i386 · d27336ed
      Ben Gamari authored
      This is required by D4288. However, this only handles i386; we will
      likely also need to do the same for PPC and SPARC, lest they break when
      D4288 is re-merged.
      
      Test Plan: Validate
      
      Reviewers: simonmar
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4362
      d27336ed
    • Peter Trommler's avatar
      SPARC nativeGen: Support for MO_SS_Conv_W32_W64 · 5241f298
      Peter Trommler authored
      Support for signed conversion from 32 bit to 64 bit
      integers is required by D4363.
      
      Test Plan: validate (perhaps also on SPARC)
      
      Reviewers: simonmar, bgamari, kgardas, jrtc27
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4489
      5241f298
    • Peter Trommler's avatar
      PPC nativeGen: Add support for MO_SS_Conv_W32_W64 · b37a87b7
      Peter Trommler authored
      This is required by D4363. D4362 has the implementation for i386
      this commit adds PowerPC.
      
      Test Plan: validate
      
      Reviewers: erikd, hvr, simonmar, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4468
      b37a87b7
    • Andrew Martin's avatar
      Implement -dword-hex-literals · a00b88b9
      Andrew Martin authored
      Provide flag for showing showing Word# and Word64# as hexadecimal when
      dumping GHC core.  The only affects Word, not Int, and it prefixes the
      hexadecimal with enough zeroes to make the total character count a power
      of two. For example:
      
      - 0x0C0C instead of 0xC0C
      - 0x00BA00BA instead of 0xBA00BA
      
      This also affects the presentation of Word# and Word64# in GHC's error
      messages. It is not expected that the flag will be used for this, but
      it is a side-effect worth noting.
      
      Test Plan: none
      
      Reviewers: bgamari, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, mpickering, rwbarton, thomie, carter, andrewthad
      
      GHC Trac Issues: #14872
      
      Differential Revision: https://phabricator.haskell.org/D4465
      a00b88b9
    • Michal Terepeta's avatar
      Hoopl: improve postorder calculation · bbcea13a
      Michal Terepeta authored
      - Fix the naming and comments to indicate that we are calculating
        *reverse* postorder (and not the standard postorder).
      
      - Rewrite the calculation to avoid CPS code. I found it fairly
        difficult to understand and the new one seems faster (according to
        nofib, decreases compiler allocations by 0.2%)
      
      - Remove `LabelsPtr`, which seems unnecessary and could be *really*
        confusing. For instance, previously:
        `postorder_dfs_from <block with label X>`
        and
        `postorder_dfs_from <label X>`
        would actually mean quite different things (and give different
        results).
      
      - Change the `Dataflow` module to always use entry of the graph for
        reverse postorder calculation. This should be the only change in
        behavior of this commit.
      
        Previously, if the caller provided initial facts for some of the
        labels, we would use those labels for our postorder calculation.
        However, I don't think that's correct in general - if the initial
        facts did not contain the entry of the graph, we would never analyze
        the blocks reachable from the entry but unreachable from the labels
        provided with the initial facts. It seems that the only analysis that
        used this was proc-point analysis, which I think would always include
        the entry block (so I don't think there's any bug due to this).
      Signed-off-by: Michal Terepeta's avatarMichal Terepeta <michal.terepeta@gmail.com>
      
      Test Plan: ./validate
      
      Reviewers: bgamari, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4464
      bbcea13a
    • Michal Terepeta's avatar
      Get rid of more CPP in cmm/ and codeGen/ · 0db0e46c
      Michal Terepeta authored
      This removes a bunch of unnecessary includes of `HsVersions.h` along
      with unnecessary CPP (e.g., due to checking for DEBUG which can be
      achieved by looking at `debugIsOn`)
      Signed-off-by: Michal Terepeta's avatarMichal Terepeta <michal.terepeta@gmail.com>
      
      Test Plan: ./validate
      
      Reviewers: bgamari, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4462
      0db0e46c
    • Tao He's avatar
      Improve the warning message of qualified unused imports. · fad822e2
      Tao He authored
      Pretty-print unused imported names unqualified unconditionally to
      make the warning message consistent for ambiguous/unambiguous
      identifiers.
      Signed-off-by: Tao He's avatarHE, Tao <sighingnow@gmail.com>
      
      Test Plan: make test TEST="T14881"
      
      Reviewers: bgamari, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, rwbarton, thomie, carter
      
      GHC Trac Issues: #14881
      
      Differential Revision: https://phabricator.haskell.org/D4461
      fad822e2
    • Simon Marlow's avatar
      Be more selective in which conditionals we invert · 39c74063
      Simon Marlow authored
      Test Plan: validate
      
      Reviewers: bgamari, AndreasK, erikd
      
      Reviewed By: AndreasK
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4398
      39c74063
    • Matthew Pickering's avatar
      Also check local rules with -frules-check · 3d378d98
      Matthew Pickering authored
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4255
      3d378d98
    • Simon Peyton Jones's avatar
      Comments and tiny refactor · 2a3702d8
      Simon Peyton Jones authored
      Related to Ryan's upcoming patch for Trac #14933
      2a3702d8
  6. 17 Mar, 2018 1 commit
    • Sergei Trofimovich's avatar
      aclocal.m4: add OSHurd (debian patch) · 0693b0b0
      Sergei Trofimovich authored
      ghc treats OSUnknown (and GNU/Hurd) as non-ELF target.
      This causes panic in native codegenerator when trying
      to build PIC code:
      
      ```
        ...
        -- all other platforms
        howToAccessLabel dflags _ _ _ _ _
              | not (positionIndependent dflags)
              = AccessDirectly
              | otherwise
              = panic "howToAccessLabel: PIC not defined for this platform"
      ```
      
      This change declares new 'OSHurd' and marks it as an
      ELF target. Fixes building ghc-stage2 on i686-unknown-gnu0.9.
      
      Patch provided by "Pino" via Samuel Thibault and taken from
      debian.
      Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>
      0693b0b0
  7. 14 Mar, 2018 1 commit
    • Ömer Sinan Ağacan's avatar
      Slighly improve infix con app pattern errors · cb6d8589
      Ömer Sinan Ağacan authored
      Given this program:
      
          main = do
            f $ do
              a <- return 3
                c <- do
                return 5
      
      GHC previously gave this error message:
      
          Main.hs:2:7: error:
              Parse error in pattern: do a <- return 3 c
              Possibly caused by a missing 'do'?
            |
          2 |   f $ do
            |       ^^...
      
      What happened is GHC considered the whole `f $ do a <- return 3 c` as a
      pattern. When parsed as an expression it becomes an infix application of
      `($)`, and GHC checks left and right hand sides before checking if `($)`
      is a valid infix constructor name, and shows the first error it got.
      
      If instead we first check if the infix op is valid in pattern context,
      the error message becomes much clearer:
      
          Main.hs:2:3: error:
              Parse error in pattern: f $ do a <- return 3 c
              Possibly caused by a missing 'do'?
            |
          2 |   f $ do
            |   ^^^^^^...
      
      This may not entirely fix #11188 but I think it's an improvement.
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #11188
      
      Differential Revision: https://phabricator.haskell.org/D4497
      cb6d8589
  8. 13 Mar, 2018 1 commit
    • Ryan Scott's avatar
      Drop GHC 8.0 compatibility · 152055a1
      Ryan Scott authored
      GHC 8.4.1 is out, so now GHC's support window only extends
      back to GHC 8.2. This means we can delete gobs of code that were
      only used for GHC 8.0 support. Hooray!
      
      Test Plan: ./validate
      
      Reviewers: bgamari, erikd, dfeuer
      
      Reviewed By: bgamari, dfeuer
      
      Subscribers: alexbiehl, dfeuer, rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4492
      152055a1
  9. 12 Mar, 2018 1 commit
  10. 08 Mar, 2018 3 commits
    • Ömer Sinan Ağacan's avatar
      Error message and doc improvements for #14335 · bc95fedc
      Ömer Sinan Ağacan authored
      - Show a more friendly error message when -fplugin is used with
        -fexternal-interpreter
      
      - Add a few words to users guide about the interaction with -fplugin and
        -fexternal-interpreter
      
      - Update test for #14335
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14335
      
      Differential Revision: https://phabricator.haskell.org/D4456
      bc95fedc
    • Ömer Sinan Ağacan's avatar
      Revert "GHCi: Don't remove shadowed bindings from typechecker scope." · 98c7749c
      Ömer Sinan Ağacan authored
      This reverts commit 59d7ee53 and enables
      the test for #14052.
      
      (See #14052 for the discussion)
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter
      
      GHC Trac Issues: #14052
      
      Differential Revision: https://phabricator.haskell.org/D4478
      98c7749c
    • Simon Marlow's avatar
      Add -fexternal-dynamic-refs · d99a65a8
      Simon Marlow authored
      Summary:
      The `-dynamic` flag does two things:
      
      * In the code generator, it generates code designed to link against
        external shared libraries.  References outside of the current module
        go through platform-specific indirection tables (e.g. the GOT on ELF).
      
      * It enables a "way", which changes which hi files we look
        for (`Foo.dyn_hi`) and which libraries we link against.
      
      Some specialised applications want the first of these without the
      second. (I could go into detail here but it's probably not all that
      important).
      
      This diff splits out the code-generation effects of `-dynamic` from the
      "way" parts of its behaviour, via a new flag `-fexternal-dynamic-refs`.
      
      Test Plan: validate
      
      Reviewers: niteria, bgamari, erikd
      
      Subscribers: rwbarton, thomie, carter
      
      Differential Revision: https://phabricator.haskell.org/D4477
      d99a65a8
  11. 06 Mar, 2018 3 commits
  12. 05 Mar, 2018 4 commits
    • Simon Peyton Jones's avatar
      Simplify rnLHsInstType · 1c062b79
      Simon Peyton Jones authored
      This patch is preparatory for the main fix for Trac #13324
      
      Here, we simplify rnLHsInstType so that it does not try
      to figure out the class name.  This turns out to have a good
      (rather than bad) effect on error messages, and it prepares
      the way for the main event.
      
      Plus, less code!
      1c062b79
    • Ryan Scott's avatar
      Fix #14888 by adding more special cases for ArrowT · 6ee831f2
      Ryan Scott authored
      Summary:
      There were previously some situations where `(->)` would
      not be desugared or reified as `ArrowT`, leading to various oddities
      such as those observed in #14888. We now uniformly treat `(->)` as
      `ArrowT` in Template Haskell–world by checking for any tycon that
      has the same name as `(->)`, and converting that to `ArrowT`.
      
      Test Plan: make test TEST=T14888
      
      Reviewers: goldfire, bgamari, simonpj
      
      Reviewed By: goldfire, simonpj
      
      Subscribers: simonpj, rwbarton, thomie, carter
      
      GHC Trac Issues: #14888
      
      Differential Revision: https://phabricator.haskell.org/D4466
      6ee831f2
    • Simon Peyton Jones's avatar
      Respect Note [The tcType invariant] · 3d252037
      Simon Peyton Jones authored
      I tried to do this with
      
          commit 0a12d92a
          Author: Simon Peyton Jones <simonpj@microsoft.com>
          Date:   Wed Dec 13 12:53:26 2017 +0000
      
          Further improvements to well-kinded types
      
          The typechecker has the invariant that every type should be well-kinded
          as it stands, without zonking.  See Note [The well-kinded type invariant]
          in TcType.
      
          That invariant was not being upheld, which led to Trac #14174.  I fixed
          part of it, but T14174a showed that there was more.  This patch finishes
          the job.
      
      But I didn't get it quite right as Trac #14873 showed.
      
      This patch fixes the problem; although I am still a bit unhappy.
      (See "A worry" in the HsApp case of tc_infer_hs_type.)
      3d252037
    • Simon Peyton Jones's avatar
      Wombling around in Trac #14808 · e7653bc3
      Simon Peyton Jones authored
      Comment:4 in Trac #14808 explains why I'm unhappy with the current
      state of affairs -- at least the lack of documentation.
      
      This smallpatch does nothing major:
      
      * adds comments
      * uses existing type synonyms more (notably FreeKiTyVarsWithDups)
      * adds another test case to T14808
      e7653bc3
  13. 03 Mar, 2018 1 commit
    • Ryan Scott's avatar
      Parenthesize (() :: Constraint) in argument position · 99c556d2
      Ryan Scott authored
      Summary:
      A simple oversight in the pretty-printer lead to a special
      case for `() :: Constraint` not being parenthesized correctly when
      used in an argument position. Easily fixed with a `maybeParen`.
      
      Test Plan: make test TEST=T14796
      
      Reviewers: alanz, goldfire, bgamari, simonpj
      
      Reviewed By: bgamari, simonpj
      
      Subscribers: simonpj, rwbarton, thomie, carter
      
      GHC Trac Issues: #14796
      
      Differential Revision: https://phabricator.haskell.org/D4408
      99c556d2