1. 08 Nov, 2017 1 commit
    • Simon Peyton Jones's avatar
      Minimise provided dictionaries in pattern synonyms · 2c2f3cea
      Simon Peyton Jones authored
      Trac #14394 showed that it's possible to get redundant
      constraints in the inferred provided constraints of a pattern
      synonym.  This patch removes the redundancy with mkMinimalBySCs.
      
      To do this I had to generalise the type of mkMinimalBySCs slightly.
      And, to reduce confusing reversal, I made it stable: it now returns
      its result in the same order as its input.  That led to a raft of
      error message wibbles, mostly for the better.
      2c2f3cea
  2. 06 Nov, 2017 1 commit
    • Ben Gamari's avatar
      DynFlags: Introduce -show-mods-loaded flag · 8613e61d
      Ben Gamari authored
      This flag reintroduces the verbose module name output produced by GHCi's
      :load command behind a new flag, -show-mods-loaded. This was originally
      removed in D3651 but apparently some tools (e.g. haskell-mode) rely on
      this output.
      
      Addresses #14427.
      
      Test Plan: Validate
      
      Reviewers: svenpanne
      
      Reviewed By: svenpanne
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D4164
      8613e61d
  3. 25 Oct, 2017 1 commit
  4. 19 Oct, 2017 1 commit
    • Ryan Scott's avatar
      Disable -XRebindableSyntax when running internal GHCi expressions · e023e78b
      Ryan Scott authored
      Summary:
      It's well known that `-XRebindableSyntax` doesn't play
      nicely with some of the internal expressions that GHCi runs. #13385
      was one example where this problem arose, which was fixed at the time
      by simply avoiding the use of `do`-notation in these internal GHCi
      expressions. That seemed to work, but it was a technique that proved
      not to scale, as #14342 demonstrated //another// example where
      `-XRebindableSyntax` can bite.
      
      Instead of delicately arranging the internal GHCi expressions to
      avoid anything that might be covered under `-XRebindableSyntax`,
      this patch takes the much more direct approach of disabling
      `-XRebindableSyntax` entirely when running any internal GHCi
      expression. This shouldn't hurt, since nothing internal to GHCi was
      taking advantage of the extension in the first place, and moreover,
      we can have greater confidence that some other obscure
      `-XRebindableSyntax` corner case won't pop up in the future. As an
      added bonus, this lets us once again use `do`-notation in the code
      that had to be changed when #13385 was (hackily) fixed before.
      
      Test Plan: make test TEST=T14342
      
      Reviewers: bgamari, austin
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #14342
      
      Differential Revision: https://phabricator.haskell.org/D4086
      e023e78b
  5. 16 Oct, 2017 1 commit
  6. 03 Oct, 2017 2 commits
    • Iavor S. Diatchki's avatar
      Implement Div, Mod, and Log for type-level nats. · fa8035e3
      Iavor S. Diatchki authored
      Reviewers: austin, hvr, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: RyanGlScott, dfeuer, adamgundry, rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D4002
      fa8035e3
    • Ryan Scott's avatar
      Track the order of user-written tyvars in DataCon · ef26182e
      Ryan Scott authored
      After typechecking a data constructor's type signature, its type
      variables are partitioned into two distinct groups: the universally
      quantified type variables and the existentially quantified type
      variables. Then, when prompted for the type of the data constructor,
      GHC gives this:
      
      ```lang=haskell
      MkT :: forall <univs> <exis>. (...)
      ```
      
      For H98-style datatypes, this is a fine thing to do. But for GADTs,
      this can sometimes produce undesired results with respect to
      `TypeApplications`. For instance, consider this datatype:
      
      ```lang=haskell
      data T a where
        MkT :: forall b a. b -> T a
      ```
      
      Here, the user clearly intended to have `b` be available for visible
      type application before `a`. That is, the user would expect
      `MkT @Int @Char` to be of type `Int -> T Char`, //not//
      `Char -> T Int`. But alas, up until now that was not how GHC
      operated—regardless of the order in which the user actually wrote
      the tyvars, GHC would give `MkT` the type:
      
      ```lang=haskell
      MkT :: forall a b. b -> T a
      ```
      
      Since `a` is universal and `b` is existential. This makes predicting
      what order to use for `TypeApplications` quite annoying, as
      demonstrated in #11721 and #13848.
      
      This patch cures the problem by tracking more carefully the order in
      which a user writes type variables in data constructor type
      signatures, either explicitly (with a `forall`) or implicitly
      (without a `forall`, in which case the order is inferred). This is
      accomplished by adding a new field `dcUserTyVars` to `DataCon`, which
      is a subset of `dcUnivTyVars` and `dcExTyVars` that is permuted to
      the order in which the user wrote them. For more details, refer to
      `Note [DataCon user type variables]` in `DataCon.hs`.
      
      An interesting consequence of this design is that more data
      constructors require wrappers. This is because the workers always
      expect the first arguments to be the universal tyvars followed by the
      existential tyvars, so when the user writes the tyvars in a different
      order, a wrapper type is needed to swizzle the tyvars around to match
      the order that the worker expects. For more details, refer to
      `Note [Data con wrappers and GADT syntax]` in `MkId.hs`.
      
      Test Plan: ./validate
      
      Reviewers: austin, goldfire, bgamari, simonpj
      
      Reviewed By: goldfire, simonpj
      
      Subscribers: ezyang, goldfire, rwbarton, thomie
      
      GHC Trac Issues: #11721, #13848
      
      Differential Revision: https://phabricator.haskell.org/D3687
      ef26182e
  7. 25 Sep, 2017 1 commit
    • Simon Peyton Jones's avatar
      Improve type-error reporting · 1b476ab5
      Simon Peyton Jones authored
      This patch does two things:
      
      * When reporting a hole, we now include its kind if the
        kind is not just '*'.  This addresses Trac #14265
      
      * When reporting things like "'a' is a rigid type varaible
        bound by ...", this patch arranges to group the type variables
        together, so we don't repeat the "bound by..." stuff endlessly
      1b476ab5
  8. 21 Sep, 2017 2 commits
    • Matthías Páll Gissurarson's avatar
      Also show types that subsume a hole as valid substitutions for that hole. · 1c920832
      Matthías Páll Gissurarson authored
      
      
      This builds on the previous "Valid substitutions include..." functionality,
      but add subsumption checking as well, so that the suggested valid substitutions
      show not only exact matches, but also identifiers that fit the hole by virtue of
      subsuming the type of the hole (i.e. being more general than the type of the
      hole).
      
      Building on the previous example, in the given program
      
      ```
      ps :: String -> IO ()
      ps = putStrLn
      
      ps2 :: a -> IO ()
      ps2 _ = putStrLn "hello, world"
      
      main :: IO ()
      main = _ "hello, world"
      ```
      
      The results would be something like
      
      ```
          • Found hole: _ :: [Char] -> IO ()
          • In the expression: _
            In the expression: _ "hello, world"
            In an equation for ‘main’: main = _ "hello, world"
          • Relevant bindings include main :: IO () (bound at t1.hs:8:1)
            Valid substitutions include
              ps :: String -> IO () (defined at t1.hs:2:1)
              ps2 :: forall a. a -> IO () (defined at t1.hs:5:1)
              putStrLn :: String -> IO ()
                (imported from ‘Prelude’ at t1.hs:1:1
                 (and originally defined in ‘System.IO’))
              fail :: forall (m :: * -> *). Monad m => forall a. String -> m a
                (imported from ‘Prelude’ at t1.hs:1:1
                 (and originally defined in ‘GHC.Base’))
              mempty :: forall a. Monoid a => a
                (imported from ‘Prelude’ at t1.hs:1:1
                 (and originally defined in ‘GHC.Base’))
              print :: forall a. Show a => a -> IO ()
                (imported from ‘Prelude’ at t1.hs:1:1
                 (and originally defined in ‘System.IO’))
              (Some substitutions suppressed;
               use -fmax-valid-substitutions=N or -fno-max-valid-substitutions)
      ```
      Signed-off-by: Matthías Páll Gissurarson's avatarMatthías Páll Gissurarson <mpg@mpg.is>
      
      Modified according to suggestions from Simon PJ
      
      Accept tests that match the expectations, still a few to look better at
      
      Swithced to using tcLookup, after sit down with SPJ at ICFP. Implications are WIP.
      
      Now works with polymorphism and constraints!
      
      We still need to merge the latest master, before we can make a patch.
      
      Wrap the type of the hole, instead of implication shenanigans,
      
      As per SPJs suggestion, this is simpler and feels closer to
      what we actually want to do.
      
      Updated tests with the new implementation
      
      Remove debugging trace and update documentation
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: RyanGlScott, rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3930
      1c920832
    • Ben Gamari's avatar
      Bump base to 4.11.0.0 · 063e0b4e
      Ben Gamari authored
      Bumps numerous submodules.
      
      Reviewers: austin, hvr
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3974
      063e0b4e
  9. 19 Sep, 2017 1 commit
  10. 14 Sep, 2017 2 commits
    • Richard Eisenberg's avatar
      Fix #13963. · 8f99cd67
      Richard Eisenberg authored
      This commit fixes several things:
      
      1. RuntimeRep arg suppression was overeager for *visibly*-quantified
      RuntimeReps, which should remain.
      
      2. The choice of whether to used a Named TyConBinder or an anonymous
      was sometimes wrong. Now, we do an extra little pass right before
      constructing the tycon to fix these.
      
      3. TyCons that normally cannot appear unsaturated can appear unsaturated
      in :kind. But this fact was not propagated into the type checker.
      It now is.
      8f99cd67
    • Richard Eisenberg's avatar
      Fix #13407 by suppressing invisibles better. · 04bb8736
      Richard Eisenberg authored
      Previously, the iface-invisible-suppresser assumed that all
      invisible things are up front. Not true!
      
      test case: ghci/scripts/T13407
      04bb8736
  11. 07 Sep, 2017 1 commit
    • Herbert Valerio Riedel's avatar
      Make Semigroup a superclass of Monoid (re #14191) · 8ae263ce
      Herbert Valerio Riedel authored
      Unfortunately, this requires introducing a couple of .hs-boot files to
      break up import cycles (mostly to provide class & typenames in order to
      be able to write type signatures).
      
      This does not yet re-export `(<>)` from Prelude (while the class-name
      `Semigroup` is reexported); that will happen in a future commit.
      
      Test Plan: local ./validate passed
      
      Reviewers: ekmett, austin, bgamari, erikd, RyanGlScott
      
      Reviewed By: ekmett, RyanGlScott
      
      GHC Trac Issues: #14191
      
      Differential Revision: https://phabricator.haskell.org/D3927
      8ae263ce
  12. 05 Sep, 2017 1 commit
    • Ryan Scott's avatar
      Fix egregious duplication of vars in RnTypes · b9ac9e05
      Ryan Scott authored
      `RnTypes` contains a fairly intricate algorithm to extract
      the kind and type variables of an HsType. This algorithm carefully
      maintains the separation between type variables and kind variables
      so that the difference between `-XPolyKinds` and `-XTypeInType` can
      be respected.
      
      But after doing all this, `rmDupsInRdrTyVars` stupidly just
      concatenated the lists of type and kind variables at the end. If a
      variable were used as both a type and a kind, the algorithm would
      produce *both*! This led to all kinds of problems, including #13988.
      
      This is mostly Richard Eisenberg's patch. The only original
      contribution I made was adapting call sites of `rnImplicitBndrs` to
      work with the new definition of `rmDupsInRdrTyVars`. That is,
      `rnImplicitBndrs` checks for variables that are illegally used in
      both type and kind positions without using `-XTypeInType`, but in
      order to check this, one cannot have filtered duplicate variables out
      before passing them to `rnImplicitBndrs`. To accommodate for this, I
      needed to concoct variations on the existing `extract-` functions in
      `RnTypes` which do not remove duplicates, and use those near
      `rnImplicitBndrs` call sites.
      
      test case: ghci/scripts/T13988
      
      Test Plan: make test TEST=T13988
      
      Reviewers: goldfire, simonpj, austin, bgamari
      
      Reviewed By: goldfire, simonpj
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13988
      
      Differential Revision: https://phabricator.haskell.org/D3902
      b9ac9e05
  13. 02 Sep, 2017 1 commit
    • Ryan Scott's avatar
      Fix #14167 by using isGadtSyntaxTyCon in more places · 8e4229ab
      Ryan Scott authored
      Summary:
      Two places in GHC effectively attempt to //guess// whether a data type
      was declared using GADT syntax:
      
      1. When reifying a data type in Template Haskell
      2. When pretty-printing a data type (e.g., via `:info` in GHCi)
      
      But there's no need for heuristics here, since we have a 100% accurate way to
      determine whether a data type was declared using GADT syntax: the
      `isGadtSyntaxTyCon` function! By simply using that as the metric, we obtain
      far more accurate TH reification and pretty-printing results.
      
      This is technically a breaking change, since Template Haskell reification will
      now reify some data type constructors as `(Rec)GadtC` that it didn't before,
      and some data type constructors that were previously reified as `(Rec)GadtC`
      will no longer be reified as such. But it's a very understandable breaking
      change, since the previous behavior was simply incorrect.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, goldfire, austin, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #14167
      
      Differential Revision: https://phabricator.haskell.org/D3901
      8e4229ab
  14. 29 Aug, 2017 1 commit
    • Simon Peyton Jones's avatar
      Refactor bindHsQTyVars and friends · 0257dacf
      Simon Peyton Jones authored
      This work was triggered by Trac #13738, which revealed to me that
      the code RnTypes.bindHsQTyVars and bindLHsTyVarBndrs was a huge
      tangled mess -- and outright wrong on occasion as the ticket showed.
      
      The big problem was that bindLHsTyVarBndrs (which is invoked at every
      HsForAll, including nested higher rank ones) was attempting to bind
      implicit kind variables, which it has absolutely no busineess doing.
      Imlicit kind quantification is done at the outside only, in fact
      precisely where we have HsImplicitBndrs or LHsQTyVars (which also
      has implicit binders).
      
      Achieving this move was surprisingly hard, because more and more
      barnacles had accreted aroud the original mistake.  It's much
      much better now.
      
      Summary of changes.  Almost all the action is in RnTypes.
      
      * Implicit kind variables are bound only by
        - By bindHsQTyVars, which deals with LHsQTyVars
        - By rnImplicitBndrs, which deals with HsImplicitBndrs
      
      * bindLHsTyVarBndrs, and bindLHsTyVarBndr are radically simplified.
        They simply does far less, and have lots their forest of
        incomprehensible accumulating parameters.  (To be fair, some of
        the code in bindLHsTyVarBndrs just moved to bindHsQTyVars, but
        in much more perspicuous form.)
      
      * The code that checks if a variable appears in both a kind and
        a type (triggering RnTypes.mixedVarsErr) was bizarre.  E.g.
        we had this in RnTypes.extract_hs_tv_bndrs
             ; check_for_mixed_vars bndr_kvs acc_tvs
             ; check_for_mixed_vars bndr_kvs body_tvs
             ; check_for_mixed_vars body_tvs acc_kvs
             ; check_for_mixed_vars body_kvs acc_tvs
             ; check_for_mixed_vars locals body_kvs
        I cleaned all this up; now we check for mixed use at binding
        sites only.
      
      * Checks for "Variable used as a kind before being bound", like
           data T (a :: k) k = rhs
        now just show up straightforwardly as "k is not in scope".
        See Note [Kind variable ordering]
      
      * There are some knock-on simplifications in RnSource.
      0257dacf
  15. 17 Aug, 2017 1 commit
    • Ryan Scott's avatar
      Remove unneeded reqlibs for mtl and parsec in the GHC testsuite · 03853475
      Ryan Scott authored
      Now that `mtl` and `parsec` are boot libraries, there's no need to
      qualify various tests in the testsuite with `reqlib('mtl')` or
      `reqlib('parsec')`.
      
      Test Plan: make test TEST="T4809 tcfail126 T4355 tc232 tc223 tc220
      tc217 tc183 T5303 DoParamM qq005 qq006 galois_raytrace T1074 mod133
      T3787 T4316 prog011 drvfail006 drvfail008"
      
      Reviewers: bgamari, austin
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3855
      03853475
  16. 15 Aug, 2017 1 commit
    • Ryan Scott's avatar
      Don't drop GHCi-defined functions with -fobject-code enabled · ddb870bf
      Ryan Scott authored
      The desugarer was using `targetRetainsAllBindings` as a litmus test for
      determining if a function was defined in interactive mode (and thus
      should be exported). However, there is a corner case where one can be in
      interactive mode and have `targetRetainsAllBindings` return `False`: if
      `-fobject-code` is enabled (since the target will no longer be
      `HscInteractive`). In such a scenario, we should fall back on a
      different test for determining if we are in a GHCi session. I chose to
      use `isInteractiveModule`, which appears to do the trick.
      
      Test Plan: make test TEST=T12091
      
      Reviewers: austin, bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #12091
      
      Differential Revision: https://phabricator.haskell.org/D3849
      ddb870bf
  17. 19 Jul, 2017 1 commit
    • Ryan Scott's avatar
      Fix #13983 by creating a TyConFlavour type, and using it · 6e3c901d
      Ryan Scott authored
      An error message was referring to a type synonym as a datatype.
      Annoyingly, learning that the TyCon over which the error message is
      operating is actually a type synonym was previously impossible, since
      that code only had access to a TcTyCon, which doesn't retain any
      information about what sort of TyCon it is.
      
      To rectify this, I created a new TyConFlavour datatype, intended to
      capture roughly what sort of TyCon we're dealing with. I then performing
      the necessary plumbing to ensure all TcTyCons have a TyConFlavour, and
      propagated this information through to the relevant error message.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, austin, bgamari, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, rwbarton, thomie
      
      GHC Trac Issues: #13983
      
      Differential Revision: https://phabricator.haskell.org/D3747
      6e3c901d
  18. 11 Jul, 2017 1 commit
  19. 21 Jun, 2017 1 commit
  20. 02 Jun, 2017 1 commit
    • Ryan Scott's avatar
      Make GHCi work when RebindableSyntax is enabled · 2abe54e1
      Ryan Scott authored
      Previously, we were running some blocks of code at the start of every
      GHCi sessions which use do-notation, something which doesn't work well
      if you start GHCi with the `-XRebindableSyntax` flag on. This tweaks the
      code to avoid the use of do-notation so that `-XRebindableSyntax` won't
      reject it.
      
      Test Plan: make test TEST=T13385
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13385
      
      Differential Revision: https://phabricator.haskell.org/D3621
      2abe54e1
  21. 26 May, 2017 1 commit
    • Simon Peyton Jones's avatar
      Some tidying up of type pretty-printing · ad14efd5
      Simon Peyton Jones authored
      Triggered by the changes in #13677, I ended up doing a bit of
      refactoring in type pretty-printing.
      
      * We were using TyOpPrec and FunPrec rather inconsitently, so
        I made it consisent.
      
      * That exposed the fact that we were a bit undecided about whether
        to print
           a + b -> c + d   vs   (a+b) -> (c+d)
        and similarly
           a ~ [b] => blah  vs   (a ~ [b]) => blah
      
        I decided to make TyOpPrec and FunPrec compare equal
        (in BasicTypes), so (->) is treated as equal precedence with
        other type operators, so you get the unambiguous forms above,
        even though they have more parens.
      
        We could readily reverse this decision.
        See Note [Type operator precedence] in BasicTypes
      
      * I fixed a bug in pretty-printing of HsType where some
        parens were omitted by mistake.
      ad14efd5
  22. 20 May, 2017 1 commit
  23. 25 Apr, 2017 2 commits
    • Ryan Scott's avatar
      Only pretty-print binders in closed type families with -fprint-explicit-foralls · da792e47
      Ryan Scott authored
      Previously, we were unconditionally pretty-printing all type variable
      binders when pretty-printing closed type families (e.g., in the output
      of `:info` in GHCi). This threw me for a loop, so let's guard this behind
      the `-fprint-explicit-foralls` flag.
      
      Test Plan: make test TEST=T13420
      
      Reviewers: goldfire, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      GHC Trac Issues: #13420
      
      Differential Revision: https://phabricator.haskell.org/D3497
      da792e47
    • Simon Marlow's avatar
      Don't setProgramDynFlags on every :load · 914842e5
      Simon Marlow authored
      Summary:
      setProgramDynFlags invalidates the whole module graph, forcing
      everything to be re-summarised (including preprocessing) on every
      :reload.
      
      Looks like this was a bad regression in 8.0, but we didn't notice
      because there was no test for it.  Now there is!
      
      Test Plan:
      * validate
      * new unit test
      
      Reviewers: bgamari, triple, austin, niteria, erikd, jme
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3398
      914842e5
  24. 23 Apr, 2017 1 commit
  25. 02 Apr, 2017 2 commits
  26. 29 Mar, 2017 2 commits
    • Matthías Páll Gissurarson's avatar
      Show valid substitutions for typed holes · 26c95f46
      Matthías Páll Gissurarson authored
      The idea is to implement a mechanism similar to PureScript, where they
      suggest which identifiers in scope would fit the given hole. In
      PureScript, they use subsumption (which is what we would like here as
      well). For subsumption, we would have to check each type in scope
      whether the hole is a subtype of the given type, but that would require
      `tcSubType` and constraint satisfiability checking. Currently,
      `TcSimplify` uses a lot of functions from `TcErrors`, so that would
      require more of a rewrite, I will hold on with that for now, and submit
      the more simpler type equality version.
      
      As an example, consider
      
      ```
      ps :: String -> IO ()
      ps = putStrLn
      
      ps2 :: a -> IO ()
      ps2 _ = putStrLn "hello, world"
      
      main :: IO ()
      main = _ "hello, world"
      ```
      
      The results would be something like
      
      ```
          • Found hole: _ :: [Char] -> IO ()
          • In the expression: _
            In a stmt of a 'do' block: _ "hello, world"
            In the expression:
              do _ "hello, world"
          • Relevant bindings include
              main :: IO () (bound at test.hs:13:1)
              ps :: String -> IO () (bound at test.hs:7:1)
              ps2 :: forall a. a  -> IO () (bound at test.hs:10:1)
            Valid substitutions include
              putStrLn :: String
                          -> IO () (imported from ‘Prelude’ at
      test.hs:1:1-14
                                    (and originally defined in
      ‘System.IO’))
              putStr :: String
                        -> IO () (imported from ‘Prelude’ at
      test.hs:1:1-14
                                  (and originally defined in ‘System.IO’))
      ```
      
      We'd like here for ps2 to be suggested as well, but for that we require
      subsumption.
      
      Reviewers: austin, bgamari, dfeuer, mpickering
      
      Reviewed By: dfeuer, mpickering
      
      Subscribers: mpickering, Wizek, dfeuer, rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3361
      26c95f46
    • ruperthorlick's avatar
      Fixed error messages for RecursiveDo (#8501) · 5856c564
      ruperthorlick authored
      
      
      Changes in a few different places to catch several different
      types of error related to RecursiveDo
      Signed-off-by: ruperthorlick's avatarRupert Horlick <ruperthorlick@gmail.com>
      
      Test Plan: Three test cases, with further tests in comments
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3271
      5856c564
  27. 27 Mar, 2017 2 commits
    • Simon Peyton Jones's avatar
      Fix 'unsolved constraints' in GHCi · feca929b
      Simon Peyton Jones authored
      In initTc, if the computation fails with an exception, we
      should not complain about unsolved constraints.
      
      Fixes Trac #13466.
      feca929b
    • Simon Peyton Jones's avatar
      Fix error-message suppress on given equalities · e0ad55f8
      Simon Peyton Jones authored
      I'd got the logic slightly wrong when reporting type errors
      for insoluble 'given' equalities.  We suppress insoluble givens
      under some circumstances (see Note [Given errors]), but we then
      suppressed subsequent 'wanted' errors because the (suppressed)
      'given' error "won".  Result: no errors at all :-(.
      
      This patch fixes it and
       - Renames TcType.isTyVarUnderDatatype to the more
         perspicuous TcType.isInsolubleOccursCheck
      
      In doing this I realise that I don't understand why we need
      to keep the insolubles partitioned out separately at all...
      but that is for another day.
      e0ad55f8
  28. 17 Mar, 2017 1 commit
  29. 14 Mar, 2017 1 commit
    • Ryan Scott's avatar
      Allow associated types to pattern-match in non-class-bound variables · 67345ccf
      Ryan Scott authored
      Summary:
      After 8136a5cb (#11450), if you have
      a class with an associated type:
      
      ```
      class C a where
        type T a b
      ```
      
      And you try to create an instance of `C` like this:
      
      ```
      instance C Int where
        type T Int Char = Bool
      ```
      
      Then it is rejected, since you're trying to instantiate the variable ``b`` with
      something other than a type variable. But this restriction proves quite
      onerous in practice, as it prevents you from doing things like this:
      
      ```
      class C a where
        type T a (b :: Identity c) :: c
      
      instance C Int where
        type T Int ('Identity x) = x
      ```
      
      You have to resort to an auxiliary type family in order to define this now,
      which becomes extremely tiring. This lifts this restriction and fixes #13398,
      in which it was discovered that adding this restriction broke code in the wild.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, bgamari, austin
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3302
      67345ccf
  30. 10 Mar, 2017 1 commit
    • Simon Peyton Jones's avatar
      Fix TcSimplify.decideQuantification for kind variables · 7e96526a
      Simon Peyton Jones authored
      TcSimplify.decideQuantification was doing the Wrong Thing when
      "growing" the type variables to quantify over. We were trying to do
      this on a tyvar set where we'd split off the dependent type varaibles;
      and we just got it wrong.  A kind variable wasn't being generalised
      properly, with confusing knock on consequences.
      
      All this led to Trac #13371 and Trac #13393.
      
      This commit tidies it all up:
      
      * The type TcDepVars is renamed as CandidateQTvs;
        and splitDepVarsOfType to candidateQTyVarsOfType
      
      * The code in TcSimplify.decideQuantification is simpler.
        It no longer does the tricky "grow" stuff over TcDepVars.
        Instead it use ordinary VarSets (thereby eliminating the
        nasty growThetaTyVarsDSet) and uses that to filter the
        result of candidateQTyVarsOfType.
      
      * I documented that candidateQTyVarsOfType returns the type
        variables in a good order in which to quantify, and rewrote
        it to use an accumulator pattern, so that we would predicatably
        get left-to-right ordering.
      
      In doing all this I also made UniqDFM behave a little more nicely:
      
      * When inserting an element that is there already, keep the old tag,
        while still overwriting with the new value.
      
      * This means that when doing udfmToList we get back elements in the
        order they were originally inserted, rather than in reverse order.
      
      It's not a big deal, but in a subsequent commit I use it to improve
      the order of type variables in inferred types.
      
      All this led to a lot of error message wibbles:
       - changing the order of quantified variables
       - changing the order in which instances are listed in GHCi
       - changing the tidying of variables in typechecker erors
      
      There's a submodule update for 'array' because one of its tests
      has an error-message change.
      
      I may not have associated all of them with the correct commit.
      7e96526a
  31. 04 Mar, 2017 1 commit
  32. 26 Feb, 2017 2 commits
    • rwbarton's avatar
      tests: remove extra_files.py (#12223) · 3415bcaa
      rwbarton authored
      The script I used is included as testsuite/driver/kill_extra_files.py,
      though at this point it is for mostly historical interest.
      
      Some of the tests in libraries/hpc relied on extra_files.py, so this
      commit includes an update to that submodule.
      
      One test in libraries/process also relies on extra_files.py, but we
      cannot update that submodule so easily, so for now we special-case it
      in the test driver.
      3415bcaa
    • rwbarton's avatar
      tests: manually move some extra_files into *.T files · 98119f5a
      rwbarton authored
      Some of the *.T files were in libraries/hpc, so this contains an
      update to that submodule.
      98119f5a