1. 11 Dec, 2015 9 commits
    • 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
    • Adam Gundry's avatar
      Fix infix record field fixity (#11167 and #11173). · 6e56ac58
      Adam Gundry authored
      This extends D1585 with proper support for infix duplicate record
      fields.  In particular, it is now possible to declare record fields as
      infix in a module for which `DuplicateRecordFields` is enabled, fixity
      is looked up correctly and a readable (although unpleasant) error
      message is generated if multiple fields with different fixities are in
      scope.
      
      As a bonus, `DEPRECATED` and `WARNING` pragmas now work for
      duplicate record fields. The pragma applies to all fields with the
      given label.
      
      In addition, a couple of minor `DuplicateRecordFields` bugs, which were
      pinpointed by the `T11167_ambig` test case, are fixed by this patch:
      
        - Ambiguous infix fields can now be disambiguated by putting a type
          signature on the first argument
      
        - Polymorphic type constructor signatures (such as `ContT () IO a` in
          `T11167_ambig`) now work for disambiguation
      
      Parts of this patch are from D1585 authored by @KaneTW.
      
      Test Plan: New tests added.
      
      Reviewers: KaneTW, bgamari, austin
      
      Reviewed By: bgamari
      
      Subscribers: thomie, hvr
      
      Differential Revision: https://phabricator.haskell.org/D1600
      
      GHC Trac Issues: #11167, #11173
      6e56ac58
    • Ben Gamari's avatar
      testsuite: Only run recomp015 on ELF-based platforms · ceaf0f46
      Ben Gamari authored
      It fails on OS X with hundreds of messages of the form,
      ```
      ManySections.s:196576:10: error:
           error: mach-o section specifier uses an unknown section type
      .section s65525,"",@progbits
               ^
      
      ManySections.s:196579:10: error:
           error: mach-o section specifier uses an unknown section type
      .section s65526,"",@progbits
      ```
      
      It fails on Windows with messages of the form,
      ```
      ManySections.s:196579:10: error:
           Error: junk at the end of line, first unrecognized character is ','
      ```
      
      Test Plan: Validate
      
      Reviewers: hsyl20, thomie, austin
      
      Reviewed By: thomie, austin
      
      Differential Revision: https://phabricator.haskell.org/D1601
      
      GHC Trac Issues: #11022
      ceaf0f46
    • kanetw's avatar
      Improved data family export documentation · b1382481
      kanetw authored
      Reviewers: simonpj, austin, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1587
      
      GHC Trac Issues: #11164
      b1382481
    • Ben Gamari's avatar
      Removed colon append operation (fixes #10785) · c205aebd
      Ben Gamari authored
      Reviewers: jgertm, austin, thomie
      
      Reviewed By: thomie
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1164
      
      GHC Trac Issues: #10785
      c205aebd
    • Ben Gamari's avatar
      T4801: Update expected allocations on Darwin · 262954c2
      Ben Gamari authored
      262954c2
    • Ben Gamari's avatar
      Mark retc001 as broken on Darwin · 5447c20e
      Ben Gamari authored
      Due to #11204. A relatively easy fix would be to add a one second delay as
      described in the ticket, but this seems terrible.
      5447c20e
    • Ben Gamari's avatar
      T7478: Don't expect broken on Darwin · f7c17c84
      Ben Gamari authored
      This appears to be fixed as noted by goldfire on #7478 and my own
      experience.
      f7c17c84
    • Matthew Pickering's avatar
      Make sure PatSyns only get added once to tcg_patsyns · 41ef8f70
      Matthew Pickering authored
      Summary: Before, `PatSyn`s were getting added twice to `tcg_patsyns` so
      when inspecting afterwards there were duplicates in the list.
      This makes sure that only they only get added once.
      
      Reviewers: austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1597
      41ef8f70
  2. 10 Dec, 2015 2 commits
  3. 09 Dec, 2015 4 commits
    • Gabor Greif's avatar
      More typos in comments/docs · 688069ca
      Gabor Greif authored
      688069ca
    • Simon Peyton Jones's avatar
      Improve documentation for DeriveAnyClass · 83178931
      Simon Peyton Jones authored
      c.f. Trac #9968
      83178931
    • Simon Peyton Jones's avatar
      Comments only · e9ea0209
      Simon Peyton Jones authored
      e9ea0209
    • Simon Peyton Jones's avatar
      Fix DeriveAnyClass (Trac #9968) · af77089b
      Simon Peyton Jones authored
      The main issue concerned things like
      
         data T a = MkT a deriving( C Int )
      
      which is supposed to generate
      
         instance C Int (T a) where {}
      
      But the 'Int' argument (called cls_tys in the code) wasn't
      even being passed to inferConstraints and mk_data_eqn, so it
      really had no chance.   DeriveAnyClass came along after this
      code was written!
      
      Anyway I did quite a bit of tidying up in inferConstraints.
      
      Also I discovered that this case was not covered at all
      
         data T a b = MkT a b deriving( Bifunctor )
      
      What constraints should we generate for the instance context?
      We can deal with classes whose last arg has kind *, like Eq, Ord;
      or (* -> *), like Functor, Traversable.  But we really don't have
      a story for classes whose last arg has kind (* -> * -> *).
      
      So I augmented checkSideConditions to check for that and give
      a sensible error message.
      
      ToDo: update the user manual.
      af77089b
  4. 08 Dec, 2015 14 commits
  5. 07 Dec, 2015 11 commits
    • Ömer Sinan Ağacan's avatar
      Get rid of tcView altogether · 834f9a46
      Ömer Sinan Ağacan authored
      This is just a trivial renaming that implements a ToDo mentioned in a comment
      in Type.hs.
      
      Adding Simon as reviewer since he added the ToDo comment.
      
      Reviewers: simonpj, austin, goldfire, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1584
      834f9a46
    • Herbert Valerio Riedel's avatar
      Remove redundant CPP conditionals · b292720c
      Herbert Valerio Riedel authored
      It makes little sense to have __GLASGOW_HASKELL__ conditional
      code inside GHCi's source-code, as GHCi is only ever build
      by the current stage1 GHC, whose version is assumed to be the
      same as the GHCi version being built.
      b292720c
    • Herbert Valerio Riedel's avatar
      Re-use `transformers`'s `MaybeT` rather than our own · 09333313
      Herbert Valerio Riedel authored
      The now removed `MaybeT` type was originally added back in 2008
      via bc845b71
      
      Reviewed By: bgamari
      
      Differential Revision: https://phabricator.haskell.org/D1583
      09333313
    • Ben Gamari's avatar
      rts: One more Clang-unfriendly CPP usage · 04e1c279
      Ben Gamari authored
      04e1c279
    • thomie's avatar
      ghc-pkg: don't sort packages unnecessarily · 151c4b0b
      thomie authored
      The packages in the package database are already sorted alphabetically
      by this point (see db_stack_sorted).
      
      This is a better fix for #8245, commit 021b1f89.
      
      Test Plan: look at output of './inplace/bin/ghc-pkg list
      [--simple-output]'
      
      Reviewers: austin, bgamari, psibi
      
      Reviewed By: psibi
      
      Differential Revision: https://phabricator.haskell.org/D1579
      
      GHC Trac Issues: #8245
      151c4b0b
    • Eric Seidel's avatar
      Move checking for missing signatures to RnNames.reportUnusedNames · 1bd40c86
      Eric Seidel authored
      Checking for missing signatures before renaming the export list is
      prone to errors, so we now perform the check in `reportUnusedNames` at
      which point everything has been renamed.
      
      Test Plan: validate, new test case is T10908
      
      Reviewers: goldfire, simonpj, austin, bgamari
      
      Subscribers: thomie
      
      Projects: #ghc
      
      Differential Revision: https://phabricator.haskell.org/D1561
      
      GHC Trac Issues: #10908
      1bd40c86
    • Alan Zimmerman's avatar
      Refactor ConDecl · 51a5e68d
      Alan Zimmerman authored
      The ConDecl type in HsDecls is an uneasy compromise. For the most part,
      HsSyn directly reflects the syntax written by the programmer; and that
      gives just the right "pegs" on which to hang Alan's API annotations. But
      ConDecl doesn't properly reflect the syntax of Haskell-98 and GADT-style
      data type declarations.
      
      To be concrete, here's a draft new data type
      
      ```lang=hs
      data ConDecl name
        | ConDeclGADT
            { con_names   :: [Located name]
            , con_type    :: LHsSigType name  -- The type after the ‘::’
            , con_doc     :: Maybe LHsDocString }
      
        | ConDeclH98
            { con_name    :: Located name
      
            , con_qvars     :: Maybe (LHsQTyVars name)
              -- User-written forall (if any), and its implicit
              -- kind variables
              -- Non-Nothing needs -XExistentialQuantification
      
            , con_cxt       :: Maybe (LHsContext name)
              -- ^ User-written context (if any)
      
            , con_details   :: HsConDeclDetails name
                -- ^ Arguments
      
            , con_doc       :: Maybe LHsDocString
                -- ^ A possible Haddock comment.
            } deriving (Typeable)
      ```
      
      Note that
      
          For GADTs, just keep a type. That's what the user writes.
          NB:HsType can represent records on the LHS of an arrow:
      
            { x:Int,y:Bool} -> T
      
          con_qvars and con_cxt are both Maybe because they are both
          optional (the forall and the context of an existential data type
      
          For ConDeclGADT the type variables of the data type do not scope
          over the con_type; whereas for ConDeclH98 they do scope over con_cxt
          and con_details.
      
      Updates haddock submodule.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, erikd, hvr, goldfire, austin, bgamari
      
      Subscribers: erikd, goldfire, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D1558
      
      GHC Trac Issues: #11028
      51a5e68d
    • Ryan Scott's avatar
      Use TypeLits in the meta-data encoding of GHC.Generics · 700c42b5
      Ryan Scott authored
      Test Plan: Validate.
      
      Reviewers: simonpj, goldfire, hvr, dreixel, kosmikus, austin, bgamari
      
      Reviewed By: kosmikus, austin, bgamari
      
      Subscribers: RyanGlScott, Fuuzetsu, bgamari, thomie, carter, dreixel
      
      Differential Revision: https://phabricator.haskell.org/D493
      
      GHC Trac Issues: #9766
      700c42b5
    • Ben Gamari's avatar
      rts: Remove space before argument list in ASSERTs · d4bcd05d
      Ben Gamari authored
      Test Plan: Validate
      
      Reviewers: austin, erikd
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1569
      d4bcd05d
    • roshats's avatar
      Add isImport, isDecl, and isStmt functions to GHC API · 2110037e
      roshats authored
      Reviewers: austin, thomie, bgamari
      
      Reviewed By: thomie, bgamari
      
      Subscribers: mpickering, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1518
      
      GHC Trac Issues: #9015
      2110037e
    • Ben Gamari's avatar
      Minor stylistic fixes in glasgow_exts.rst · 91e985cd
      Ben Gamari authored
      91e985cd