1. 29 Apr, 2017 1 commit
  2. 05 Apr, 2017 1 commit
  3. 02 Apr, 2017 1 commit
  4. 06 Mar, 2017 1 commit
    • Ben Gamari's avatar
      Read COMPLETE sets from external packages · 8ca4bb1c
      Ben Gamari authored
      Currently, `COMPLETE` pragmas are not read from external packages at
      all, which quite limits their usefulness. This extends
      `ExternalPackageState` to include `COMPLETE` sets from other packages,
      and plumbs around the appropriate values to make it work the way you'd
      expect it to.
      
      Requires a `binary` submodule update.
      
      Fixes #13350.
      
      Test Plan: make test TEST=T13350
      
      Reviewers: rwbarton, mpickering, austin, simonpj, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: simonpj, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3257
      8ca4bb1c
  5. 03 Mar, 2017 2 commits
  6. 02 Mar, 2017 1 commit
    • Edward Z. Yang's avatar
      Properly represent abstract classes in Class and IfaceDecl · fb5cd9d6
      Edward Z. Yang authored
      Summary:
      Previously, abstract classes looked very much like normal
      classes, except that they happened to have no methods,
      superclasses or ATs, and they came from boot files.  This
      patch gives abstract classes a proper representation in
      Class and IfaceDecl, by moving the things which are never
      defined for abstract classes into ClassBody/IfaceClassBody.
      
      Because Class is abstract, this change had ~no disruption
      to any of the code in GHC; if you ask about the methods of
      an abstract class, we'll just give you an empty list.
      
      This also fixes a bug where abstract type classes were incorrectly
      treated as representationally injective (they're not!)
      
      Fixes #13347, and a TODO in the code.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: validate
      
      Reviewers: simonpj, bgamari, austin
      
      Subscribers: goldfire, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3236
      fb5cd9d6
  7. 01 Mar, 2017 1 commit
    • 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
  8. 27 Feb, 2017 1 commit
  9. 25 Feb, 2017 2 commits
  10. 24 Feb, 2017 1 commit
  11. 17 Feb, 2017 1 commit
    • Edward Z. Yang's avatar
      Fix a Backpack recompilation avoidance bug when signatures change. · ca543154
      Edward Z. Yang authored
      Summary:
      Recompilation avoidance checks if -this-unit-id has changed by relying
      on the "wanted module" check in readIface ("Something is amiss...").
      Unfortunately, this check didn't check if the instantiation made
      sense, which meant that if you changed the signatures of a Backpack
      package, we'd still treat the old signatures as up-to-date.
      
      The way I fixed this was by having findAndReadIface take in a 'Module'
      representing the /actual/ module we were intending to lookup.  We
      convert this into the 'Module' we expect to see in 'mi_module' and
      now do a more elaborate check that will also verify that instantiations
      make sense.
      
      Along the way, I robustified the logging infrastructure for
      recompilation checking, and folded wrongIfaceModErr (which
      was dead code) into the error message.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: validate
      
      Reviewers: bgamari, austin
      
      Subscribers: thomie, snowleopard
      
      Differential Revision: https://phabricator.haskell.org/D3130
      ca543154
  12. 14 Feb, 2017 1 commit
    • rwbarton's avatar
      Make deSugarExpr use runTcInteractive · f90e61ad
      rwbarton authored
      Preparation for #13102, which needs to add more logic to
      runTcInteractive, which would need to be duplicated in deSugarExpr.
      
      In order to break an import cycle, I had to move
      "Dependency/fingerprinting code" to a new module
      DsUsage; which seems sensible anyways.
      
      Test Plan: validate
      
      Reviewers: simonpj, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie, snowleopard
      
      Differential Revision: https://phabricator.haskell.org/D3125
      f90e61ad
  13. 26 Jan, 2017 1 commit
    • Matthew Pickering's avatar
      COMPLETE pragmas for enhanced pattern exhaustiveness checking · 1a3f1eeb
      Matthew Pickering authored
      This patch adds a new pragma so that users can specify `COMPLETE` sets of
      `ConLike`s in order to sate the pattern match checker.
      
      A function which matches on all the patterns in a complete grouping
      will not cause the exhaustiveness checker to emit warnings.
      
      ```
      pattern P :: ()
      pattern P = ()
      
      {-# COMPLETE P #-}
      
      foo P = ()
      ```
      
      This example would previously have caused the checker to warn that
      all cases were not matched even though matching on `P` is sufficient to
      make `foo` covering. With the addition of the pragma, the compiler
      will recognise that matching on `P` alone is enough and not emit
      any warnings.
      
      Reviewers: goldfire, gkaracha, alanz, austin, bgamari
      
      Reviewed By: alanz
      
      Subscribers: lelf, nomeata, gkaracha, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2669
      
      GHC Trac Issues: #8779
      1a3f1eeb
  14. 13 Dec, 2016 1 commit
  15. 28 Nov, 2016 1 commit
  16. 21 Nov, 2016 1 commit
  17. 13 Nov, 2016 1 commit
    • Ben Gamari's avatar
      Kill Type pretty-printer · 6c0f10fa
      Ben Gamari authored
      Here we consolidate the pretty-printing logic for types in IfaceType. We
      need IfaceType regardless and the printer for Type can be implemented in
      terms of that for IfaceType. See #11660.
      
      Note that this is very much a work-in-progress. Namely I still have yet
      to ponder how to ease the hs-boot file situation, still need to rip out
      more dead code, need to move some of the special cases for, e.g., `*` to
      the IfaceType printer, and need to get it to validate. That being said,
      it comes close to validating as-is.
      
      Test Plan: Validate
      
      Reviewers: goldfire, austin
      
      Subscribers: goldfire, thomie, simonpj
      
      Differential Revision: https://phabricator.haskell.org/D2528
      
      GHC Trac Issues: #11660
      6c0f10fa
  18. 31 Oct, 2016 1 commit
  19. 19 Oct, 2016 1 commit
  20. 18 Oct, 2016 1 commit
  21. 14 Oct, 2016 2 commits
    • Ben Gamari's avatar
      MkIface: Turn a foldr into a foldl' · 3991da46
      Ben Gamari authored
      There is no reason why this should be a foldr considering we are
      building a map.
      3991da46
    • Ben Gamari's avatar
      Clean up handling of known-key Names in interface files · 34d933d6
      Ben Gamari authored
      Previously BinIface had some dedicated logic for handling tuple names in
      the symbol table. As it turns out, this logic was essentially dead code
      as it was superceded by the special handling of known-key things. Here
      we cull the tuple code-path and use the known-key codepath for all
      tuple-ish things.
      
      This had a surprising number of knock-on effects,
      
       * constraint tuple datacons had to be made known-key (previously they
         were not)
      
       * IfaceTopBndr was changed from being a synonym of OccName to a
         synonym of Name (since we now need to be able to deserialize Names
         directly from interface files)
      
       * the change to IfaceTopBndr complicated fingerprinting, since we need
         to ensure that we don't go looking for the fingerprint of the thing
         we are currently fingerprinting in the fingerprint environment (see
         notes in MkIface). Handling this required distinguishing between
         binding and non-binding Name occurrences in the Binary serializers.
      
       * the original name cache logic which previously lived in IfaceEnv has
         been moved to a new NameCache module
      
       * I ripped tuples and sums out of knownKeyNames since they introduce a
         very large number of entries. During interface file deserialization
         we use static functions (defined in the new KnownUniques module) to
         map from a Unique to a known-key Name (the Unique better correspond
         to a known-key name!) When we need to do an original name cache
         lookup we rely on the parser implemented in isBuiltInOcc_maybe.
      
       * HscMain.allKnownKeyNames was folded into PrelInfo.knownKeyNames.
      
       * Lots of comments were sprinkled about describing the new scheme.
      
      Updates haddock submodule.
      
      Test Plan: Validate
      
      Reviewers: niteria, simonpj, austin, hvr
      
      Reviewed By: simonpj
      
      Subscribers: simonmar, niteria, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2467
      
      GHC Trac Issues: #12532, #12415
      34d933d6
  22. 08 Oct, 2016 3 commits
  23. 03 Sep, 2016 1 commit
  24. 21 Aug, 2016 2 commits
  25. 21 Jul, 2016 1 commit
    • Ö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
  26. 05 Jul, 2016 1 commit
    • niteria's avatar
      Use DVarEnv for vectInfoVar · 55e43a6f
      niteria authored
      This makes sure that we don't introduce unnecessary
      nondeterminism from vectorization.
      
      Also updates dph submodule to reflect the change in types.
      
      GHC Trac: #4012
      55e43a6f
  27. 30 Jun, 2016 1 commit
    • Edward Z. Yang's avatar
      Axe RecFlag on TyCons. · b8b3e30a
      Edward Z. Yang authored
      Summary:
      This commit removes the information about whether or not
      a TyCon is "recursive", as well as the code responsible
      for calculating this information.
      
      The original trigger for this change was complexity regarding
      how we computed the RecFlag for hs-boot files.  The problem
      is that in order to determine if a TyCon is recursive or
      not, we need to determine if it was defined in an hs-boot
      file (if so, we conservatively assume that it is recursive.)
      
      It turns that doing this is quite tricky.  The "obvious"
      strategy is to typecheck the hi-boot file (since we are
      eventually going to need the typechecked types to check
      if we properly implemented the hi-boot file) and just extract
      the names of all defined TyCons from the ModDetails, but
      this actually does not work well if Names from the hi-boot
      file are being knot-tied via if_rec_types: the "extraction"
      process will force thunks, which will force the typechecking
      process earlier than we have actually defined the types
      locally.
      
      Rather than work around all this trickiness (it certainly
      can be worked around, either by making interface loading
      MORE lazy, or just reading of the set of defined TyCons
      directly from the ModIface), we instead opted to excise
      the source of the problem, the RecFlag.
      
      For one, it is not clear if the RecFlag even makes sense,
      in the presence of higher-orderness:
      
          data T f a = MkT (f a)
      
      T doesn't look recursive, but if we instantiate f with T,
      then it very well is!  It was all very shaky.
      
      So we just don't bother anymore.  This has two user-visible
      implications:
      
      1. is_too_recursive now assumes that all TyCons are
      recursive and will bail out in a way that is still mysterious
      to me if there are too many TyCons.
      
      2. checkRecTc, which is used when stripping newtypes to
      get to representation, also assumes all TyCons are
      recursive, and will stop running if we hit the limit.
      
      The biggest risk for this patch is that we specialize less
      than we used to; however, the codeGen tests still seem to
      be passing.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Reviewers: simonpj, austin, bgamari
      
      Subscribers: goldfire, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2360
      b8b3e30a
  28. 23 Jun, 2016 1 commit
    • niteria's avatar
      Provide Uniquable version of SCC · 35d1564c
      niteria authored
      We want to remove the `Ord Unique` instance because there's
      no way to implement it in deterministic way and it's too
      easy to use by accident.
      
      We sometimes compute SCC for datatypes whose Ord instance
      is implemented in terms of Unique. The Ord constraint on
      SCC is just an artifact of some internal data structures.
      We can have an alternative implementation with a data
      structure that uses Uniquable instead.
      
      This does exactly that and I'm pleased that I didn't have
      to introduce any duplication to do that.
      
      Test Plan:
      ./validate
      I looked at performance tests and it's a tiny bit better.
      
      Reviewers: bgamari, simonmar, ezyang, austin, goldfire
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2359
      
      GHC Trac Issues: #4012
      35d1564c
  29. 15 Jun, 2016 2 commits
    • Simon Peyton Jones's avatar
      Major patch to introduce TyConBinder · e368f326
      Simon Peyton Jones authored
      Before this patch, following the TypeInType innovations,
      each TyCon had two lists:
        - tyConBinders :: [TyBinder]
        - tyConTyVars  :: [TyVar]
      
      They were in 1-1 correspondence and contained
      overlapping information.  More broadly, there were many
      places where we had to pass around this pair of lists,
      instead of a single list.
      
      This commit tidies all that up, by having just one list of
      binders in a TyCon:
      
        - tyConBinders :: [TyConBinder]
      
      The new data types look like this:
      
        Var.hs:
           data TyVarBndr tyvar vis = TvBndr tyvar vis
           data VisibilityFlag = Visible | Specified | Invisible
           type TyVarBinder = TyVarBndr TyVar VisibilityFlag
      
        TyCon.hs:
           type TyConBinder = TyVarBndr TyVar TyConBndrVis
      
           data TyConBndrVis
             = NamedTCB VisibilityFlag
             | AnonTCB
      
        TyCoRep.hs:
           data TyBinder
             = Named TyVarBinder
             | Anon Type
      
      Note that Var.TyVarBdr has moved from TyCoRep and has been
      made polymorphic in the tyvar and visiblity fields:
      
           type TyVarBinder = TyVarBndr TyVar VisibilityFlag
              -- Used in ForAllTy
           type TyConBinder = TyVarBndr TyVar TyConBndrVis
              -- Used in TyCon
      
           type IfaceForAllBndr  = TyVarBndr IfaceTvBndr VisibilityFlag
           type IfaceTyConBinder = TyVarBndr IfaceTvBndr TyConBndrVis
               -- Ditto, in interface files
      
      There are a zillion knock-on changes, but everything
      arises from these types.  It was a bit fiddly to get the
      module loops to work out right!
      
      Some smaller points
      ~~~~~~~~~~~~~~~~~~~
      * Nice new functions
          TysPrim.mkTemplateKiTyVars
          TysPrim.mkTemplateTyConBinders
        which help you make the tyvar binders for dependently-typed
        TyCons.  See comments with their definition.
      
      * The change showed up a bug in TcGenGenerics.tc_mkRepTy, where the code
        was making an assumption about the order of the kind variables in the
        kind of GHC.Generics.(:.:).  I fixed this; see TcGenGenerics.mkComp.
      e368f326
    • 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
  30. 07 Jun, 2016 2 commits
  31. 03 Jun, 2016 1 commit
    • niteria's avatar
      Make FieldLabelEnv a deterministic set · 9cc6fac5
      niteria authored
      This lets us kill fsEnvElts function which is nondeterministic.
      We also get better guarantees than just comments.
      We don't do lookups, but I believe a set is needed for deduplication.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, mpickering, austin, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2297
      
      GHC Trac Issues: #4012
      9cc6fac5
  32. 02 Jun, 2016 1 commit
    • niteria's avatar
      Serialize vParallelTyCons in a stable order · d348acd5
      niteria authored
      nameSetElems can introduce nondeterminism and while I haven't
      observed this being a problem in practice (possibly because this
      is dead code) there's no downside to doing this.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, austin, simonpj, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2296
      
      GHC Trac Issues: #4012
      d348acd5