1. 15 Aug, 2017 2 commits
    • Ryan Scott's avatar
      Fix #14060 by more conservatively annotating TH-reified types · ad7b9452
      Ryan Scott authored
      Before, TH was quite generous in applying kind annotations to reified
      type constructors whose result kind happened to mention type variables.
      This could result in agonizingly large reified types, so this patch aims
      to quell this a bit by adopting a more nuanced algorithm for determining
      when a tycon application deserves a kind annotation.
      
      This implements the algorithm laid out in
      https://ghc.haskell.org/trac/ghc/ticket/14060#comment:1. I've updated
      `Note [Kind annotations on TyConApps]` to reflect the new wisdom.
      Essentially, instead of only checking if the result kind contains free
      variables, we also check if any of those variables do not appear free in
      injective positions in the argument kinds—only then do we put on a kind
      annotation.
      
      Bumps `haddock` submodule.
      
      Test Plan: make test TEST=T14060
      
      Reviewers: goldfire, austin, bgamari
      
      Reviewed By: goldfire
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #14060
      
      Differential Revision: https://phabricator.haskell.org/D3807
      ad7b9452
    • Ben Gamari's avatar
      7c37ffe8
  2. 12 Aug, 2017 6 commits
    • Ryan Scott's avatar
      Add test for #14101 · c6462ab0
      Ryan Scott authored
      I forgot to do this in
      0bb1e840.
      c6462ab0
    • Ryan Scott's avatar
      Expand type synonyms during role inference · 0bb1e840
      Ryan Scott authored
      Summary:
      During role inference, we need to expand type synonyms, since
      oversaturated applications of type synonym tycons would otherwise have overly
      conservative roles inferred for its arguments.
      
      Fixes #14101.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, austin, bgamari
      
      Reviewed By: goldfire
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #14101
      
      Differential Revision: https://phabricator.haskell.org/D3838
      0bb1e840
    • Ryan Scott's avatar
      Change isClosedAlgType to be TYPE-aware, and rename it to pmIsClosedType · 4f1f9868
      Ryan Scott authored
      Summary:
      In a267580e, I somewhat awkwardly
      inserted a special case for `TYPE` in the `EmptyCase` coverage checker.
      Instead of placing it there, @mpickering noted that `isClosedAlgType` would
      be a better fit for it. I do just that in this patch.
      
      I also renamed `isClosedAlgType` to `pmIsClosedType`, reflecting the fact that
      `TYPE` technically isn't an algebraic type (it's a primitive one), and that its
      behavior is pattern-match coverage checking-oriented. I also moved it to
      `Check`, which is a better home for this function than `Type`. Luckily,
      the only call sites for `isClosedAlgType` were in the pattern-match coverage
      checker anyways, so this change is simple enough.
      
      Test Plan: ./validate
      
      Reviewers: mpickering, austin, goldfire, bgamari
      
      Reviewed By: goldfire
      
      Subscribers: rwbarton, thomie, mpickering
      
      GHC Trac Issues: #14086
      
      Differential Revision: https://phabricator.haskell.org/D3830
      4f1f9868
    • Ryan Scott's avatar
      Use NonEmpty lists to represent lists of duplicate elements · 7d699782
      Ryan Scott authored
      Summary:
      Three functions in `ListSetOps` which compute duplicate elements
      represent lists of duplicates of `[a]`. This is a really bad way to go about
      things, because these lists are guaranteed to always have at least one element
      (the "representative" of the duplicates), and several places in the GHC API
      call `head` (a partial function) on these lists of duplicates to retrieve the
      representative.
      
      This changes the representation of duplicates to `NonEmpty` lists instead,
      which allow for many partial uses of `head` to be made total.
      
      Fixes #13823.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, austin, goldfire
      
      Reviewed By: bgamari
      
      Subscribers: goldfire, rwbarton, thomie
      
      GHC Trac Issues: #13823
      
      Differential Revision: https://phabricator.haskell.org/D3823
      7d699782
    • Ryan Scott's avatar
      Don't suppress unimplemented type family warnings with DeriveAnyClass · 3f05e5f6
      Ryan Scott authored
      Summary:
      For some asinine reason, we were suppressing warnings when
      deriving associated type family instances with `DeriveAnyClass`. That seems
      like a bad idea. Let's not do that.
      
      Along the way, I noticed that the error contexts associated with these
      newly emitted warnings were less than ideal, so I did some minor refactoring
      to improve the story there.
      
      Fixes #14094
      
      Test Plan: ./validate
      
      Reviewers: bgamari, austin
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #14094
      
      Differential Revision: https://phabricator.haskell.org/D3828
      3f05e5f6
    • Ryan Scott's avatar
      Split out inferConstraintsDataConArgs from inferConstraints · a4f347c2
      Ryan Scott authored
      Summary:
      Addresses point (1) of https://phabricator.haskell.org/D3337#107865.
      
      Before, `inferConstraints` awkwardly combined all of the logic needed to handle
      stock, newtype, and anyclass deriving. Really, though, the stock/newtype logic
      is quite different from the anyclass logic, so this splits off
      `inferConstraintsDataConArgs` (so named because it infers constraints by
      inspecting the types of the arguments to data constructors) from
      `inferConstraints` to handle the stock/newtype-specific bits.
      
      Aside from making the code somewhat clearer, this allows us to factor out
      superclass constraint inference, which is done regardless of deriving strategy.
      
      Test Plan: If it builds, ship it
      
      Reviewers: bgamari, austin
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3827
      a4f347c2
  3. 07 Aug, 2017 1 commit
  4. 06 Aug, 2017 3 commits
  5. 05 Aug, 2017 3 commits
    • Ryan Scott's avatar
      Don't warn when empty casing on Type · a267580e
      Ryan Scott authored
      Summary:
      `Type` (a.k.a. `TYPE LiftedRep`) can be used at the type level thanks
      to `TypeInType`. However, expressions like
      
      ```lang=haskell
      f :: Type -> Int
      f x = case x of {}
      ```
      
      were falsely claiming that the empty case on the value of type `Type` was
      non-exhaustive. The reason is a bit silly: `TYPE` is technically not an empty
      datatype in GHC's eyes, since it's a builtin, primitive type. To convince the
      pattern coverage checker otherwise, this adds a special case for `TYPE`.
      
      Test Plan: make test TEST=T14086
      
      Reviewers: gkaracha, austin, bgamari, goldfire
      
      Reviewed By: goldfire
      
      Subscribers: goldfire, rwbarton, thomie
      
      GHC Trac Issues: #14086
      
      Differential Revision: https://phabricator.haskell.org/D3819
      a267580e
    • Ryan Scott's avatar
      Remove the deprecated Typeable{1..7} type synonyms · a81b5b00
      Ryan Scott authored
      Summary:
      `Typeable{1..7}` (type synonyms for the poly-kinded `Typeable`) have
      been deprecated since GHC 7.8. They're now causing problems for users who try
      to still work with them in legacy code, since they can no longer be used in
      instances. To avoid this sort of confusion, let's just remove `Typeable{1..7}`
      altogether. Resolves #14047.
      
      Reviewers: bgamari, austin, hvr
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #14047
      
      Differential Revision: https://phabricator.haskell.org/D3817
      a81b5b00
    • Oleg Grenrus's avatar
      Add MonadIO Q - by requiring MonadIO => Quasi · 394c391a
      Oleg Grenrus authored
      Summary: This is follow-up to https://ghc.haskell.org/trac/ghc/ticket/10773
      
      Reviewers: austin, goldfire, bgamari, RyanGlScott
      
      Reviewed By: RyanGlScott
      
      Subscribers: RyanGlScott, rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3816
      394c391a
  6. 02 Aug, 2017 3 commits
  7. 01 Aug, 2017 9 commits
  8. 31 Jul, 2017 9 commits
    • Gabor Greif's avatar
      A bunch of typofixes · 2ef973e8
      Gabor Greif authored
      2ef973e8
    • Simon Peyton Jones's avatar
      Use field names for all uses of datacon Match · 4fdc5234
      Simon Peyton Jones authored
      This is refactoring only... elimiante all positional uses
      of the data constructor Match in favour of field names.
      
      No change in behaviour.
      4fdc5234
    • Simon Peyton Jones's avatar
      Remove redundant goop · 7f2dee8e
      Simon Peyton Jones authored
      See comment:22 in Trac #13594
      7f2dee8e
    • Simon Peyton Jones's avatar
      Reject top-level banged bindings · af89d687
      Simon Peyton Jones authored
      Bizarrely, we were not rejecting
        !x = e
      
      Fix:
      
      * In the test in DsBinds.dsTopLHsBinds, use isBangedHsBind, not
        isBangedPatBind.  (Indeed the latter dies altogther.)
      
      * Implement isBangedHsBind in HsUtils;
        be sure to handle AbsBinds
      
      All this was shown up by Trac #13594
      af89d687
    • Simon Peyton Jones's avatar
      Do a bit more CSE · 3ab342eb
      Simon Peyton Jones authored
      I discovered that in
      
         let x = MkT y in ....(MKT y |> co)....
      
      we weren't CSE'ing the (MkT y).  The fix is easy.
      3ab342eb
    • Simon Peyton Jones's avatar
      Improve the desugaring of -XStrict · 46368868
      Simon Peyton Jones authored
      Trac #14035 showed that -XStrict was generating some TERRIBLE
      desugarings, espcially for bindings with INLINE pragmas. Reason: with
      -XStrict, all AbsBinds (even for non-recursive functions) went via the
      general-case deguaring for AbsBinds, namely "generate a tuple and
      select from it", even though in this case there was only one variable
      in the tuple.  And that in turn interacts terribly badly with INLINE
      pragmas.
      
      This patch cleans things up:
      
      * I killed off AbsBindsSig completely, in favour of a boolean flag
        abs_sig in AbsBinds.  See Note [The abs_sig field of AbsBinds]
      
        This allowed me to delete lots of code; and instance-method
        declarations can enjoy the benefits too.  (They could have
        before, but no one had changed them to use AbsBindsSig.)
      
      * I refactored all the AbsBinds handling in DsBinds into a new
        function DsBinds.dsAbsBinds.  This allowed me to handle the
        strict case uniformly
      46368868
    • Simon Peyton Jones's avatar
      Refactoring around FunRhs · 2535a671
      Simon Peyton Jones authored
      * Clarify the comments around the mc_strictness field of FunRhs
      * Use record field names consistently for FunRhs
      2535a671
    • Richard Eisenberg's avatar
      Clarify comment about data family arities · c6d4219a
      Richard Eisenberg authored
      as requested in #14045.
      
      [skip ci] comments only
      c6d4219a
    • habibalamin's avatar
      Allow Windows to set blank environment variables · 49e334c8
      habibalamin authored
      Test Plan: ./validate on harbormaster
      
      Reviewers: austin, hvr, bgamari, erikd, Phyx
      
      Reviewed By: Phyx
      
      Subscribers: Phyx, rwbarton, thomie
      
      GHC Trac Issues: #12494
      
      Differential Revision: https://phabricator.haskell.org/D3726
      49e334c8
  9. 30 Jul, 2017 2 commits
  10. 29 Jul, 2017 2 commits