3 years agoA tiny, outright bug in tcDataFamInstDecl
Simon Peyton Jones [Mon, 15 Feb 2016 15:51:50 +0000 (15:51 +0000)] 
A tiny, outright bug in tcDataFamInstDecl

This bug was revealed by Trac #11362.  It turns out that in my patch
for Trac #11148 (namely 1160dc5), I failed to turn one occurrence of
tvs' into full_tvs.  Sigh.  This is tricky stuff and it cost me
several hours to page it back in and figure out what was happening.

The result was a CoAxiom whose lhs had rhs had different kinds.  Eeek!

Anyway it's fixed.

I also added an ASSERT, in FamInst.newFamInst, that trips on such
bogus CoAxioms.

3 years agoComments and white space
Simon Peyton Jones [Mon, 15 Feb 2016 15:50:24 +0000 (15:50 +0000)] 
Comments and white space

3 years agoTiny refactor; use guards instead of 'if'
Simon Peyton Jones [Mon, 15 Feb 2016 15:49:41 +0000 (15:49 +0000)] 
Tiny refactor; use guards instead of 'if'

3 years agoDocument -dynamic-too (#11488)
Simon Marlow [Mon, 15 Feb 2016 11:47:12 +0000 (11:47 +0000)] 
Document -dynamic-too (#11488)

3 years agoComments only
Simon Peyton Jones [Mon, 15 Feb 2016 08:46:36 +0000 (08:46 +0000)] 
Comments only

3 years agoImprove error message suppression
Simon Peyton Jones [Mon, 15 Feb 2016 08:39:23 +0000 (08:39 +0000)] 
Improve error message suppression

TcErrors has a system for suppressing some type errors if a more
serious one occurs.  But there was a crucial missing case, which
sometimes resulted in a cascade of irrelevant errors overwhelming
the actual cause. This was Trac #11541.

The fix is simple.  Worth merging to 8.0

3 years agoUpdate directory submodule to v1.2.5.1 release
Herbert Valerio Riedel [Sun, 14 Feb 2016 22:53:37 +0000 (23:53 +0100)] 
Update directory submodule to v1.2.5.1 release

3 years agorenamer discards name location for HsRecField
Alan Zimmerman [Sun, 14 Feb 2016 19:43:55 +0000 (21:43 +0200)] 
renamer discards name location for HsRecField

When renaming a HsVar it can be converted to a HsRecField. In the
process the location of the enclosed name is converted to a noLoc

Closes #11576

3 years agotestsuite: tweak error messages for new Show instance
Sergei Trofimovich [Fri, 12 Feb 2016 17:43:18 +0000 (17:43 +0000)] 
testsuite: tweak error messages for new Show instance

be3d7f661968a7b8c6751c0be3bf23e703b32c3e added Show
instance for Callstack.

That made a couple of error messages to drift as:

             instance Show Ordering -- Defined in ‘GHC.Show’
             instance Show Integer -- Defined in ‘GHC.Show’
    23 others
    - 20 instances involving out-of-scope types
    + 21 instances involving out-of-scope types

Signed-off-by: Sergei Trofimovich <>
3 years agoUser manual improvments
Simon Peyton Jones [Fri, 12 Feb 2016 14:38:22 +0000 (14:38 +0000)] 
User manual improvments

- Document that you can use 'forall' in instance decls

- Change the sections a bit, so that big sections (like
  lexically scoped type variables, pattern synonyms,
  implicit parameters) become more visible

3 years agoMinor refactoring to tauifyMultipleMatches
Simon Peyton Jones [Fri, 12 Feb 2016 13:44:44 +0000 (13:44 +0000)] 
Minor refactoring to tauifyMultipleMatches

No change in behaviour

3 years agoImprove pretty-printing of HsWrappers
Simon Peyton Jones [Fri, 12 Feb 2016 13:42:55 +0000 (13:42 +0000)] 
Improve pretty-printing of HsWrappers

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.)

3 years agoBeef up tc124
Simon Peyton Jones [Fri, 12 Feb 2016 13:41:39 +0000 (13:41 +0000)] 
Beef up tc124

Makes it a slightly more stringent test of record pattern bindings

3 years agoSimplify AbsBinds wrapping
Simon Peyton Jones [Fri, 12 Feb 2016 13:36:17 +0000 (13:36 +0000)] 
Simplify AbsBinds wrapping

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

And #11414 is fixed.

3 years agoRevert "Build the substitution correctly in piResultTy"
Bartosz Nitka [Fri, 12 Feb 2016 14:38:29 +0000 (06:38 -0800)] 
Revert "Build the substitution correctly in piResultTy"

This reverts commit dbf72dbc6e49b3db7f2337a7a41e95c1d0169163.
This commit introduced performance regressions:,
I will push it again after I fix it.

Test Plan: revert

Reviewers: simonpj, bgamari, simonmar, austin, goldfire, thomie

Differential Revision:

3 years agoAdd IsList instance for CallStack, restore Show instance for CallStack
RyanGlScott [Fri, 12 Feb 2016 14:24:38 +0000 (09:24 -0500)] 
Add IsList instance for CallStack, restore Show instance for CallStack

Ties up loose ends from D1894.

GHC 7.10.2 and 7.10.3 featured a `Show` instance for `CallStack`, but since it
was derived, it broke encapsulation. This adds a `Show` instance which displays
the `CallStack` as if it were a `[(String, SrcLoc)]`.

To ensure that the output of `Show` is technically a valid Haskell term, we
also add a corresponding `IsList CallStack` instance.

Reviewers: gridaphobe, austin, hvr, bgamari

Reviewed By: gridaphobe, bgamari

Subscribers: thomie

Differential Revision:

3 years agoRevert "sizeExpr: fix a bug in the size calculation"
Simon Marlow [Fri, 12 Feb 2016 09:52:21 +0000 (09:52 +0000)] 
Revert "sizeExpr: fix a bug in the size calculation"

This reverts commit 51a33924fc118d9b6c1db556c75c0d010ef95e18.

3 years agoAdd test for #11319
Reid Barton [Fri, 12 Feb 2016 02:04:17 +0000 (21:04 -0500)] 
Add test for #11319

3 years agoBuild the substitution correctly in piResultTy
Bartosz Nitka [Thu, 11 Feb 2016 17:44:53 +0000 (09:44 -0800)] 
Build the substitution correctly in piResultTy

This fixes a bug where piResultTy created
substitutions that would violate both of the invariants
in Note [The substitution invariant].

Test Plan: ./validate --slow

Reviewers: goldfire, simonpj, austin, bgamari

Reviewed By: simonpj, bgamari

Subscribers: simonmar, thomie

Differential Revision:

GHC Trac Issues: #11371

3 years agoAnother batch of typo fixes in non-code
Gabor Greif [Thu, 11 Feb 2016 11:38:21 +0000 (12:38 +0100)] 
Another batch of typo fixes in non-code

3 years agocompiler: Do not suggest nor complete deprecated flags fix trac issue #11454
Nikita Kartashov [Thu, 11 Feb 2016 10:58:30 +0000 (11:58 +0100)] 
compiler: Do not suggest nor complete deprecated flags fix trac issue #11454

Previously, all flags were present in user suggest and completion. This commit
removes the deprecated ones from there. It is done by saving deprecation info
at the moment of flag definition.

Reviewers: rwbarton, austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

Differential Revision:

3 years agosizeExpr: fix a bug in the size calculation
Simon Marlow [Wed, 10 Feb 2016 09:19:34 +0000 (09:19 +0000)] 
sizeExpr: fix a bug in the size calculation

There were two bugs here:

* We weren't ignoring Cast in size_up_app
* An application of a non-variable wasn't being charged correct

The result was that some things looked too cheap.  In my case I had
things like

    ((f x) `cast` ...) y

which was given size 21 instead of 30, and this had knock-on effects
elsewhere that caused some large code bloat.

Test Plan:
* nofib runs (todo)
* validate

Reviewers: simonpj, austin, bgamari, erikd

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11564

3 years agoIgnore untracked in nofib
Simon Marlow [Wed, 10 Feb 2016 22:23:14 +0000 (22:23 +0000)] 
Ignore untracked in nofib

3 years agoComments about ru_auto
Simon Peyton Jones [Thu, 11 Feb 2016 11:00:24 +0000 (11:00 +0000)] 
Comments about ru_auto

...following a question from Conal

3 years agoAlways do eta-reduction
Simon Peyton Jones [Thu, 11 Feb 2016 10:38:33 +0000 (10:38 +0000)] 
Always do eta-reduction

See Note [Eta-reduction in -O0] in DynFlags.

Bottom line: doing eta reduction unconditionally is benign, and
removes an ASSERT failure (Trac #11562).

3 years agoReplace mkTvSubstPrs (a `zip` b) with zipTvSubst a b
Bartosz Nitka [Wed, 10 Feb 2016 16:12:44 +0000 (08:12 -0800)] 
Replace mkTvSubstPrs (a `zip` b) with zipTvSubst a b

It's just a small cleanup. There should be no change in

Test Plan: ./validate --slow

Reviewers: austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie, simonmar

Differential Revision:

3 years agoWrap solveEqualities in checkNoErrs
Simon Peyton Jones [Wed, 10 Feb 2016 14:32:22 +0000 (14:32 +0000)] 
Wrap solveEqualities in checkNoErrs

This simple change fixes Trac #11563, #11520, #11516, #11399.
See esp the comments in #11520.

See Note [Fail fast on kind errors] in TcSimplify

Merge to 8.0 branch

3 years agomkUserGuide: fix option wrapping in a table
Sergei Trofimovich [Wed, 10 Feb 2016 14:12:03 +0000 (14:12 +0000)] 
mkUserGuide: fix option wrapping in a table

Noticed as a sphinx warning:
        WARNING: Inline interpreted text or phrase
        reference start-string without end-string.

Which pointed to broken table.

Before the patch table looked like:

    | :ghc-flag:`-Wno-unticked-promoted-constructors |
    | `                                              |

After the patch long link is on a single line:

    | :ghc-flag:`-Wno-unticked-promoted-constructors`    |

Signed-off-by: Sergei Trofimovich <>
3 years agodocs: add newline after '.. ghc-flag::'
Sergei Trofimovich [Wed, 10 Feb 2016 14:10:03 +0000 (14:10 +0000)] 
docs: add newline after '.. ghc-flag::'

Noticed when looked through sphinx warnings:
        SEVERE: Duplicate ID: "ghc-flag-Issue"

Signed-off-by: Sergei Trofimovich <>
3 years agoError early when you register with too old a version of Cabal.
Edward Z. Yang [Wed, 10 Feb 2016 10:09:53 +0000 (11:09 +0100)] 
Error early when you register with too old a version of Cabal.

On the GHC 8.0 RCs, multiple users reported a very strange error
whereby GHC would complain that the symbols names recorded in interface
files did not match the expected name.  The reason for this is
that they were using an old version of Cabal which chose symbol
names differently from the installed package ID ('id' field) which
the package was to be installed with; GHC 8.0 now mandates that
these coincides.

This change adds a test to ghc-pkg to make sure that 'id' and 'key'
(which is how Cabal previously reported what the symbol name
was supposed to be) match; if they don't match or key is missing,
we assume that the Cabal was too old.

Bikeshed points:

    - Should we offer more information about how to upgrade
      Cabal correctly (i.e. specify a version?)

    - Should we allow for a missing 'key'?  If we allow for
      'key' to be missing, we lose the ability to detect
      Cabal from GHC 7.8 or earlier being used.  If we
      require it to be specified, then it will not be possible
      for Cabal to deprecate the (unused) field and remove it
      without having BC for 8.0.

Signed-off-by: Edward Z. Yang <>
Test Plan: validate

Reviewers: austin, bgamari, hvr

Reviewed By: hvr

Subscribers: bergmark, thomie

Differential Revision:

GHC Trac Issues: #11558

3 years agoExpand users' guide TH declaration groups section (#9813)
Owen Stephens [Wed, 10 Feb 2016 09:18:41 +0000 (10:18 +0100)] 
Expand users' guide TH declaration groups section (#9813)

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

3 years agoadd Template Haskell regression test for #9022.
Dominik Bollmann [Wed, 10 Feb 2016 09:18:29 +0000 (10:18 +0100)] 
add Template Haskell regression test for #9022.

The bug itself has already been fixed in #10734, so this
only adds another regression test (as given in the ticket).

Test Plan: ./validate

Reviewers: goldfire, austin, thomie, bgamari

Reviewed By: bgamari

Differential Revision:

GHC Trac Issues: #9022

3 years agoDynFlags: drop tracking of '-#include' flags
Sergei Trofimovich [Sun, 3 Jan 2016 12:07:10 +0000 (12:07 +0000)] 
DynFlags: drop tracking of '-#include' flags

GHC does not use passed paramaters anywhere
for this deprecated option.

Signed-off-by: Sergei Trofimovich <>
3 years agoTcPatSyn: Fix spelling of "pattern" in error message
Ben Gamari [Tue, 9 Feb 2016 13:42:01 +0000 (14:42 +0100)] 
TcPatSyn: Fix spelling of "pattern" in error message

3 years agoTcErrors: Fix plural form of "instance" error
Ben Gamari [Tue, 9 Feb 2016 13:39:39 +0000 (14:39 +0100)] 
TcErrors: Fix plural form of "instance" error

Previously "types" was inappropriately made plural instead of

    instance Eq Ordering -- Defined in ‘GHC.Classes’ 24 others 13 instance involving out-of-scope typess

3 years agoRestore derived Eq instance for SrcLoc
RyanGlScott [Tue, 9 Feb 2016 10:06:34 +0000 (11:06 +0100)] 
Restore derived Eq instance for SrcLoc

GHC 7.10.2 and 7.10.3 had a derived `Eq` instance for `SrcLoc`, but it
seems to have been removed (see
6740d70d95cb81cea3859ff847afc61ec439db4f) during GHC 8.0 development.

Reviewers: hvr, austin, gridaphobe, bgamari

Reviewed By: gridaphobe, bgamari

Subscribers: thomie

Differential Revision:

3 years agoUnset GREP_OPTIONS in build system
Ben Gamari [Tue, 9 Feb 2016 10:06:27 +0000 (11:06 +0100)] 
Unset GREP_OPTIONS in build system

Test Plan: GREP_OPTIONS=--blah ./validate

Reviewers: austin, thomie

Reviewed By: thomie

Differential Revision:

GHC Trac Issues: #11530

3 years agoEarly error when crosscompiling + haddock/docs
Thomas Miedema [Tue, 9 Feb 2016 10:06:13 +0000 (11:06 +0100)] 
Early error when crosscompiling + haddock/docs

When CrossCompiling=YES or Stage1Only=YES, building the haddocks and the
User's Guide should be skipped, because haddock and mkUserGuidePart
depend on the GHC API.
See Note [No stage2 packages when CrossCompiling or Stage1Only] for

There are several places in the build system where the variables
HADDOCK_DOCS and BUILD_SPHINX_* are checked. Instead of also checking
for the variables CrossCompiling or Stage1Only in all those places,
`make` will now exit with a nice error message when the user requests
the impossible.

Reviewers: rwbarton, austin, bgamari

Reviewed By: bgamari

Differential Revision:

3 years agoFix the removal of unnecessary stack checks
Jonas Scholl [Tue, 9 Feb 2016 10:06:00 +0000 (11:06 +0100)] 
Fix the removal of unnecessary stack checks

The module CmmLayoutStack removes stack checks if a function does not
use stack space. However, it can only recognize checks of the form
Sp < SpLim. However, these checks get sometimes rewritten to
Sp >= SpLim (with both branches swapped), so we better recognize these
checks too.

Test Plan: ./validate

Reviewers: austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, thomie

Differential Revision:

GHC Trac Issues: #11533

3 years agotestsuite: Un-break T5642
Ben Gamari [Mon, 8 Feb 2016 16:44:44 +0000 (17:44 +0100)] 
testsuite: Un-break T5642

This was largely fixed by the re-rework of the pattern match checker.
Resolves #5642.

3 years agoPrint * has Unicode star with -fprint-unicode-syntax
Ben Gamari [Mon, 8 Feb 2016 15:29:04 +0000 (16:29 +0100)] 
Print * has Unicode star with -fprint-unicode-syntax

Reviewers: austin, thomie

Subscribers: thomie

Differential Revision:

3 years agoRemove unused LiveVars and SRT fields of StgCase
Ömer Sinan Ağacan [Mon, 8 Feb 2016 21:18:23 +0000 (16:18 -0500)] 
Remove unused LiveVars and SRT fields of StgCase

We also need to update `stgBindHasCafRefs` assertion with this change,
as we no longer have the pre-computed SRT, LiveVars etc. We rename it to
`topStgBindHasCafRefs` and implement it like this:

A non-updatable top-level binding may refer to a CAF by referring to a
top-level definition with CAFs. A top-level definition may have CAFs if
it's updatable. At this point (because this is done after TidyPgm)
top-level Ids (whether imported or defined in this module) are
GlobalIds, so the top-levelness test is easy. (see also comments in the

Reviewers: bgamari, simonpj, austin

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11550

3 years agoDefine tyConRolesRepresentational and use it
Simon Peyton Jones [Mon, 8 Feb 2016 17:41:58 +0000 (17:41 +0000)] 
Define tyConRolesRepresentational and use it

tyConRolesRepresentational is just a version of tyConRolesX, but
specialised for a Representational argument. Saves a bit of extra
argument passing and pattern matching, and tyConRolesX was often
called when we knew the argument role was Representational.

Rather to my surprise this made the compiler allocate 5% less
for tests T9872{b,c,d}.  At least I think it's this commit.
Good thing, regardless.

3 years agoTest Trac #11552
Simon Peyton Jones [Mon, 8 Feb 2016 17:38:26 +0000 (17:38 +0000)] 
Test Trac #11552

3 years agoDefine mkTvSubst, and use it
Simon Peyton Jones [Mon, 8 Feb 2016 17:36:52 +0000 (17:36 +0000)] 
Define mkTvSubst, and use it

   mkTvSubst :: InScopeSet -> TvSubstEnv -> TCvSubst
produces a TCvSubst with an empty CvSubstEnv

3 years agoSome tiding up in TcGenDeriv
Simon Peyton Jones [Mon, 8 Feb 2016 15:29:12 +0000 (15:29 +0000)] 
Some tiding up in TcGenDeriv

..around newtype deriving instances.

See esp the new Note [Newtype-deriving instances]

No change in behaviour

3 years agorelease notes: Note new two-step allocator
Ben Gamari [Mon, 8 Feb 2016 14:51:55 +0000 (15:51 +0100)] 
release notes: Note new two-step allocator

3 years agoFix a nasty superclass expansion bug
Simon Peyton Jones [Mon, 8 Feb 2016 14:41:08 +0000 (14:41 +0000)] 
Fix a nasty superclass expansion bug

This patch fixes Trac #11523.

* The basic problem was that TcRnTypes.superClassesMightHelp was
  returning True of a Derived constraint, and that led to us
  expanding Given superclasses, which produced the same Derived
  constraint again, and so on infinitely.  We really want to do
  this only if there are unsolve /Wanted/ contraints!

* On the way I made TcSMonad.getUnsolvedInerts a bit more
  discriminating about which Derived equalities it returns;
  see Note [Unsolved Derived equalities] in TcSMonad

* Lots of new comments in TcSMonad.

3 years agoA small, local refactoring of TcSimplify.usefulToFloat
Simon Peyton Jones [Mon, 8 Feb 2016 13:38:09 +0000 (13:38 +0000)] 
A small, local refactoring of TcSimplify.usefulToFloat

3 years agoUse runTcSDeriveds for simplifyDefault
Simon Peyton Jones [Mon, 8 Feb 2016 13:36:31 +0000 (13:36 +0000)] 
Use runTcSDeriveds for simplifyDefault

This is a small refactoring, no change in behaviour.

3 years agoImprove error messages for recursive superclasses
Simon Peyton Jones [Mon, 8 Feb 2016 13:31:11 +0000 (13:31 +0000)] 
Improve error messages for recursive superclasses

If we fail to typecheck by blowing the constraint simplifier
iteration limit, we want to see the limit-blowing meessage.
Previously it was being suppressed by the type /error/, which
suppress the iteration-limit /warning/.  Solution: make the
iteration-limit message into an error.

3 years agoImprove tracing in TcInteract
Simon Peyton Jones [Mon, 8 Feb 2016 13:18:35 +0000 (13:18 +0000)] 
Improve tracing in TcInteract

3 years agoComment out some traceFlat calls
Simon Peyton Jones [Mon, 8 Feb 2016 13:17:15 +0000 (13:17 +0000)] 
Comment out some traceFlat calls

They were excessively verbose.  I've commented them out rather than
deleting so that they can easily be restored.

3 years agoDocument and improve superclass expansion
Simon Peyton Jones [Mon, 8 Feb 2016 13:14:02 +0000 (13:14 +0000)] 
Document and improve superclass expansion

When investigating Trac #11523 I found that superclass
expansion was a little over-aggressive; we were sort of
unrolling each loop twice.

This patch corrects that, and adds explanatory comments.

3 years agoWhite space and comments only
Simon Peyton Jones [Thu, 4 Feb 2016 13:02:17 +0000 (13:02 +0000)] 
White space and comments only

3 years agoAdd comments to TcCoercibleFail
Simon Peyton Jones [Thu, 4 Feb 2016 13:00:22 +0000 (13:00 +0000)] 
Add comments to TcCoercibleFail

Flag up the problem highlighted in Trac #11518 comment:15

3 years agoComments only, on the invariants of GlobalRdrEnv
Simon Peyton Jones [Mon, 1 Feb 2016 14:01:34 +0000 (14:01 +0000)] 
Comments only, on the invariants of GlobalRdrEnv

3 years agoAdd Edward Kmett's example as a test case
Simon Peyton Jones [Mon, 1 Feb 2016 13:59:11 +0000 (13:59 +0000)] 
Add Edward Kmett's example as a test case

This is a more stressful example of T11480.

3 years agouser-guide: Add cross-reference for -XUnicodeSyntax
Ben Gamari [Sun, 7 Feb 2016 23:13:50 +0000 (00:13 +0100)] 
user-guide: Add cross-reference for -XUnicodeSyntax

3 years agoFix SimpleFail12 error output
Simon Peyton Jones [Mon, 8 Feb 2016 10:13:28 +0000 (10:13 +0000)] 
Fix SimpleFail12 error output

I missed this on my previous commit, somehow
   2cf3ca Allow foralls in instance decls

3 years agoAllow foralls in instance decls
Simon Peyton Jones [Mon, 8 Feb 2016 09:05:12 +0000 (09:05 +0000)] 
Allow foralls in instance decls

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.

3 years agoRemove unused export from TcUnify
Simon Peyton Jones [Thu, 28 Jan 2016 22:43:38 +0000 (22:43 +0000)] 
Remove unused export from TcUnify

..namely buildImplication.

Plus white space in TcDeriv

3 years agoBump haddock submodule
Ben Gamari [Sun, 7 Feb 2016 22:39:49 +0000 (23:39 +0100)] 
Bump haddock submodule

3 years agoFix haddocks for TypeError
Ben Gamari [Sun, 7 Feb 2016 21:40:24 +0000 (22:40 +0100)] 
Fix haddocks for TypeError

3 years agorts: mark 'shutdownCapability' as static
Sergei Trofimovich [Sun, 7 Feb 2016 18:39:33 +0000 (18:39 +0000)] 
rts: mark 'shutdownCapability' as static

Noticed by uselex.rb:
    last_free_capability: [R]: exported from:
    shutdownCapability: [R]: exported from:

Signed-off-by: Sergei Trofimovich <>
3 years agorts: drop unused 'traceEventThreadRunnable'
Sergei Trofimovich [Sun, 7 Feb 2016 18:16:10 +0000 (18:16 +0000)] 
rts: drop unused 'traceEventThreadRunnable'

Not used since:

    commit f361281c89fbce42865d8b8b27b0957205366186
    Author: Simon Marlow <>
    Date:   Wed Dec 7 11:32:35 2011 +0000

        Do not emit the THREAD_RUNNABLE event; it has no useful semantic content

Noticed by uselex.rb:
    traceEventThreadRunnable: [R]: exported from:

Signed-off-by: Sergei Trofimovich <>
3 years agorts: mark 'ccs_mutex' and 'prof_arena' as static
Sergei Trofimovich [Sun, 7 Feb 2016 18:00:00 +0000 (18:00 +0000)] 
rts: mark 'ccs_mutex' and 'prof_arena' as static

Noticed by uselex.rb:
    ccs_mutex: [R]: exported from:
    prof_arena: [R]: exported from:

Signed-off-by: Sergei Trofimovich <>
3 years agorts: mark 'blockedThrowTo' as static
Sergei Trofimovich [Sun, 7 Feb 2016 17:58:59 +0000 (17:58 +0000)] 
rts: mark 'blockedThrowTo' as static

Noticed by uselex.rb:
    blockedThrowTo: [R]: exported from:

Signed-off-by: Sergei Trofimovich <>
3 years agorts: drop unused 'traverseAllRetainerSet'
Sergei Trofimovich [Sun, 7 Feb 2016 17:55:56 +0000 (17:55 +0000)] 
rts: drop unused 'traverseAllRetainerSet'

While at is mark 'printRetainer' as 'static'.

Noticed by uselex.rb:
    printRetainer: [R]: exported from:
    traverseAllRetainerSet: [R]: exported from:

Signed-off-by: Sergei Trofimovich <>
3 years agorts: mark 'setProgName' as static
Sergei Trofimovich [Sun, 7 Feb 2016 17:36:55 +0000 (17:36 +0000)] 
rts: mark 'setProgName' as static

Noticed by uselex.rb:
    setProgName: [R]: exported from:

Signed-off-by: Sergei Trofimovich <>
3 years agorts: mark 'removeFromRunQueue' as static
Sergei Trofimovich [Sun, 7 Feb 2016 17:33:02 +0000 (17:33 +0000)] 
rts: mark 'removeFromRunQueue' as static

Noticed by uselex.rb:
    removeFromRunQueue: [R]: exported from:

Signed-off-by: Sergei Trofimovich <>
3 years agorts: drop unused mut_user_time_during_heap_census
Sergei Trofimovich [Sun, 7 Feb 2016 17:23:36 +0000 (17:23 +0000)] 
rts: drop unused mut_user_time_during_heap_census

Was never used looking at history available in git.

While at it marked 'mut_user_time_during_RP' as 'static'.

Noticed by uselex.rb:
    mut_user_time_during_heap_census: [R]: exported from:

Signed-off-by: Sergei Trofimovich <>
3 years agorts: mark 'wakeBlockingQueue' as static
Sergei Trofimovich [Sun, 7 Feb 2016 17:14:37 +0000 (17:14 +0000)] 
rts: mark 'wakeBlockingQueue' as static

Noticed by uselex.rb:
    wakeBlockingQueue: [R]: exported from:

Signed-off-by: Sergei Trofimovich <>
3 years agorts: drop unused getThreadCPUTime
Sergei Trofimovich [Sun, 7 Feb 2016 16:59:03 +0000 (16:59 +0000)] 
rts: drop unused getThreadCPUTime

Use of this helper function was removed in:

    commit 3c9fc104337a142fe4f375d30d7a6b81d55a70c1
    Author: Brian Brooks <>
    Date:   Thu Jul 10 02:55:33 2014 -0500

        Avoid unnecessary clock_gettime() syscalls in GC stats.

Noticed by uselex.rb:
    getThreadCPUTime: [R]: exported from:

Signed-off-by: Sergei Trofimovich <>
3 years agorts: mark 'copied' as static
Sergei Trofimovich [Sun, 7 Feb 2016 16:41:06 +0000 (16:41 +0000)] 
rts: mark 'copied' as static

Noticed by uselex.rb:
    copied: [R]: exported from:

Signed-off-by: Sergei Trofimovich <>
3 years agorts: mark scavenge_mutable_list as static
Sergei Trofimovich [Sun, 7 Feb 2016 16:08:56 +0000 (16:08 +0000)] 
rts: mark scavenge_mutable_list as static

Noticed by uselex.rb:
    scavenge_mutable_list: [R]: exported from:
    scavenge_mutable_list1: [R]: exported from:

Signed-off-by: Sergei Trofimovich <>
3 years agorts: drop unused calcLiveBlocks, calcLiveWords
Sergei Trofimovich [Sun, 7 Feb 2016 15:55:44 +0000 (15:55 +0000)] 
rts: drop unused calcLiveBlocks, calcLiveWords

Use of these helper functions was removed by
  commit 18896fa2b06844407fd1e0d3f85cd3db97a96ff4
  Author: Simon Marlow <>
  Date:   Wed Feb 2 15:49:55 2011 +0000

Noticed by uselex.rb:
    calcLiveBlocks: [R]: exported from:
    calcLiveWords: [R]: exported from:

Signed-off-by: Sergei Trofimovich <>
3 years agovalidate: enable -DDEBUG in stage 1 by default
Ömer Sinan Ağacan [Sun, 7 Feb 2016 18:14:44 +0000 (13:14 -0500)] 
validate: enable -DDEBUG in stage 1 by default

Since the whole point of validation is to test the compiler, assertions
should be enabled at least for some part of the build. Previously
assertions were only enabled (1) in stage 2 compiler (2) when "slow"
setting is used. With this patch we enable assertions in stage 1
compiler in all settings, to test them on (1) the compiler itself (2)
the libraries, even with the "fast" setting.

This will make "fast" setting slower, but the difference should be quite
modest - I didn't realize a significant difference in validation times.

Reviewers: bgamari, austin, thomie

Reviewed By: thomie

Differential Revision:

3 years agomkDocs: Fix fallout from c5f4f95c64006a9f
Ben Gamari [Sun, 7 Feb 2016 15:40:31 +0000 (10:40 -0500)] 
mkDocs: Fix fallout from c5f4f95c64006a9f

Fixes #11419

3 years agomkDocs: Update for xz
Ben Gamari [Sun, 7 Feb 2016 15:40:02 +0000 (10:40 -0500)] 
mkDocs: Update for xz

Fixes #11419.

3 years agotestsuite: ignore *.prof.normalised files
Sergei Trofimovich [Sun, 7 Feb 2016 15:00:47 +0000 (15:00 +0000)] 
testsuite: ignore *.prof.normalised files

Signed-off-by: Sergei Trofimovich <>
3 years agohp2ps: mark local functions as 'static'
Sergei Trofimovich [Sun, 7 Feb 2016 09:29:55 +0000 (09:29 +0000)] 
hp2ps: mark local functions as 'static'

Found by uselex.rb:
    fonttab: [R]: exported from: ./utils/hp2ps/dist/build/Dimensions.o
    GetString: [R]: exported from: ./utils/hp2ps/dist/build/HpFile.o
    thestring: [R]: exported from: ./utils/hp2ps/dist/build/HpFile.o
    auxfp: [R]: exported from: ./utils/hp2ps/dist/build/Main.o
    dflag: [R]: exported from: ./utils/hp2ps/dist/build/Main.o
    filter: [R]: exported from: ./utils/hp2ps/dist/build/Main.o
    iflag: [R]: exported from: ./utils/hp2ps/dist/build/Main.o
    mflag: [R]: exported from: ./utils/hp2ps/dist/build/Main.o
    pflag: [R]: exported from: ./utils/hp2ps/dist/build/Main.o
    psfile: [R]: exported from: ./utils/hp2ps/dist/build/Main.o
    tflag: [R]: exported from: ./utils/hp2ps/dist/build/Main.o
    OrderOf: [R]: exported from: ./utils/hp2ps/dist/build/Reorder.o

Signed-off-by: Sergei Trofimovich <>
3 years agounlit: mark local functions as 'static'
Sergei Trofimovich [Sun, 7 Feb 2016 09:10:54 +0000 (09:10 +0000)] 
unlit: mark local functions as 'static'

Found by uselex.rb:
    complain: [R]: exported from: ./utils/unlit/dist/build/unlit.o
    egetc: [R]: exported from: ./utils/unlit/dist/build/unlit.o
    myputc: [R]: exported from: ./utils/unlit/dist/build/unlit.o
    readline: [R]: exported from: ./utils/unlit/dist/build/unlit.o
    unlit: [R]: exported from: ./utils/unlit/dist/build/unlit.o
    writeerror: [R]: exported from: ./utils/unlit/dist/build/unlit.o

Signed-off-by: Sergei Trofimovich <>
3 years agoRevert "Remove unused LiveVars and SRT fields of StgCase and StgLetNoEscape"
Ömer Sinan Ağacan [Sun, 7 Feb 2016 01:09:27 +0000 (20:09 -0500)] 
Revert "Remove unused LiveVars and SRT fields of StgCase and StgLetNoEscape"

This reverts commit 4f9967aa3d1f7cfd539d0c173cafac0fe290e26f.

3 years agoAdd test for #11516
Ben Gamari [Sat, 6 Feb 2016 14:16:15 +0000 (15:16 +0100)] 
Add test for #11516

3 years agoAdd a derived `Show SrcLoc` instance
Eric Seidel [Sat, 6 Feb 2016 13:16:53 +0000 (14:16 +0100)] 
Add a derived `Show SrcLoc` instance

Test Plan:
ghci> import GHC.Stack
ghci> SrcLoc "f" "b" "c" 1 2 3 4
SrcLoc {srcLocPackage = "f", srcLocModule = "b", srcLocFile = "c",
srcLocStartLine = 1, srcLocStartCol = 2, srcLocEndLine = 3,
srcLocEndCol = 4}

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie

Projects: #ghc

Differential Revision:

GHC Trac Issues: #11510

3 years agoFix @since annotations for renamed pretty{CallStack,SrcLoc}
Herbert Valerio Riedel [Sat, 6 Feb 2016 10:33:14 +0000 (11:33 +0100)] 
Fix @since annotations for renamed pretty{CallStack,SrcLoc}

3 years agoGHCi: Fix Windows build (again)
Ben Gamari [Fri, 5 Feb 2016 15:11:01 +0000 (16:11 +0100)] 
GHCi: Fix Windows build (again)

GHC.Conc exports Shutdown

3 years agoUse default xz compression level
Ben Gamari [Fri, 5 Feb 2016 12:37:05 +0000 (13:37 +0100)] 
Use default xz compression level

-9e is crazy expensive for very little pay-off. See
for details.

3 years agoRemove unused LiveVars and SRT fields of StgCase and StgLetNoEscape
Ömer Sinan Ağacan [Thu, 4 Feb 2016 21:22:48 +0000 (16:22 -0500)] 
Remove unused LiveVars and SRT fields of StgCase and StgLetNoEscape

Also remove the functions and types that became useless after removing
the fields:

- SRT functions
- LiveInfo type and functions
- freeVarsToLiveVars
- unariseLives and unariseSRT

Reviewers: bgamari, simonpj, austin

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

3 years agoFix a few loose ends from D1795
Ben Gamari [Thu, 4 Feb 2016 09:46:28 +0000 (10:46 +0100)] 
Fix a few loose ends from D1795

George updated the Diff but I didn't noticed until it was too late.

3 years agoOverhaul the Overhauled Pattern Match Checker
George Karachalias [Wed, 3 Feb 2016 18:06:45 +0000 (19:06 +0100)] 
Overhaul the Overhauled Pattern Match Checker

Overhaul the Overhauled Pattern Match Checker

* Changed the representation of Value Set Abstractions. Instead of
using a prefix tree, we now use a list of Value Vector Abstractions.
The set of constraints Delta for every Value Vector Abstraction is the
oracle state so that we solve everything only once.

* Instead of doing everything lazily, we prune at once (and in general
everything is much stricter). Hence, an example written with pattern
guards is checked in almost the same time as the equivalent with
pattern matching.

* Do not store the covered and the divergent sets at all. Since what we
only need is a yes/no (does this clause cover anything? Does it force
any thunk?) We just keep a boolean for each.

* Removed flags `-Wtoo-many-guards` and `-ffull-guard-reasoning`.
Replaced with `fmax-pmcheck-iterations=n`. Still debatable what should
the default `n` be.

* When a guard is for sure not going to contribute anything, we treat
it as such: The oracle is not called and cases `CGuard`, `UGuard` and
`DGuard` from the paper are not happening at all (the generation of a
fresh variable, the unfolding of the pattern list etc.). his combined
with the above seems to be enough to drop the memory increase for test
T783 down to 18.7%.

* Do not export function `dsPmWarn` (it is now called directly from
within `checkSingle` and `checkMatches`).

* Make `PmExprVar` hold a `Name` instead of an `Id`. The term oracle
does not handle type information so using `Id` was a waste of

* Added testcases T11195, T11303b (data families) and T11374

The patch addresses at least the following:
Trac #11195, #11276, #11303, #11374, #11162

Test Plan: validate

Reviewers: goldfire, bgamari, hvr, austin

Subscribers: simonpj, thomie

Differential Revision:

3 years agoAllow all RTS options to iserv
Simon Marlow [Wed, 3 Feb 2016 15:33:40 +0000 (07:33 -0800)] 
Allow all RTS options to iserv

3 years agoUpdate binary submodule to release
Herbert Valerio Riedel [Tue, 2 Feb 2016 21:43:06 +0000 (22:43 +0100)] 
Update binary submodule to release

3 years agoUpdate cabal_macros_boot.h
Herbert Valerio Riedel [Tue, 2 Feb 2016 21:07:05 +0000 (22:07 +0100)] 
Update cabal_macros_boot.h

the MIN_VERSION_bytestring() macro is going to be needed
for the upcoming binary update

3 years agoTcMType: Add some elementary notes
Ben Gamari [Tue, 2 Feb 2016 13:50:22 +0000 (14:50 +0100)] 
TcMType: Add some elementary notes

It's astoundingly difficult to find a good description of zonking. Given
that there is a Stack Overflow question on the matter, I'm clearly not
the only one who feels this way. Hopefully this will clarify the issue.

Test Plan: Read it

Reviewers: goldfire, austin, simonpj

Subscribers: thomie

Differential Revision:

3 years agoAdd (failing) test for #11247
Thomas Miedema [Mon, 21 Dec 2015 16:23:21 +0000 (17:23 +0100)] 
Add (failing) test for #11247

3 years agoMake TypeError a newtype, add changelog entry
RyanGlScott [Tue, 2 Feb 2016 14:03:04 +0000 (09:03 -0500)] 
Make TypeError a newtype, add changelog entry

Phab:D866 added the `TypeError` datatype to `Control.Exception` to represent
the error that is thrown when `-fdefer-type-errors` is on, but a changelog
entry for it was never added. In addition, it should probably be a

Reviewers: austin, hvr, KaneTW, bgamari

Reviewed By: KaneTW, bgamari

Subscribers: thomie, KaneTW

Differential Revision:

GHC Trac Issues: #10284

3 years agoUse a correct substitution in tcCheckPatSynDecl
Bartosz Nitka [Tue, 2 Feb 2016 13:02:23 +0000 (05:02 -0800)] 
Use a correct substitution in tcCheckPatSynDecl

The `substTheta` call didn't have the free variables of the
`prov_theta` in the `in_scope` set. It should be enough to add
`univ_tvs`, as all the `ex_tvs` are already in the domain of
the substitution.

Test Plan: added a testcase

Reviewers: simonpj, bgamari, goldfire, austin

Reviewed By: simonpj, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11524

3 years agoFix Windows build after D1874
Tamar Christina [Tue, 2 Feb 2016 11:36:52 +0000 (12:36 +0100)] 
Fix Windows build after D1874

Windows uses wchar_t* for paths. The code committed won't compile for
Windows as the types are incorrect and the types in the branches of the
ternary operator aren't consistent.

Test Plan: ./validate --fast

Reviewers: austin, rwbarton, erikd, bgamari

Subscribers: thomie

Differential Revision: