1. 21 Sep, 2015 1 commit
    • eir@cis.upenn.edu's avatar
      Refactor BranchLists. · cd2840a7
      eir@cis.upenn.edu authored
      Now we use Array to store branches. This makes sense because we often
      have to do random access (once inference is done). This also vastly
      simplifies the awkward BranchList type.
      
      This fixes #10837 and updates submodule utils/haddock.
      cd2840a7
  2. 03 Sep, 2015 1 commit
  3. 26 Jun, 2015 1 commit
    • Simon Peyton Jones's avatar
      Allow recursive unwrapping of data families · 0b7e538a
      Simon Peyton Jones authored
      When doing strictness analysis, we need to look inside products.
      To avoid unpacking infinitely, we must be careful about
      infinite types.  That in turn is controlled by TyCon.checkRecTc.
      
      For data families like
         data instance T (a,b) = MkT a (T b)
      we want to unpack the thing recursively for types like
        T (Int, (Int, (Int, Int)))
      
      This patch elaborates the checkRecTc mechanism in TyCon, to
      maintain a *count* of how many times a TyCon has shown up,
      rather than just a boolean.
      
      A simple change, and a useful one.  Fixes Trac #10482.
      0b7e538a
  4. 16 Jun, 2015 1 commit
    • eir@cis.upenn.edu's avatar
      Refactor handling of decomposition. · 7eceffb3
      eir@cis.upenn.edu authored
      This adds the significant Note [Decomposing equalities] to
      TcCanonical, trying to sort out the various cases involved.
      
      The only functional change this commit should make is a different
      treatment of data families, which were wrong before (they could
      be decomposed at role R, which is wrong).
      7eceffb3
  5. 01 Jun, 2015 1 commit
  6. 24 Apr, 2015 1 commit
  7. 10 Apr, 2015 1 commit
  8. 09 Apr, 2015 1 commit
  9. 07 Mar, 2015 1 commit
  10. 02 Mar, 2015 1 commit
  11. 10 Feb, 2015 1 commit
  12. 18 Dec, 2014 1 commit
    • Iavor S. Diatchki's avatar
      Add a provenance field to universal coercions. · 1d4e94d1
      Iavor S. Diatchki authored
      Universal coercions allow casting between arbitrary types, so it is a
      good idea to keep track where they came from, which now we can do by
      using the provenance field in `UnivCo`.
      
      This is also handy for type-checker plugins that provide functionality
      beyond what's expressible by GHC's standard coercions:  such plugins
      can generate universal coercions, but they should still tag them,
      so that if something goes wrong we can link the casts to the plugin.
      1d4e94d1
  13. 12 Dec, 2014 1 commit
    • eir@cis.upenn.edu's avatar
      Rewrite `Coercible` solver · 0cc47eb9
      eir@cis.upenn.edu authored
      Summary:
      This is a rewrite of the algorithm to solve for Coercible "instances".
      
      A preliminary form of these ideas is at
      https://ghc.haskell.org/trac/ghc/wiki/Design/NewCoercibleSolver
      
      The basic idea here is that the `EqPred` constructor of `PredTree`
      now is parameterised by a new type `EqRel` (where
      `data EqRel = NomEq | ReprEq`). Thus, every equality constraint can
      now talk about nominal equality (the usual case) or representational
      equality (the `Coercible` case).
      
      This is a change from the previous
      behavior where `Coercible` was just considered a regular class with
      a special case in `matchClassInst`.
      
      Because of this change, representational equalities are now
      canonicalized just like nominal ones, allowing more equalities
      to be solved -- in particular, the case at the top of #9117.
      
      A knock-on effect is that the flattener must be aware of the
      choice of equality relation, because the inert set now stores
      both representational inert equalities alongside the nominal
      inert equalities. Of course, we can use representational equalities
      to rewrite only within another representational equality --
      thus the parameterization of the flattener.
      
      A nice side effect of this change is that I've introduced a new
      type `CtFlavour`, which tracks G vs. W vs. D, removing some ugliness
      in the flattener.
      
      This commit includes some refactoring as discussed on D546.
      It also removes the ability of Deriveds to rewrite Deriveds.
      
      This fixes bugs #9117 and #8984.
      
      Reviewers: simonpj, austin, nomeata
      
      Subscribers: carter, thomie
      
      Differential Revision: https://phabricator.haskell.org/D546
      
      GHC Trac Issues: #9117, #8984
      0cc47eb9
  14. 01 Dec, 2014 1 commit
  15. 04 Nov, 2014 1 commit
  16. 21 Sep, 2014 1 commit
  17. 19 Sep, 2014 1 commit
    • Simon Peyton Jones's avatar
      Clean up Coercible handling, and interaction of data families with newtypes · 0aaf812e
      Simon Peyton Jones authored
      This patch fixes Trac #9580, in which the Coercible machinery succeeded
      even though the relevant data constructor was not in scope.
      
      As usual I got dragged into a raft of refactoring changes,
      all for the better.
      
      * Delete TcEvidence.coercionToTcCoercion (now unused)
      
      * Move instNewTyConTF_maybe, instNewTyCon_maybe to FamInst,
        and rename them to tcInstNewTyConTF_maybe, tcInstNewTyCon
        (They both return TcCoercions.)
      
      * tcInstNewTyConTF_maybe also gets more convenient type,
        which improves TcInteract.getCoercibleInst
      
      * Define FamInst.tcLookupDataFamInst, and use it in TcDeriv,
        (as well as in tcInstNewTyConTF_maybe)
      
      * Improve error report for Coercible errors, when data familes
        are involved  Another use of tcLookupDataFamInst
      
      * In TcExpr.tcTagToEnum, use tcLookupDataFamInst to replace
        local hacky code
      
      * Fix Coercion.instNewTyCon_maybe and Type.newTyConInstRhs to deal
        with eta-reduced newtypes, using
        (new) Type.unwrapNewTyConEtad_maybe and (new) Type.applyTysX
      
      Some small refactoring of TcSMonad.matchFam.
      0aaf812e
  18. 29 Aug, 2014 1 commit
  19. 21 Jul, 2014 1 commit
  20. 18 Jul, 2014 1 commit
  21. 17 Jul, 2014 1 commit
    • Herbert Valerio Riedel's avatar
      Workaround haddock parser error caused by 5e7406d9 · 3b8b826b
      Herbert Valerio Riedel authored
      Haddock complains if a comment looks like a misplaced Haddock-comment.
      In this case, the comment line starting with `-- *kind* and` looked like a
      section-heading to Haddock and caused the following error:
      
          parse error on input ‘-- *kind* and role of its argument. Luckily, laziness should’
      
      This commit just rewraps the line so that no `*` appear at the start of the
      non-Haddock comment lines.
      Signed-off-by: Herbert Valerio Riedel's avatarHerbert Valerio Riedel <hvr@gnu.org>
      3b8b826b
  22. 16 Jul, 2014 1 commit
    • eir@cis.upenn.edu's avatar
      Rewrite coercionRole. (#9233) · 34ec0bd9
      eir@cis.upenn.edu authored
      Summary:
      coercionRole is now much more efficient, computing both the coercion's
      kind and role together. The previous version calculated them separately,
      leading to quite possibly exponential behavior.
      
      This is still too slow, but it's a big improvement.
      
      Test Plan: Evaluate by running the "minimized" test from the Trac ticket.
      
      Reviewers: simonpj, austin
      
      Subscribers: simonmar, relrod, carter
      
      Differential Revision: https://phabricator.haskell.org/D73
      34ec0bd9
  23. 03 Jun, 2014 1 commit
  24. 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
  25. 13 May, 2014 1 commit
  26. 12 May, 2014 1 commit
  27. 06 May, 2014 1 commit
    • Simon Peyton Jones's avatar
      Modularise pretty-printing for foralls · 3c3ce829
      Simon Peyton Jones authored
      See TypeRep.pprUserForAll.  This just makes forall-printing a bit more
      consistent.  In particular, I wasn't seeing the kind foralls when
      displaying a CoAxiom or CoAxBranch
      
      The output on T7939 is just possible a bit too verbose now, but even if so
      that's an error in the right direction.
      3c3ce829
  28. 29 Apr, 2014 1 commit
  29. 28 Apr, 2014 1 commit
    • eir@cis.upenn.edu's avatar
      Improve implementation of unSubCo_maybe. · a3896ab5
      eir@cis.upenn.edu authored
      This is the result of an email conversation (off list) with
      Conal Elliott, who needed a stronger unSubCo_maybe. This
      commit adds cases to upgrade the role of a coercion when
      recursion is necessary to do say (for example, for a use of
      TransCo). As a side effect, more coercion optimizations are
      now possible.
      
      This was not done previously because unSubCo_maybe was used
      only during coercion optimization, and the recursive cases
      looked to be unlikely. However, adding them can cause no harm.
      
      unSubCo_maybe is now also exported from Coercion, for use
      cases like Conal's.
      a3896ab5
  30. 20 Jan, 2014 1 commit
  31. 12 Jan, 2014 1 commit
  32. 02 Dec, 2013 1 commit
  33. 27 Nov, 2013 1 commit
    • Joachim Breitner's avatar
      Roleify TcCoercion · 9d643cf6
      Joachim Breitner authored
      Previously, TcCoercion were only used to represent boxed Nominal
      coercions. In order to also talk about boxed Representational coercions
      in the type checker, we add Roles to TcCoercion. Again, we closely
      mirror Coercion.
      
      The roles are verified by a few assertions, and at the latest after
      conversion to Coercion. I have put my trust in the comprehensiveness of
      the testsuite here, but any role error after desugaring popping up now
      might be caused by this refactoring.
      9d643cf6
  34. 24 Oct, 2013 3 commits
  35. 23 Oct, 2013 2 commits
  36. 01 Oct, 2013 1 commit
  37. 18 Sep, 2013 1 commit
    • eir@cis.upenn.edu's avatar
      Change role annotation syntax. · f4046b50
      eir@cis.upenn.edu authored
      This fixes bugs #8185, #8234, and #8246. The new syntax is explained
      in the comments to #8185, appears in the "Roles" subsection of the
      manual, and on the [wiki:Roles] wiki page.
      
      This change also removes the ability for a role annotation on type
      synonyms, as noted in #8234.
      f4046b50