1. 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
  2. 01 May, 2015 5 commits
    • Simon Peyton Jones's avatar
      Move IP, Symbol, Nat to ghc-prim · 2f6a0ac7
      Simon Peyton Jones authored
      This motivation is to declare class IP much earlier (in ghc-prim),
      so that implicit parameters (which depend on IP) is available
      to library code, notably the 'error' function.
      
      * Move class IP from base:GHC.IP
                      to ghc-prim:GHC.Classes
      * Delete module GHC.IP from base
      
      * Move types Symbol and Nat
            from base:GHC.TypeLits
            to ghc-prim:GHC.Types
      
      There was a name clash in GHC.RTS.Flags, where I renamed
      the local type Nat to RtsNat.
      2f6a0ac7
    • Simon Peyton Jones's avatar
      Kill off the default types in ghc-prim · de5d022e
      Simon Peyton Jones authored
      We were trying to load the type for Integer to do defaulting
      in ghc-prim, but it's simply not available at that time.
      de5d022e
    • Simon Peyton Jones's avatar
      Make Derived NomEq rewrite only Derived NomEq · b626cb08
      Simon Peyton Jones authored
      See Note [Deriveds do rewrite Deriveds].  The important point
      is that we want to maintain the Note [Can-rewrite relation]
      property, lest we risk loops.
      b626cb08
    • Simon Peyton Jones's avatar
      Refactor TyCon to eliminate TupleTyCon · f6ab0f2d
      Simon Peyton Jones authored
      This makes TupleTyCon into an ordinary AlgTyCon, distinguished
      by its AlgTyConRhs, rather than a separate constructor of TyCon.
      
      It is preparatory work for making constraint tuples into classes,
      for which the ConstraintTuple tuples will have a TyConParent
      of a ClassTyCon.  Tuples didn't have this possiblity before.
      
      The patch affects other modules because I eliminated the
      unsatisfactory partial functions tupleTyConBoxity and tupleTyConSort.
      And tupleTyConArity which is just tyConArity.
      f6ab0f2d
    • Simon Peyton Jones's avatar
      Comments only · bbfa0caa
      Simon Peyton Jones authored
      bbfa0caa
  3. 30 Apr, 2015 2 commits
    • Gabor Greif's avatar
      Typo fixes (mostly in comments) · a3f7517e
      Gabor Greif authored
      a3f7517e
    • Simon Peyton Jones's avatar
      Tidy up treatment of FlexibleContexts · b83160d0
      Simon Peyton Jones authored
      Previously (Trac #10351) we could get
      
          Non type-variable argument in the constraint: C [t]
          (Use FlexibleContexts to permit this)
          When checking that `f' has the inferred type
            f :: forall t. C [t] => t -> ()
      
      which is a bit stupid: we have *inferred* a type that we
      immediately *reject*.  This patch arranges that that the
      generalisation mechanism (TcSimplify.decideQuantification)
      doesn't pick a predicate that will be rejected by the
      subsequent validity check.
      
      This forced some minor refactoring, as usual.
      b83160d0
  4. 29 Apr, 2015 4 commits
    • Simon Peyton Jones's avatar
      Improve improvement in the constraint solver · a1275a76
      Simon Peyton Jones authored
      This regrettably-big patch substantially improves the way in which
      "improvement" happens in the constraint solver.  It was triggered by
      trying to crack Trac #10009, but it turned out to solve #10340 as
      well.
      
      The big picture, with several of the trickiest examples, is described
      in Note [The improvement story] in TcInteract.
      
      The major change is this:
      
      * After solving we explicitly try "improvement", by
           - making the unsolved Wanteds into Deriveds
           - allowing Deriveds to rewrite Deriveds
        This more aggressive rewriting "unlocks" some extra
        guess-free unifications.
      
      * The main loop is in TcInteract.solveSimpleWanteds, but I also ended
        up refactoring TcSimplify.simpl_loop, and its surrounding code.
      
        Notably, any insolubles from the Givens are pulled out
        and treated separately, rather than staying in the inert set
        during the solveSimpleWanteds loop.
      
      There are a lot of follow-on changes
      
      * Do not emit generate Derived improvements from Wanteds.
        This saves work in the common case where they aren't needed.
      
      * For improvement we should really do type-class reduction on Derived
        constraints in doTopReactDict.  That entailed changing the GenInst
        constructor a bit; a local and minor change
      
      * Some annoying faffing about with dropping derived constraints;
        see dropDerivedWC, dropDerivedSimples, dropDerivedInsols,
        and their Notes.
      
      * Some substantial refactoring in TcErrors.reportWanteds.
        This work wasn't strictly forced, but I got sucked into it.
        All the changes are in TcErrors.
      
      * Use TcS.unifyTyVar consistently, rather than setWantedTyBind,
        so that unifications are properly tracked.
      
      * Refactoring around solveWantedsTcM, solveWantedsAndDrop.
        They previously guaranteed a zonked result, but it's more
        straightforward for clients to zonk.
      a1275a76
    • Simon Peyton Jones's avatar
      Don't print evidence in TcFlatten · d9bb0ee7
      Simon Peyton Jones authored
      Because when flattening a Derived constraint, the evidence doesn't exist
      (it's an error thunk)
      d9bb0ee7
    • Simon Peyton Jones's avatar
      A little outright bug in canEqTyVar2 · 168c8831
      Simon Peyton Jones authored
      I had 'ev' where I should have had 'new_ev'.  It's quite hard to make
      this bug cause a failure, but I did eventually get a Lint error
      somewhere.  Anyway, it's just a typo, I think.
      168c8831
    • Simon Peyton Jones's avatar
      Seed SpecConstr from local calls · b61562fe
      Simon Peyton Jones authored
      Seed SpecConstr based on *local* calls as well as *RHS* calls.
      See Note [Seeding top-level recursive groups].  The change here
      is mentioned here:
      
         NB: before Apr 15 we used (a) only, but Dimitrios had an example
             where (b) was  crucial, so I added that.
      
      This is a pretty small change, requested by Dimitrios, that adds
      SpecConstr call patterns from the rest of the module, as well as ones
      from the RHS.
      
      Still to come: #10346.
      b61562fe
  5. 24 Apr, 2015 3 commits
  6. 22 Apr, 2015 7 commits
  7. 21 Apr, 2015 4 commits
    • Simon Peyton Jones's avatar
      Wibble to DmdAnal · 5c7e4db5
      Simon Peyton Jones authored
      This fixes a typo in d5773a49
          Teach DmdAnal that coercions are value arguments!
          (Trac #10288)
      
      Sorry about that; I'm not sure how it slipped through.
      5c7e4db5
    • Simon Peyton Jones's avatar
      Support unboxing for GADT product types · f2d1b7fc
      Simon Peyton Jones authored
      Beofre this commit we never unboxed GADT, even if they
      are perfectly civilised products.
      
      This patch liberalises unboxing slightly.
      See Note [Product types] in TyCon.
      
      Still to come
       - for strictness, we could maybe deal with existentials too
       - todo: unboxing constructor arguments
      f2d1b7fc
    • Simon Peyton Jones's avatar
      Spelling in comment · d12c7cb9
      Simon Peyton Jones authored
      d12c7cb9
    • Simon Peyton Jones's avatar
      Teach DmdAnal about free coercion variables · 3bec1ac0
      Simon Peyton Jones authored
      Coercion variables are used in casts and coercions, so the demand
      analyser should jolly well not regard them as absent!
      
      In fact this bug never makes a difference because even absent
      unboxed-coercion arguments are passed anyway;
      see WwLib.mk_abesnt_let, which returns Nothing for coercion Ids.
      
      But it was simply wrong before and that is never cool.
      3bec1ac0
  8. 20 Apr, 2015 1 commit
    • Simon Peyton Jones's avatar
      Teach DmdAnal that coercions are value arguments! · d5773a49
      Simon Peyton Jones authored
      The demand analyser was treating coercion args like type args,
      which meant that the arguments in a strictness signature got
      out of step with the arguments of a call.  Result chaos and
      disaster.  Trac #10288 showed it up.
      
      It's hard to get this bug to show up in practice because
       - functions abstracted over coercions are usually abstracted
         over *boxed* coercions
       - we don't currently unbox a boxed-coercion arg because it's
         GADT (I see how to fix this too)
      
      But after floating, optimisation, and so on, Trac #10288 did
      get a function abstracted over an unboxed coercion, and then
      the -flate-dmd-anal pass went wrong.
      
      I don't think I can come up with a test case, but I don't think
      it matters too much.
      
      Still to come
       - Fix a second bug, namely that coercion variables are wrongly
         marked as absent because DmdAnal doesn't check the the free
         variables of casts. I think this never bites in practice
         (see the follow-up commit)
      
       - Make GADT products work with strictness analysis
      d5773a49
  9. 17 Apr, 2015 3 commits
  10. 16 Apr, 2015 3 commits
  11. 15 Apr, 2015 2 commits
    • Joachim Breitner's avatar
      Improve Call Arity performance · a9ca67f6
      Joachim Breitner authored
      This improves how the Call Arity deals with "boring" variables. Boring
      variables are those where it does not bother to include in the analysis
      result, so whenever something is looked up in the analysis result, we
      have to make a conservative assumption about them.
      
      Previously, we extended the result with such conservative information
      about them, to keep the code uniform, but that could blow up the amount
      of data passed around, even if only temporarily, and slowed things down.
      
      We now pass around an explicit list (well, set) of variable that are
      boring and take that into account whenever we use the result. Not as
      pretty, but noticably faster.
      a9ca67f6
    • Simon Peyton Jones's avatar
      Fix fundep coverage-condition check for poly-kinds · 49d9b009
      Simon Peyton Jones authored
      See Note [Closing over kinds in coverage] in FunDeps.
      I'd already fixed this bug once, for Trac #8391, but I put the
      call to closeOverKinds in the wrong place, so Trac #10109
      failed.  (It checks the /liberal/ coverage condition, which
      
      The fix was easy: move the call to the right place!
      49d9b009
  12. 14 Apr, 2015 5 commits