Skip to content
Snippets Groups Projects
  1. Sep 13, 2016
  2. Sep 11, 2016
  3. Aug 29, 2016
  4. Aug 26, 2016
  5. Aug 23, 2016
    • Ryan Scott's avatar
      Template Haskell support for unboxed sums · 613d7455
      Ryan Scott authored
      This adds new constructors `UnboxedSumE`, `UnboxedSumT`, and
      `UnboxedSumP` to represent unboxed sums in Template Haskell.
      
      One thing you can't currently do is, e.g., `reify ''(#||#)`, since I
      don't believe unboxed sum type/data constructors can be written in
      prefix form.  I will look at fixing that as part of #12514.
      
      Fixes #12478.
      
      Test Plan: make test TEST=T12478_{1,2,3}
      
      Reviewers: osa1, goldfire, austin, bgamari
      
      Reviewed By: goldfire, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2448
      
      GHC Trac Issues: #12478
      613d7455
  6. Aug 22, 2016
  7. Aug 05, 2016
  8. Jul 21, 2016
    • Ömer Sinan Ağacan's avatar
      Implement unboxed sum primitive type · 714bebff
      Ömer Sinan Ağacan authored
      Summary:
      This patch implements primitive unboxed sum types, as described in
      https://ghc.haskell.org/trac/ghc/wiki/UnpackedSumTypes.
      
      Main changes are:
      
      - Add new syntax for unboxed sums types, terms and patterns. Hidden
        behind `-XUnboxedSums`.
      
      - Add unlifted unboxed sum type constructors and data constructors,
        extend type and pattern checkers and desugarer.
      
      - Add new RuntimeRep for unboxed sums.
      
      - Extend unarise pass to translate unboxed sums to unboxed tuples right
        before code generation.
      
      - Add `StgRubbishArg` to `StgArg`, and a new type `CmmArg` for better
        code generation when sum values are involved.
      
      - Add user manual section for unboxed sums.
      
      Some other changes:
      
      - Generalize `UbxTupleRep` to `MultiRep` and `UbxTupAlt` to
        `MultiValAlt` to be able to use those with both sums and tuples.
      
      - Don't use `tyConPrimRep` in `isVoidTy`: `tyConPrimRep` is really
        wrong, given an `Any` `TyCon`, there's no way to tell what its kind
        is, but `kindPrimRep` and in turn `tyConPrimRep` returns `PtrRep`.
      
      - Fix some bugs on the way: #12375.
      
      Not included in this patch:
      
      - Update Haddock for new the new unboxed sum syntax.
      
      - `TemplateHaskell` support is left as future work.
      
      For reviewers:
      
      - Front-end code is mostly trivial and adapted from unboxed tuple code
        for type checking, pattern checking, renaming, desugaring etc.
      
      - Main translation routines are in `RepType` and `UnariseStg`.
        Documentation in `UnariseStg` should be enough for understanding
        what's going on.
      
      Credits:
      
      - Johan Tibell wrote the initial front-end and interface file
        extensions.
      
      - Simon Peyton Jones reviewed this patch many times, wrote some code,
        and helped with debugging.
      
      Reviewers: bgamari, alanz, goldfire, RyanGlScott, simonpj, austin,
                 simonmar, hvr, erikd
      
      Reviewed By: simonpj
      
      Subscribers: Iceland_jack, ggreif, ezyang, RyanGlScott, goldfire,
                   thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D2259
      714bebff
  9. Jul 20, 2016
    • Ömer Sinan Ağacan's avatar
      Support SCC pragmas in declaration context · 98b2c508
      Ömer Sinan Ağacan authored
      Not having SCCs at the top level is becoming annoying real quick. For
      simplest cases, it's possible to do this transformation:
      
          f x y = ...
          =>
          f = {-# SCC f #-} \x y -> ...
      
      However, it doesn't work when there's a `where` clause:
      
          f x y = <t is in scope>
            where t = ...
          =>
          f = {-# SCC f #-} \x y -> <t is out of scope>
            where t = ...
      
      Or when we have a "equation style" definition:
      
          f (C1 ...) = ...
          f (C2 ...) = ...
          f (C3 ...) = ...
          ...
      
      (usual solution is to rename `f` to `f'` and define a new `f` with a
      `SCC`)
      
      This patch implements support for SCC annotations in declaration
      contexts. This is now a valid program:
      
          f x y = ...
            where
              g z = ...
              {-# SCC g #-}
          {-# SCC f #-}
      
      Test Plan: This passes slow validate (no new failures added).
      
      Reviewers: goldfire, mpickering, austin, bgamari, simonmar
      
      Reviewed By: bgamari, simonmar
      
      Subscribers: simonmar, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D2407
      98b2c508
  10. Jul 06, 2016
    • Facundo Domínguez's avatar
      Have addModFinalizer expose the local type environment. · 567dbd9b
      Facundo Domínguez authored
      Summary:
      This annotates the splice point with 'HsSpliced ref e' where 'e' is the
      result of the splice. 'ref' is a reference that the typechecker will fill with
      the local type environment.
      
      The finalizer then reads the ref and uses the local type environment, which
      causes 'reify' to find local variables when run in the finalizer.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, simonmar, bgamari, austin, goldfire
      
      Reviewed By: goldfire
      
      Subscribers: simonmar, thomie, mboes
      
      Differential Revision: https://phabricator.haskell.org/D2286
      
      GHC Trac Issues: #11832
      567dbd9b
  11. Jul 01, 2016
  12. Jun 23, 2016
  13. Jun 15, 2016
    • Simon Peyton Jones's avatar
      Re-add FunTy (big patch) · 77bb0927
      Simon Peyton Jones authored
      With TypeInType Richard combined ForAllTy and FunTy, but that was often
      awkward, and yielded little benefit becuase in practice the two were
      always treated separately.  This patch re-introduces FunTy.  Specfically
      
      * New type
          data TyVarBinder = TvBndr TyVar VisibilityFlag
        This /always/ has a TyVar it.  In many places that's just what
        what we want, so there are /lots/ of TyBinder -> TyVarBinder changes
      
      * TyBinder still exists:
          data TyBinder = Named TyVarBinder | Anon Type
      
      * data Type = ForAllTy TyVarBinder Type
                  | FunTy Type Type
                  |  ....
      
      There are a LOT of knock-on changes, but they are all routine.
      
      The Haddock submodule needs to be updated too
      77bb0927
  14. Jun 13, 2016
    • Simon Peyton Jones's avatar
      Improve typechecking of let-bindings · 15b9bf4b
      Simon Peyton Jones authored
      This major commit was initially triggered by #11339, but it spiraled
      into a major review of the way in which type signatures for bindings
      are handled, especially partial type signatures.  On the way I fixed a
      number of other bugs, namely
         #12069
         #12033
         #11700
         #11339
         #11670
      
      The main change is that I completely reorganised the way in which type
      signatures in bindings are handled. The new story is in TcSigs
      Note [Overview of type signatures].  Some specific:
      
      * Changes in the data types for signatures in TcRnTypes:
        TcIdSigInfo and new TcIdSigInst
      
      * New module TcSigs deals with typechecking type signatures
        and pragmas. It contains code mostly moved from TcBinds,
        which is already too big
      
      * HsTypes: I swapped the nesting of HsWildCardBndrs
        and HsImplicitBndsrs, so that the wildcards are on the
        oustide not the insidde in a LHsSigWcType.  This is just
        a matter of convenient, nothing deep.
      
      There are a host of other changes as knock-on effects, and
      it all took FAR longer than I anticipated :-).  But it is
      a significant improvement, I think.
      
      Lots of error messages changed slightly, some just variants but
      some modest improvements.
      
      New tests
      
      * typecheck/should_compile
          * SigTyVars: a scoped-tyvar test
          * ExPat, ExPatFail: existential pattern bindings
          * T12069
          * T11700
          * T11339
      
      * partial-sigs/should_compile
          * T12033
          * T11339a
          * T11670
      
      One thing to check:
      
      * Small change to output from ghc-api/landmines.
        Need to check with Alan Zimmerman
      15b9bf4b
  15. Jun 06, 2016
    • Alan Zimmerman's avatar
      Merge MatchFixity and HsMatchContext · a13cb279
      Alan Zimmerman authored
      Summary:
      MatchFixity was introduced to facilitate use of API Annotations.
      
      HsMatchContext does the same thing with more detail, but is chased
      through all over the place to provide context when processing a Match.
      
      Since we already have MatchFixity in the Match, it may as well provide
      the full context.
      
      updates submodule haddock
      
      Test Plan: ./validate
      
      Reviewers: austin, goldfire, bgamari
      
      Subscribers: thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D2271
      
      GHC Trac Issues: #12105
      
      (cherry picked from commit 306ecad5)
      a13cb279
  16. May 24, 2016
    • Ryan Scott's avatar
      Remove 'deriving Typeable' statements · 95dfdceb
      Ryan Scott authored
      Summary:
      Deriving `Typeable` has been a no-op since GHC 7.10, and now that we
      require 7.10+ to build GHC, we can remove all the redundant `deriving Typeable`
      statements in GHC.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, austin, hvr, bgamari
      
      Reviewed By: austin, hvr, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2260
      95dfdceb
  17. May 21, 2016
    • Andrew Farmer's avatar
      Fix deriving Ord when RebindableSyntax is enabled · 527ed724
      Andrew Farmer authored and Ben Gamari's avatar Ben Gamari committed
      Deriving clauses (Ord especially) generated if-expressions with nlHsIf
      which were subject to RebindableSyntax. This changes nlHsIf to generate
      concrete if-expressions.
      
      There was also an error about calling tagToEnum# at a polymorphic type,
      which is not allowed. Fixing nlHsIf didn't fix this for some reason, so
      I generated a type ascription around the call to tagToEnum#. Not sure
      why the typechecker could not figure this out.
      
      Test Plan: Added a test, ran validate.
      
      Reviewers: simonpj, simonmar, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2247
      
      GHC Trac Issues: #12080
      527ed724
  18. May 12, 2016
  19. May 06, 2016
  20. May 02, 2016
    • Facundo Domínguez's avatar
      StaticPointers: Allow closed vars in the static form. · 36d29f7c
      Facundo Domínguez authored
      Summary:
      With this patch closed variables are allowed regardless of whether
      they are bound at the top level or not.
      
      The FloatOut pass is always performed. When optimizations are
      disabled, only expressions that go to the top level are floated.
      Thus, the applications of the StaticPtr data constructor are always
      floated.
      
      The CoreTidy pass makes sure the floated applications appear in the
      symbol table of object files. It also collects the floated bindings
      and inserts them in the static pointer table.
      
      The renamer does not check anymore if free variables appearing in the
      static form are top-level. Instead, the typechecker looks at the
      tct_closed flag to decide if the free variables are closed.
      
      The linter checks that applications of StaticPtr only occur at the
      top of top-level bindings after the FloatOut pass.
      
      The field spInfoName of StaticPtrInfo has been removed. It used to
      contain the name of the top-level binding that contains the StaticPtr
      application. However, this information is no longer available when the
      StaticPtr is constructed, as the binding name is determined now by the
      FloatOut pass.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, simonpj, austin, hvr, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: thomie, mpickering, mboes
      
      Differential Revision: https://phabricator.haskell.org/D2104
      
      GHC Trac Issues: #11656
      36d29f7c
  21. Apr 28, 2016
    • Simon Peyton Jones's avatar
      Refactor RecordPatSynField, FieldLabel · 3dce4f2d
      Simon Peyton Jones authored
      This patch uses the named fields of
       * FieldLabel
       * RecordPatSynField
      in construction and pattern matching. The fields
      existed before, but we were often using positional notation.
      
      Also a minor refactor of the API of mkPatSynRecSelBinds
      
      No change in functionality
      3dce4f2d
  22. Apr 20, 2016
    • Simon Peyton Jones's avatar
      SCC analysis for instances as well as types/classes · 353d8ae6
      Simon Peyton Jones authored
      This big patch is in pursuit of Trac #11348.
      
      It is largely the work of Alex Veith (thank you!), with some
      follow-up simplification and refactoring from Simon PJ.
      
      The main payload is described in RnSource
        Note [Dependency analysis of type, class, and instance decls]
      which is pretty detailed.
      
      * There is a new data type HsDecls.TyClGroup, for a strongly
        connected component of type/class/instance/role decls.
      
        The hs_instds field of HsGroup disappears, in consequence
      
        This forces some knock-on changes, including a minor
        haddock submodule update
      
      Smaller, weakly-related things
      
      * I found that both the renamer and typechecker were building an
        identical env for RoleAnnots, so I put common code for
        RoleAnnotEnv in RnEnv.
      
      * I found that tcInstDecls1 had very clumsy error handling, so I
        put it together into TcInstDcls.doClsInstErrorChecks
      353d8ae6
    • Simon Peyton Jones's avatar
      Reduce use of instances in hs-boot files · 81aa3d1c
      Simon Peyton Jones authored
      Several things here
      
      * GHC no longer allows user-written Typeable instances,
        so remove them from hs-boot files.
      
      * Generally, reduce the use of instances in hs-boot files. They are
        hard to track.  Mainly this involves using pprType, pprKind etc
        instead of just ppr.  There were a lot of instances in hs-boot
        files that weren't needed at all.
      
      * Take TyThing out of Eq; it was used in exactly one place (in
        InteractiveEval), and equality is too big a hammer for that.
      81aa3d1c
  23. Apr 17, 2016
  24. Apr 12, 2016
    • Richard Eisenberg's avatar
      Fix #11811. · b1084fd7
      Richard Eisenberg authored
      Previously, I had forgotten to omit variables already in scope
      from the TypeInType CUSK check. Simple enough to fix.
      
      Test case: typecheck/should_compile/T11811
      b1084fd7
  25. Apr 10, 2016
    • Jason Eisenberg's avatar
      Fix suggestions for unbound variables (#11680) · 470d4d5b
      Jason Eisenberg authored and Ben Gamari's avatar Ben Gamari committed
      When the typechecker generates the error message for an out-of-scope
      variable, it now uses the GlobalRdrEnv with respect to which the
      variable is unbound, not the GlobalRdrEnv which is available at the time
      the error is reported.  Doing so ensures we do not provide suggestions
      which themselves are out-of-scope (because they are bound in a later
      inter-splice group).
      
      Nonetheless, we do note in the error message if an unambiguous, exact
      match to the out-of-scope variable is found in a later inter-splice
      group, and we specify where that match is not in scope.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, austin, bgamari
      
      Reviewed By: goldfire
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2000
      
      GHC Trac Issues: #11680
      470d4d5b
  26. Apr 06, 2016
  27. Mar 31, 2016
    • Simon Peyton Jones's avatar
      Refactor in TcMatches · bdd90426
      Simon Peyton Jones authored
      * Move the several calls of tauifyMultipleMatches into tcMatches,
        so that it can be called only once, and the invariants are
        clearer
      
      * I discovered in doing this that HsLamCase had a redundant and
        tiresome argument, so I removed it. That in turn allowed some
        modest but nice code simplification
      bdd90426
  28. Mar 24, 2016
  29. Mar 17, 2016
    • Richard Eisenberg's avatar
      Fix #11711. · b5565f1a
      Richard Eisenberg authored
      There were two bugs here, both simple: we need to filter out
      covars before calling isMetaTyVar in the solver, and TcPat had
      a tcSubType the wrong way round.
      
      test case: dependent/should_compile/T11711
      b5565f1a
  30. Mar 15, 2016
    • Richard Eisenberg's avatar
      Fix #11648. · 55577a91
      Richard Eisenberg authored
      We now check that a CUSK is really a CUSK and issue an error if
      it isn't. This also involves more solving and zonking in
      kcHsTyVarBndrs, which was the outright bug reported in #11648.
      
      Test cases: polykinds/T11648{,b}
      
      This updates the haddock submodule.
      
      [skip ci]
      55577a91
    • Richard Eisenberg's avatar
      Refactor visible type application. · 972730cc
      Richard Eisenberg authored
      This replaces the old HsType and HsTypeOut constructors
      with HsAppType and HsAppTypeOut, leading to some simplification.
      (This refactoring addresses #11329.)
      
      This also fixes #11456, which stumbled over HsType (which is
      not an expression).
      
      test case: ghci/scripts/T11456
      
      [skip ci]
      972730cc
  31. Mar 05, 2016
    • Rik Steenkamp's avatar
      Fix printing of an `IfacePatSyn` · 3801262e
      Rik Steenkamp authored and Ben Gamari's avatar Ben Gamari committed
      Now the existentially quantified type variables are printed
      at the correct location when printing a pattern synonym type
      from an `IfacePatSyn`. The function `pprIfaceContextMaybe`
      has been removed as it is no longer needed.
      
      Fixes #11524.
      
      Reviewers: austin, goldfire, thomie, bgamari, mpickering
      
      Reviewed By: bgamari
      
      Differential Revision: https://phabricator.haskell.org/D1958
      
      GHC Trac Issues: #11524
      3801262e
  32. Feb 25, 2016
  33. Feb 16, 2016
  34. Feb 12, 2016
    • Simon Peyton Jones's avatar
      Improve pretty-printing of HsWrappers · d0846243
      Simon Peyton Jones authored
      Reduces un-neede parens.
      
      Also -fprint-typechecker-elaboration now makes type applications
      and casts in expressions also appear.  (Previously those were
      confusingly controlled by -fprint-explicit-coercions.)
      d0846243
    • Simon Peyton Jones's avatar
      Simplify AbsBinds wrapping · c6485d5e
      Simon Peyton Jones authored
      In poking Trac #11414 I found myself sinking into the abe_inst_wrap
      swamp.  What is this strange thing?  (It turned out that #11414 was
      breaking because of it.)
      
      Thrillingly, I found a way to sweep it away again, putting the deep
      instantation into tcMonoBinds instead of mkExport; and it turned out
      that the fun_co_fn field of FunBind was already there ready to receive
      exactly this wrapper. Hooray.  Result
      
      * Death to abe_inst_wrap
      * Death to mbi_orig
      * Death to the plumbing in tcPolyInfer that did the
        deep instantiation
      
      I did find that I had to re-engineer the treatment of instance type
      signatures (again), but the result looks more modular and robust to
      me.
      
      And #11414 is fixed.
      c6485d5e
  35. Feb 08, 2016
    • Simon Peyton Jones's avatar
      Allow foralls in instance decls · 2cf3cac6
      Simon Peyton Jones authored
      This patch finally makes it possible to have explicit
      foralls in an instance decl
         instance forall (a :: *). Eq a => Eq [a] where ...
      
      This is useful to allow kind signatures or indeed
      explicicit kind for-alls; see Trac #11519
      
      I thought it would be really easy, because an instance
      declaration already contains an actual HsSigType, so all
      the syntactic baggage is there.  But in fact it turned
      out that instance declarations were kind-checked a
      little differently, because the body kind of the forall
      is 'Constraint' rather than '*'.
      
      So I fixed that.  There a slight kludge
      (see Note [Body kind of a HsQualTy], but it's still a
      significant improvement.
      
      I also did the usual other round of refactoring,
      improved a few error messages, tidied up comments etc.
      The only significant aspect of all that was
      
        * Kill mkNakedSpecSigmaTy, mkNakedPhiTy, mkNakedFunTy
          These function names suggest that they do something
          complicated, but acutally they do nothing. So I
          killed them.
      
        * Swap the arg order of mkNamedBinder, just so that it is
          convenient to say 'map (mkNamedBinder Invisible) tvs'
      
        * I had to improve isPredTy, to deal with (illegal)
          types like
             (Eq a => Eq [a]) => blah
          See Note [isPeredTy complications] in Type.hs
      
      Still to come: user manual documentation for the
      instance-decl change.
      2cf3cac6
Loading