1. 29 Oct, 2018 1 commit
    • Tobias Dammers's avatar
      Finish fix for #14880. · 5e45ad10
      Tobias Dammers authored
      The real change that fixes the ticket is described in
      Note [Naughty quantification candidates] in TcMType.
      
      Fixing this required reworking candidateQTyVarsOfType, the function
      that extracts free variables as candidates for quantification.
      One consequence is that we now must be more careful when quantifying:
      any skolems around must be quantified manually, and quantifyTyVars
      will now only quantify over metavariables. This makes good sense,
      as skolems are generally user-written and are listed in the AST.
      
      As a bonus, we now have more control over the ordering of such
      skolems.
      
      Along the way, this commit fixes #15711 and refines the fix
      to #14552 (by accepted a program that was previously rejected,
      as we can now accept that program by zapping variables to Any).
      
      This commit also does a fair amount of rejiggering kind inference
      of datatypes. Notably, we now can skip the generalization step
      in kcTyClGroup for types with CUSKs, because we get the
      kind right the first time. This commit also thus fixes #15743 and
       #15592, which both concern datatype kind generalisation.
      (#15591 is also very relevant.) For this aspect of the commit, see
      Note [Required, Specified, and Inferred in types] in TcTyClsDecls.
      
      Test cases: dependent/should_fail/T14880{,-2},
                  dependent/should_fail/T15743[cd]
                  dependent/should_compile/T15743{,e}
                  ghci/scripts/T15743b
                  polykinds/T15592
                  dependent/should_fail/T15591[bc]
                  ghci/scripts/T15591
      5e45ad10
  2. 19 Sep, 2017 1 commit
    • Herbert Valerio Riedel's avatar
      compiler: introduce custom "GhcPrelude" Prelude · f63bc730
      Herbert Valerio Riedel authored
      This switches the compiler/ component to get compiled with
      -XNoImplicitPrelude and a `import GhcPrelude` is inserted in all
      modules.
      
      This is motivated by the upcoming "Prelude" re-export of
      `Semigroup((<>))` which would cause lots of name clashes in every
      modulewhich imports also `Outputable`
      
      Reviewers: austin, goldfire, bgamari, alanz, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: goldfire, rwbarton, thomie, mpickering, bgamari
      
      Differential Revision: https://phabricator.haskell.org/D3989
      f63bc730
  3. 29 May, 2017 1 commit
  4. 18 Apr, 2017 1 commit
  5. 01 Mar, 2017 2 commits
    • David Feuer's avatar
      Upgrade UniqSet to a newtype · cbe569a5
      David Feuer authored
      The fundamental problem with `type UniqSet = UniqFM` is that `UniqSet`
      has a key invariant `UniqFM` does not. For example, `fmap` over
      `UniqSet` will generally produce nonsense.
      
      * Upgrade `UniqSet` from a type synonym to a newtype.
      
      * Remove unused and shady `extendVarSet_C` and `addOneToUniqSet_C`.
      
      * Use cached unique in `tyConsOfType` by replacing
        `unitNameEnv (tyConName tc) tc` with `unitUniqSet tc`.
      
      Reviewers: austin, hvr, goldfire, simonmar, niteria, bgamari
      
      Reviewed By: niteria
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3146
      cbe569a5
    • Simon Peyton Jones's avatar
      Add VarSet.anyDVarSet, allDVarSet · cdf6b695
      Simon Peyton Jones authored
      I need these in a later commit.
      
      Also rename
        varSetAny  -->  anyVarSet
        varSetAll  -->  allVarSet
      for consistency with other functions; eg filterVarSet
      
      Reviewers: austin, goldfire, bgamari
      
      Subscribers: niteria, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3202
      cdf6b695
  6. 05 Aug, 2016 1 commit
  7. 07 Jun, 2016 1 commit
    • niteria's avatar
      Kill varSetElems · 7008515b
      niteria authored
      This eradicates varSetElems from the codebase. This function
      used to introduce nondeterminism.
      I've also documented benign nondeterminism in three places.
      
      GHC Trac: #4012
      7008515b
  8. 24 May, 2016 1 commit
    • niteria's avatar
      Document some benign nondeterminism · 4c6e69d5
      niteria authored
      I've changed the functions to their nonDet equivalents and explained
      why they're OK there. This allowed me to remove foldNameSet,
      foldVarEnv, foldVarEnv_Directly, foldVarSet and foldUFM_Directly.
      
      Test Plan: ./validate, there should be no change in behavior
      
      Reviewers: simonpj, simonmar, austin, goldfire, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2244
      
      GHC Trac Issues: #4012
      4c6e69d5
  9. 12 May, 2016 1 commit
  10. 28 Apr, 2016 3 commits
  11. 26 Apr, 2016 1 commit
    • niteria's avatar
      Kill varSetElemsWellScoped in quantifyTyVars · c9bcaf31
      niteria authored
      varSetElemsWellScoped introduces unnecessary non-determinism in
      inferred type signatures.
      Removing this instance required changing the representation of
      TcDepVars to use deterministic sets.
      This is the last occurence of varSetElemsWellScoped, allowing me to
      finally remove it.
      
      Test Plan:
      ./validate
      I will update the expected outputs when commiting, some reordering
      of type variables in types is expected.
      
      Reviewers: goldfire, simonpj, austin, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: thomie, simonmar
      
      Differential Revision: https://phabricator.haskell.org/D2135
      
      GHC Trac Issues: #4012
      c9bcaf31
  12. 22 Apr, 2016 1 commit
    • niteria's avatar
      Make benign non-determinism in pretty-printing more obvious · 0f96686b
      niteria authored
      This change takes us one step closer to being able to remove
      `varSetElemsWellScoped`. The end goal is to make every source
      of non-determinism obvious at the source level, so that when
      we achieve determinism it doesn't get broken accidentally.
      
      Test Plan: compile GHC
      
      Reviewers: simonmar, goldfire, simonpj, austin, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2123
      
      GHC Trac Issues: #4012
      0f96686b
  13. 16 Feb, 2016 1 commit
  14. 11 Dec, 2015 1 commit
    • eir@cis.upenn.edu's avatar
      Add kind equalities to GHC. · 67465497
      eir@cis.upenn.edu authored
      This implements the ideas originally put forward in
      "System FC with Explicit Kind Equality" (ICFP'13).
      
      There are several noteworthy changes with this patch:
       * We now have casts in types. These change the kind
         of a type. See new constructor `CastTy`.
      
       * All types and all constructors can be promoted.
         This includes GADT constructors. GADT pattern matches
         take place in type family equations. In Core,
         types can now be applied to coercions via the
         `CoercionTy` constructor.
      
       * Coercions can now be heterogeneous, relating types
         of different kinds. A coercion proving `t1 :: k1 ~ t2 :: k2`
         proves both that `t1` and `t2` are the same and also that
         `k1` and `k2` are the same.
      
       * The `Coercion` type has been significantly enhanced.
         The documentation in `docs/core-spec/core-spec.pdf` reflects
         the new reality.
      
       * The type of `*` is now `*`. No more `BOX`.
      
       * Users can write explicit kind variables in their code,
         anywhere they can write type variables. For backward compatibility,
         automatic inference of kind-variable binding is still permitted.
      
       * The new extension `TypeInType` turns on the new user-facing
         features.
      
       * Type families and synonyms are now promoted to kinds. This causes
         trouble with parsing `*`, leading to the somewhat awkward new
         `HsAppsTy` constructor for `HsType`. This is dispatched with in
         the renamer, where the kind `*` can be told apart from a
         type-level multiplication operator. Without `-XTypeInType` the
         old behavior persists. With `-XTypeInType`, you need to import
         `Data.Kind` to get `*`, also known as `Type`.
      
       * The kind-checking algorithms in TcHsType have been significantly
         rewritten to allow for enhanced kinds.
      
       * The new features are still quite experimental and may be in flux.
      
       * TODO: Several open tickets: #11195, #11196, #11197, #11198, #11203.
      
       * TODO: Update user manual.
      
      Tickets addressed: #9017, #9173, #7961, #10524, #8566, #11142.
      Updates Haddock submodule.
      67465497
  15. 02 Dec, 2015 1 commit
  16. 21 Nov, 2015 1 commit
    • niteria's avatar
      Add DVarSet - a deterministic set of Vars · 6664ab83
      niteria authored
      This implements `DVarSet`, a deterministic set of Vars, with an
      interface very similar to `VarSet` with a couple of functions missing.
      
      I will need this in changes that follow, one of them will be about
      changing the type of the set of Vars that `RuleInfo` holds to make the
      free variable computation deterministic.
      
      Test Plan:
      ./validate
      I can add new tests if anyone wants me to.
      
      Reviewers: simonpj, simonmar, austin, bgamari
      
      Reviewed By: simonmar, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1487
      
      GHC Trac Issues: #4012
      6664ab83
  17. 03 Sep, 2015 1 commit
  18. 18 May, 2015 1 commit
    • Simon Peyton Jones's avatar
      Refactor tuple constraints · ffc21506
      Simon Peyton Jones authored
      Make tuple constraints be handled by a perfectly ordinary
      type class, with the component constraints being the
      superclasses:
          class (c1, c2) => (c2, c2)
      
      This change was provoked by
      
        #10359  inability to re-use a given tuple
                constraint as a whole
      
        #9858   confusion between term tuples
                and constraint tuples
      
      but it's generally a very nice simplification. We get rid of
       -  In Type, the TuplePred constructor of PredTree,
          and all the code that dealt with TuplePreds
       -  In TcEvidence, the constructors EvTupleMk, EvTupleSel
      
      See Note [How tuples work] in TysWiredIn.
      
      Of course, nothing is ever entirely simple. This one
      proved quite fiddly.
      
      - I did quite a bit of renaming, which makes this patch
        touch a lot of modules. In partiuclar tupleCon -> tupleDataCon.
      
      - I made constraint tuples known-key rather than wired-in.
        This is different to boxed/unboxed tuples, but it proved
        awkward to have all the superclass selectors wired-in.
        Easier just to use the standard mechanims.
      
      - While I was fiddling with known-key names, I split the TH Name
        definitions out of DsMeta into a new module THNames.  That meant
        that the known-key names can all be gathered in PrelInfo, without
        causing module loops.
      
      - I found that the parser was parsing an import item like
            T( .. )
        as a *data constructor* T, and then using setRdrNameSpace to
        fix it.  Stupid!  So I changed the parser to parse a *type
        constructor* T, which means less use of setRdrNameSpace.
      
        I also improved setRdrNameSpace to behave better on Exact Names.
        Largely on priciple; I don't think it matters a lot.
      
      - When compiling a data type declaration for a wired-in thing like
        tuples (,), or lists, we don't really need to look at the
        declaration.  We have the wired-in thing!  And not doing so avoids
        having to line up the uniques for data constructor workers etc.
        See Note [Declarations for wired-in things]
      
      - I found that FunDeps.oclose wasn't taking superclasses into
        account; easily fixed.
      
      - Some error message refactoring for invalid constraints in TcValidity
      
      - Haddock needs to absorb the change too; so there is a submodule update
      ffc21506
  19. 14 May, 2015 1 commit
    • Austin Seipp's avatar
      Revert multiple commits · 3cf8ecdc
      Austin Seipp authored
      This reverts multiple commits from Simon:
      
        - 04a484ea Test Trac #10359
        - a9ccd37a Test Trac #10403
        - c0aae6f6 Test Trac #10248
        - eb6ca851 Make the "matchable-given" check happen first
        - ca173aa3 Add a case to checkValidTyCon
        - 51cbad15 Update haddock submodule
        - 6e1174da Separate transCloVarSet from fixVarSet
        - a8493e03 Fix imports in HscMain (stage2)
        - a154944b Two wibbles to fix the build
        - 5910a1bc Change in capitalisation of error msg
        - 130e93aa Refactor tuple constraints
        - 8da785d5 Delete commented-out line
      
      These break the build by causing Haddock to fail mysteriously when
      trying to examine GHC.Prim it seems.
      3cf8ecdc
  20. 13 May, 2015 1 commit
  21. 06 Jan, 2015 2 commits
  22. 03 Dec, 2014 1 commit
  23. 26 Sep, 2014 1 commit
  24. 29 Aug, 2014 1 commit
  25. 15 May, 2014 1 commit
    • Herbert Valerio Riedel's avatar
      Add LANGUAGE pragmas to compiler/ source files · 23892440
      Herbert Valerio Riedel authored
      In some cases, the layout of the LANGUAGE/OPTIONS_GHC lines has been
      reorganized, while following the convention, to
      
      - place `{-# LANGUAGE #-}` pragmas at the top of the source file, before
        any `{-# OPTIONS_GHC #-}`-lines.
      
      - Moreover, if the list of language extensions fit into a single
        `{-# LANGUAGE ... -#}`-line (shorter than 80 characters), keep it on one
        line. Otherwise split into `{-# LANGUAGE ... -#}`-lines for each
        individual language extension. In both cases, try to keep the
        enumeration alphabetically ordered.
        (The latter layout is preferable as it's more diff-friendly)
      
      While at it, this also replaces obsolete `{-# OPTIONS ... #-}` pragma
      occurences by `{-# OPTIONS_GHC ... #-}` pragmas.
      23892440
  26. 01 Oct, 2013 1 commit
  27. 21 May, 2013 1 commit
    • Simon Peyton Jones's avatar
      Simplify kind generalisation, and fix Trac #7916 · ce89bdec
      Simon Peyton Jones authored
      A buglet that exposed an opportunity for some welcome refactoring
      and simplification.  Main changes
      
      * TcMType.zonkQuantifiedTyVars is replaced by quantifyTyVars, which
        does a bit more zonking (so that its clients do not need to)
      
      * TcHsType.kindGeneralise becomes a bit simpler, and hands off
        to quantifyTyVars
      
      * A bit of simplification of the hacky code in TcTyClsDcls.tcConDecl,
        where we figure out how to generalise the data constructor's type
      
      * Improve the error message from badExistential when a constructor
        has an existential type, by printing the offending type
      
      * Some consequential simplification in simplifyInfer.
      ce89bdec
  28. 04 Nov, 2011 1 commit
  29. 23 Jul, 2011 1 commit
    • Simon Peyton Jones's avatar
      A nice tidy-up for CvSubst and liftCoSubst · 525aca2c
      Simon Peyton Jones authored
      A "lifting substitition" takes a *type* to a *coercion*, using a
      substitution that takes a *type variable* to a *coercion*.  We were
      using a CvSubst for this purpose, which was an awkward exception: in
      every other use of CvSubst, type variables map only to types.
      
      Turned out that Coercion.liftCoSubst is quite a small function, so I
      rewrote it with a special substitution type Coercion.LiftCoSubst, just
      for that purpose.  In doing so I found that the function itself was
      bizarrely over-complicated ... a direct result of mis-using CvSubst.
      
      So this patch makes it all simpler, faster, and easier to understand.
      No bugs fixed though!
      525aca2c
  30. 19 Apr, 2011 1 commit
    • Simon Peyton Jones's avatar
      This BIG PATCH contains most of the work for the New Coercion Representation · fdf86568
      Simon Peyton Jones authored
      See the paper "Practical aspects of evidence based compilation in System FC"
      
      * Coercion becomes a data type, distinct from Type
      
      * Coercions become value-level things, rather than type-level things,
        (although the value is zero bits wide, like the State token)
        A consequence is that a coerion abstraction increases the arity by 1
        (just like a dictionary abstraction)
      
      * There is a new constructor in CoreExpr, namely Coercion, to inject
        coercions into terms
      fdf86568
  31. 11 Feb, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Fix Trac #3017: ensure that we quantify over enough type variables when equalities are involved · e5a8d57c
      simonpj@microsoft.com authored
      The function FunDeps.grow was not doing the right thing when type equality
      constraints were involved.  That wasn't really its fault: its input was
      being filtered by fdPredsOfInsts.
      
      To fix this I did a bit of refactoring, so that the (revolting) fdPredsOfInsts
      is now less important (maybe we can get rid of it in due course).  The 'grow'
      function moves from FunDeps to
      	 Inst.growInstsTyVars
      	 TcMTType.growThetaTyVars
      	 TcMType.growTyVars
      
      The main comments are with the first of these, in
      Note [Growing the tau-tvs using constraints] in Inst.
      
      Push to the branch if conflict free.
      
      e5a8d57c
  32. 31 Jul, 2008 2 commits
  33. 29 Mar, 2008 1 commit
  34. 26 Mar, 2008 1 commit
  35. 05 Feb, 2008 1 commit