4 years agoMake derived names deterministic
Bartosz Nitka [Tue, 22 Sep 2015 00:30:41 +0000 (19:30 -0500)] 
Make derived names deterministic

The names of auxiliary bindings end up in the interface file, and since uniques
are nondeterministic, we end up with nondeterministic interface files.

This uses the package and module name in the generated name, so I believe it
should avoid problems from #7947 and be deterministic as well.

The generated names look like this now:


and with `-ppr-debug`:


Reviewed By: simonmar, austin, ezyang

Differential Revision:

GHC Trac Issues: #4012

4 years agobase: use Show for ErrorCall in uncaughtExceptionHandler
Eric Seidel [Tue, 22 Sep 2015 00:18:56 +0000 (19:18 -0500)] 
base: use Show for ErrorCall in uncaughtExceptionHandler

The default top-level exception handler now uses the `Show` instance for
`ErrorCall` when printing exceptions, so it will actually print the out-of-band
data (e.g. `CallStack`s) in compiled binaries, instead of just printing the
error message.

This also updates the hpc submodule to fix the test output.

Reviewed By: austin, thomie

Differential Revision:

4 years agoRemove (now bogus) assert.
Edward Z. Yang [Mon, 21 Sep 2015 22:46:09 +0000 (15:46 -0700)] 
Remove (now bogus) assert.

Signed-off-by: Edward Z. Yang <>
4 years agoTcDeriv: Use a NameEnv instead of association list
Ben Gamari [Mon, 21 Sep 2015 21:52:23 +0000 (16:52 -0500)] 
TcDeriv: Use a NameEnv instead of association list

It's unlikely that these lists would have become very large but
nevertheless this is an easy and worthwhile change.

Reviewed By: austin

Differential Revision:

4 years agoRemove graphFromVerticesAndAdjacency
Bartosz Nitka [Mon, 21 Sep 2015 21:52:10 +0000 (16:52 -0500)] 
Remove graphFromVerticesAndAdjacency

It's not used anywhere.

Reviewed By: austin

Differential Revision:

4 years agoFix build failure, I think.
Edward Z. Yang [Mon, 21 Sep 2015 20:20:07 +0000 (13:20 -0700)] 
Fix build failure, I think.

Signed-off-by: Edward Z. Yang <>
4 years agoUnify hsig and hs-boot; add preliminary "hs-boot" merging.
Edward Z. Yang [Fri, 24 Jul 2015 22:13:49 +0000 (15:13 -0700)] 
Unify hsig and hs-boot; add preliminary "hs-boot" merging.

This patch drops the file level distinction between hs-boot and hsig;
we figure out which one we are compiling based on whether or not there
is a corresponding hs file lying around.

To make the "import A" syntax continue to work for bare hs-boot
files, we also introduce hs-boot merging, which takes an A.hi-boot
and converts it to an A.hi when there is no A.hs file in scope.
This will be generalized in Backpack to merge multiple A.hi files together;
which means we can jettison the "load multiple interface files" functionality.

This works automatically for --make, but for one-shot compilation
we need a new mode: ghc --merge-requirements A will generate an A.hi/A.o
from a local A.hi-boot file; Backpack will extend this mechanism further.

Has Haddock submodule update to deal with change in msHsFilePath behavior.

    - This commit drops support for the hsig extension. Can
      we support it?  It's annoying because the finder code is
      written with the assumption that where there's an hs-boot
      file, there's always an hs file too.  To support hsig, you'd
      have to probe two locations.  Easier to just not support it.

    - #10333 affects us, modifying an hs-boot still doesn't trigger

    - See compiler/main/Finder.hs: this diff is very skeevy, but
      it seems to work.

    - This code cunningly doesn't drop hs-boot files from the
      "drop hs-boot files" module graph, if they don't have a
      corresponding hs file.  I have no idea if this actually is useful.

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

Reviewers: simonpj, austin, bgamari, spinda

Subscribers: thomie

Differential Revision:

4 years agoRevert "Revert "Revert "Change loadSrcInterface to return a list of ModIface"""
Edward Z. Yang [Sat, 12 Sep 2015 00:15:52 +0000 (17:15 -0700)] 
Revert "Revert "Revert "Change loadSrcInterface to return a list of ModIface"""

This reverts commit 0c6c015d42c2bd0ee008f790c7c0cb4c5b78ca6b.

4 years agoRevert "Revert "Revert "Support for multiple signature files in scope."""
Edward Z. Yang [Sat, 12 Sep 2015 00:13:30 +0000 (17:13 -0700)] 
Revert "Revert "Revert "Support for multiple signature files in scope."""

This reverts commit 214596de224afa576a9c295bcf53c6941d6892e0.

4 years ago`_ <- mapM` --> `mapM_`
Richard Eisenberg [Mon, 21 Sep 2015 16:25:37 +0000 (12:25 -0400)] 
`_ <- mapM` --> `mapM_`

Thanks for the suggestion, Austin. Just missed that while making
a bunch of similar changes.

4 years agoRefactor BranchLists.
Richard Eisenberg [Sun, 20 Sep 2015 03:59:22 +0000 (23:59 -0400)] 
Refactor BranchLists.

Now we use Array to store branches. This makes sense because we often
have to do random access (once inference is done). This also vastly
simplifies the awkward BranchList type.

This fixes #10837 and updates submodule utils/haddock.

4 years agoRun simplifier only when the env is clean.
Richard Eisenberg [Sun, 20 Sep 2015 20:15:13 +0000 (16:15 -0400)] 
Run simplifier only when the env is clean.

This fixes #10896. In the indexed-types/should_fail/BadSock test,
there is a bad type definition. This gets type-checked, an error
gets reported, but then **GHC keeps going**. Later, when
running the simplifier to do an ambiguity check, the bad type
environment causes GHC to fall over. My solution: only run the
simplifier in a clean, error-free type environment.

A downside of this is that fewer error messages are reported.
This makes me a bit sad, but I'm not sure how to avoid the problem.
Suggestions welcome.

4 years agoPerform a validity check on assoc type defaults.
Richard Eisenberg [Sat, 19 Sep 2015 18:32:44 +0000 (14:32 -0400)] 
Perform a validity check on assoc type defaults.

This fixes #10817 and #10899. A knock-on effect is that we must
now remember locations of associated type defaults for error
messages during validity checking. This isn't too bad, but it
increases the size of the diff somewhat.

Test cases: indexed-types/should_fail/T108{17,99}

4 years agoSlightly better `Coercible` errors.
Richard Eisenberg [Sun, 20 Sep 2015 21:39:17 +0000 (17:39 -0400)] 
Slightly better `Coercible` errors.

This makes two real changes:
 - Equalities like (a ~R [a]) really *are* insoluble. Previously,
   GHC refused to give up when an occurs check bit on a representational
   equality. But for datatypes, it really should bail.

 - Now, GHC will sometimes report an occurs check error (in cases above)
   for representational equalities. Previously, it never did.

This "fixes" #10715, where by "fix", I mean clarifies the error message.
It's unclear how to do more to fix that ticket.

Test cases: typecheck/should_fail/T10715{,b}

4 years agoFix typo in test for #10347.
Richard Eisenberg [Mon, 21 Sep 2015 13:40:02 +0000 (09:40 -0400)] 
Fix typo in test for #10347.

Thanks to Gabor Greif for spotting the mistake.

4 years agoSmall improvement in pretty-printing constructors.
Richard Eisenberg [Sun, 20 Sep 2015 20:03:07 +0000 (16:03 -0400)] 
Small improvement in pretty-printing constructors.

This fixes #10810 by cleaning up pretty-printing of constructor
declarations. This change also removes a (in my opinion) deeply
bogus orphan instance OutputableBndr [Located name], making
HsDecls now a non-orphan module. Yay all around.

Test case: th/T10810

4 years agoRe-polish error messages around injective TFs.
Richard Eisenberg [Sun, 20 Sep 2015 19:28:55 +0000 (15:28 -0400)] 
Re-polish error messages around injective TFs.

The previous message was wrong, as pointed out by Jan Stolarek.

4 years agoClarify parsing infelicity.
Richard Eisenberg [Sat, 19 Sep 2015 20:44:29 +0000 (16:44 -0400)] 
Clarify parsing infelicity.

This fixes #10855.

4 years agoAllow TH quoting of assoc type defaults.
Richard Eisenberg [Sat, 19 Sep 2015 19:43:15 +0000 (15:43 -0400)] 
Allow TH quoting of assoc type defaults.

This fixes #10811.

4 years agoPrint associated types a bit better.
Richard Eisenberg [Sat, 19 Sep 2015 19:18:40 +0000 (15:18 -0400)] 
Print associated types a bit better.

This is part of #10811. It removes the "family" keyword from
associated type family declarations, and it adds the "type"
keyword to associated type family defaults.

4 years agoTest #10770
Richard Eisenberg [Sat, 19 Sep 2015 19:04:49 +0000 (15:04 -0400)] 
Test #10770

4 years agoUpdate user guide, fixing #10772
Richard Eisenberg [Sat, 19 Sep 2015 18:45:28 +0000 (14:45 -0400)] 
Update user guide, fixing #10772

4 years agoTest #10347
Richard Eisenberg [Sat, 19 Sep 2015 18:37:54 +0000 (14:37 -0400)] 
Test #10347

4 years agoDriver: --make -o without Main should be an error (#10895)
Thomas Miedema [Sat, 19 Sep 2015 14:14:47 +0000 (16:14 +0200)] 
Driver: --make -o without Main should be an error (#10895)

Reviewed by: austin

Differential Revision:

4 years agoPut stable pointer names in the name cache.
Edward Z. Yang [Sun, 20 Sep 2015 10:19:17 +0000 (12:19 +0200)] 
Put stable pointer names in the name cache.

Test Plan: validate

Reviewers: simonpj, austin, bgamari

Reviewed By: austin, bgamari

Subscribers: thomie

Differential Revision:

4 years agoReplace [PostTc id Type] with PostTc id [Type]
Matthew Pickering [Sun, 20 Sep 2015 10:18:21 +0000 (12:18 +0200)] 
Replace [PostTc id Type] with PostTc id [Type]

This gives a clearer indication as to what gets filled in
when. It was suggested by Richard on D1152.

Test Plan: ./validate

Reviewers: austin, goldfire, bgamari

Reviewed By: goldfire, bgamari

Subscribers: thomie

Differential Revision:

4 years agoAlways run explicitly requested ways (extra_ways) for fast runs.
Edward Z. Yang [Sun, 20 Sep 2015 10:16:50 +0000 (12:16 +0200)] 
Always run explicitly requested ways (extra_ways) for fast runs.

To keep validates fast, we only one run one way.  But I think that
it's important for some tests to run them a few ways, just to
make sure functionality, e.g. the profiler, is working.  This commit
changes the logic so that any way specified in extra_ways is always
run for fast.  The big changes is now profiling tests are run on

I also made it so the G1 garbage collector tests only run on slow.

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

Reviewers: austin, thomie, bgamari

Reviewed By: austin, thomie, bgamari

Subscribers: thomie

Differential Revision:

4 years agoPolish some error messages.
Richard Eisenberg [Sat, 19 Sep 2015 13:56:03 +0000 (09:56 -0400)] 
Polish some error messages.

4 years agoFix #10815 by kind-checking type patterns against known kinds.
Richard Eisenberg [Mon, 31 Aug 2015 17:46:01 +0000 (10:46 -0700)] 
Fix #10815 by kind-checking type patterns against known kinds.

tcFamTyPats now must take information about the instantiation of any
class variables, when checking the instance of an associated type.

Getting this to work out required some unexpected refactoring in
TcDeriv. TcDeriv needs to look at class instances because of the
possibility of associated datatypes with `deriving` specs. TcDeriv
worked over the user-specified instances. But any data family instances
were already processed, and TcDeriv had no way of finding the rep
tycons. Indeed, TcDeriv *re-type-checked* any data family instances
in an attempt to rediscover what GHC already knew. So, this commit
introduces better tracking of compiled data families between TcInstDcls
and TcDeriv to streamline all of this.

4 years agoPass TEST_HC_OPTS in bug1465 and T5792.
Edward Z. Yang [Fri, 18 Sep 2015 02:52:01 +0000 (19:52 -0700)] 
Pass TEST_HC_OPTS in bug1465 and T5792.

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

Reviewers: austin, bgamari

Subscribers: thomie

Differential Revision:

4 years agoDocs: make sure all libs are included in index.html (#10879)
Thomas Miedema [Tue, 15 Sep 2015 19:37:38 +0000 (21:37 +0200)] 
Docs: make sure all libs are included in index.html (#10879)

During the build, when HADDOCK_DOCS=YES, the command 'cd libraries && sh
gen_contents_index --intree' is run, which calls haddock to generate the
haddock index at 'libraries/dist-haddock/index.html'.

What it did before was check the ./packages file for all libraries. The
problem is that 'base' and 'ghc-prim' were folded into the main repo
some time ago, hence don't have an entry in the ./packages file anymore.
As a result, 'base' and 'ghc-prim' were missing from the index.html

It now simply runs haddock on all the all the `.haddock` files in the
libraries directory.

The only risk is that this could include the extra libraries in the
index.html, if you ever built them in the past (with
BUILD_EXTRA_PKGS=YES), even though now you want to exclude them (with
BUILD_EXTRA_PKGS=NO). gen_contents_index doesn't have access to build
system variables though (PACKAGES_STAGE1+PACKAGES_STAGE2), so fixing
this would be a little bit fiddly.

Test Plan:
'make libraries/dist-haddock/index.html && grep -q base
libraries/dist-haddock/index.html && echo ok'

Reviewed by: austin

Differential Revision:

4 years agoAdd namePackage function to template-haskell
RyanGlScott [Thu, 17 Sep 2015 21:15:26 +0000 (23:15 +0200)] 
Add namePackage function to template-haskell

Currently there exists a nameBase function (for retrieving a Name's OccName)
and a nameModule function (for retrieving a Name's ModName), but there is no
counterpart for PkgNames.

This would be useful for implementing Template Haskell features which need
to have easy access to a Name's package (e.g., automatically derived Lift

Reviewed By: goldfire, austin, thomie

Differential Revision:

4 years agoApplicativeDo transformation
Simon Marlow [Fri, 13 Mar 2015 16:39:58 +0000 (16:39 +0000)] 
ApplicativeDo transformation

This is an implementation of the ApplicativeDo proposal.  See the Note
[ApplicativeDo] in RnExpr for details on the current implementation,
and the wiki page
for design notes.

Test Plan: validate

Reviewers: simonpj, goldfire, austin

Subscribers: thomie

Differential Revision:

4 years agoShow minimal complete definitions in ghci (#10847)
Moritz Kiefer [Thu, 17 Sep 2015 14:02:06 +0000 (16:02 +0200)] 
Show minimal complete definitions in ghci (#10847)

Show the minimal complete definition on :info in ghci. They
are shown like MINIMAL pragmas in code. If the minimal complete
definition is empty or only a specific method from a class is
requested, nothing is shown.

Reviewed By: simonpj, austin, thomie

Differential Revision:

4 years agoTestsuite: add test for #10781
Thomas Miedema [Thu, 17 Sep 2015 01:25:11 +0000 (03:25 +0200)] 
Testsuite: add test for #10781

4 years agoDynFlags: remove unused sPgm_sysman (#8689)
Thomas Miedema [Wed, 16 Sep 2015 09:01:37 +0000 (11:01 +0200)] 
DynFlags: remove unused sPgm_sysman (#8689)

Something about a long deleted 'system manager' for the 'parallel

Also remove confusing comment in SysTools, that supposedly referred to
sPgm_sysman. See commit 16d5d1c75c999677783c9c1bda519540fa9a6e58.

4 years agoFix `hp2ps -i-`
Thomas Miedema [Tue, 15 Sep 2015 21:20:10 +0000 (23:20 +0200)] 
Fix `hp2ps -i-`

From the help text:
  -i[+|-] sort by identifier string (-i+ gives greatest on top)

Found by David Binderman.

4 years agoPretty: fix unicode arrow operators.
Sebastian Reuße [Tue, 15 Sep 2015 12:20:01 +0000 (14:20 +0200)] 
Pretty: fix unicode arrow operators.

As per issue #10509, the documentation gave the wrong glyphs for Unicode
alternatives to the -< and >- arrow operators (the codepoints were
correct, but the glyphs were not). The incorrect glyphs have also
made it into the error output. This replaces those characters with the
correct versions.

GHC Trac Issues: #10883

4 years agoAccount for stack allocation in the thread's allocation counter
Simon Marlow [Mon, 14 Sep 2015 12:37:38 +0000 (13:37 +0100)] 
Account for stack allocation in the thread's allocation counter

Summary: (see comment for details)

Test Plan: validate

Reviewers: bgamari, ezyang, austin

Subscribers: thomie

Differential Revision:

4 years agoTestsuite: mark T6037 expect_fail on Windows (#6037)
Thomas Miedema [Sat, 12 Sep 2015 21:34:12 +0000 (23:34 +0200)] 
Testsuite: mark T6037 expect_fail on Windows (#6037)

4 years agohpc: use `takeDirectory` instead of `dropWhileEnd (/= '/')`
Thomas Miedema [Sat, 12 Sep 2015 20:41:35 +0000 (22:41 +0200)] 
hpc: use `takeDirectory` instead of `dropWhileEnd (/= '/')`

This fixes some hpc tests on Windows. Update submodule hpc.

4 years agoCodeGen: fix typo in error message
Thomas Miedema [Sat, 12 Sep 2015 18:37:20 +0000 (20:37 +0200)] 
CodeGen: fix typo in error message

4 years agoTestsuite: mark enum01-enum03 expect_broken(#9399) on Windows
Thomas Miedema [Sat, 12 Sep 2015 17:34:16 +0000 (19:34 +0200)] 
Testsuite: mark enum01-enum03 expect_broken(#9399) on Windows

4 years agoTestsuite: normalise slashes in callstack output
Thomas Miedema [Sat, 12 Sep 2015 13:23:12 +0000 (15:23 +0200)] 
Testsuite: normalise slashes in callstack output

This fixes some tests on Windows, for example T2120.

4 years agos/StgArrWords/StgArrBytes/
Siddhanathan Shanmugam [Fri, 11 Sep 2015 21:10:41 +0000 (16:10 -0500)] 

Rename StgArrWords to StgArrBytes (see Trac #8552)

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #8552

4 years agoCode movement
Jan Stolarek [Fri, 11 Sep 2015 22:07:17 +0000 (00:07 +0200)] 
Code movement

4 years agoDead code removal, export cleanup
Jan Stolarek [Fri, 11 Sep 2015 21:55:52 +0000 (23:55 +0200)] 
Dead code removal, export cleanup

4 years agoRemove redundant language extensions
Jan Stolarek [Fri, 11 Sep 2015 21:44:42 +0000 (23:44 +0200)] 
Remove redundant language extensions

4 years agoAdd assertions
Jan Stolarek [Fri, 11 Sep 2015 20:29:02 +0000 (22:29 +0200)] 
Add assertions

4 years agoTestsuite cleanup
Jan Stolarek [Fri, 11 Sep 2015 20:02:35 +0000 (22:02 +0200)] 
Testsuite cleanup

As a result of fixing #10836 it is now possible to merge 11 different
tests for #6018 into one

4 years agoImprove documentation of comprehensions
Simon Peyton Jones [Fri, 11 Sep 2015 16:02:58 +0000 (17:02 +0100)] 
Improve documentation of comprehensions

Suggestion from Jeremy Gibbons

4 years agoFix broken links in documentation
Simon Peyton Jones [Fri, 11 Sep 2015 16:01:33 +0000 (17:01 +0100)] 
Fix broken links in documentation

4 years agoImprove documentation for transform list-comps
Simon Peyton Jones [Fri, 11 Sep 2015 15:23:35 +0000 (16:23 +0100)] 
Improve documentation for transform list-comps

Thanks to Jeremy Gibbons for spotting the infelictity

4 years agoA CFunEqCan can be Derived
Simon Peyton Jones [Fri, 11 Sep 2015 15:23:06 +0000 (16:23 +0100)] 
A CFunEqCan can be Derived

This fixes the ASSERTION failures in
when GHC is compiled with -DDEBUG

See Phab:D202 attached to Trac #6018

4 years agoAdd a test for Trac #10806
Simon Peyton Jones [Fri, 11 Sep 2015 14:55:29 +0000 (15:55 +0100)] 
Add a test for Trac #10806

4 years agoImprove rejigConRes (again)
Simon Peyton Jones [Fri, 11 Sep 2015 14:54:39 +0000 (15:54 +0100)] 
Improve rejigConRes (again)

I think this patch finally works around the delicacy in the strictness
of TcTyClsDecls.rejigConRes.   See the notes with that function and
Note [Checking GADT return types].

As a result, we fix Trac #10836, and improve Trac #7175

4 years agoComments on oneShot
Simon Peyton Jones [Thu, 27 Aug 2015 15:23:46 +0000 (16:23 +0100)] 
Comments on oneShot

4 years agoDon't check in autogenerated hs files for recomp013.
Edward Z. Yang [Thu, 10 Sep 2015 05:02:48 +0000 (22:02 -0700)] 
Don't check in autogenerated hs files for recomp013.

Signed-off-by: Edward Z. Yang <>
4 years agoTestsuite: comment out `setnumcapabilities001` (#10860)
Thomas Miedema [Wed, 9 Sep 2015 11:56:53 +0000 (13:56 +0200)] 
Testsuite: comment out `setnumcapabilities001` (#10860)

Don't mark it expect_broken, because it fails only sometimes.

4 years agoForbid annotations when Safe Haskell safe mode is enabled.
David Kraeutmann [Tue, 8 Sep 2015 16:35:33 +0000 (11:35 -0500)] 
Forbid annotations when Safe Haskell safe mode is enabled.

For now, this fails compliation immediately with an error. If desired, this
can be a warning that annotations in Safe Haskell are ignored.

Signed-off-by: David Kraeutmann <>
Reviewed By: goldfire, austin

Differential Revision:

GHC Trac Issues: #10826

4 years agoHeapStackCheck: Small refactoring
Ben Gamari [Tue, 8 Sep 2015 16:30:43 +0000 (11:30 -0500)] 
HeapStackCheck: Small refactoring

Use modern Cmm argument syntax in stg_block_blackhole definition.

Reviewed By: simonmar, austin

Differential Revision:

4 years agoBuild system: check for inconsistent settings (#10157)
Thomas Miedema [Tue, 8 Sep 2015 11:51:44 +0000 (13:51 +0200)] 
Build system: check for inconsistent settings (#10157)

`configure` currently detects when the docbook and hscolour tools aren't
available, and instead of failing outright (as it does for missing alex
and happy), sets some variables in mk/ to tell `make` not to
build the documentation.

Sometimes, however, you want to really make sure all documentation gets
built, fully colourized. For example when making a release. To do so,
you can override the mentioned variables from mk/ in
mk/ (e.g. set HSCOLOUR_SRCS=YES).

This patch adds some error checking to make sure that doing so will not
result in weird build failures when those tools are still missing.

Test Plan: ran `make` a couple of times, with different mk/ settings.

Reviewed by: austin

Differential Revision:

4 years agoMove GeneralCategory et al to GHC.Unicode
Ben Gamari [Tue, 8 Sep 2015 13:38:40 +0000 (08:38 -0500)] 
Move GeneralCategory et al to GHC.Unicode

This allows these to be used from Text.Read.Lex import cycles.

Reviewed By: thomie, austin

Differential Revision:

GHC Trac Issues: #10444

4 years agoBuild system: cleanup BUILD_DIRS + add lots of Notes
Thomas Miedema [Fri, 10 Jul 2015 22:50:58 +0000 (00:50 +0200)] 
Build system: cleanup BUILD_DIRS + add lots of Notes

See Note [CrossCompiling vs Stage1Only] in mk/
See Note [Stage1Only vs stage=1] in mk/
See Note [No stage2 packages when CrossCompiling or Stage1Only].

  * use stage2 to build mkUserGuidePart, as was probably intended.
    Now the following represent the same set of packages:
    - packages that we build with ghc-stage2
    - packages that depend on the ghc library
    Those packages are: haddock, mkUserGuidePart and ghctags.
  * don't let utils that don't depend on the ghc library depend on its file. Instead, let those utils directly depend on
    the files of the stage1 packages. Not sure if it
    improves anything, but I found it easier to explain what's going on
    this way.

(partially) reviewed by: austin

Differential Revision:

4 years agoBuild system: make *-cross BuildFlavours consistent (#10223)
Thomas Miedema [Tue, 25 Aug 2015 17:20:39 +0000 (19:20 +0200)] 
Build system: make *-cross BuildFlavours consistent (#10223)

This is a follow up to 841924c9587c10488a18e307b573720977bf4f13,
where `-fllvm` was explicitly removed from GhcStage1HcOpts for

After removing -fllvm from GhcStage1HcOpts, it should be removed from
SRC_HC_OPTS as well, because SRC_HC_OPTS are added to every Haskell
compilation. That's what this patch does.

BuildFlavour bench-cross (added in ddf79ebf69fe4a6e69d69d451a6040a53b1ea12c),
is probably never used. But for consistency, also use -fllvm here, for
building stage2 and the libraries.

Reviewed by: austin

Differential Revision:

4 years agoBuild system: delete the InstallExtraPackages variable
Thomas Miedema [Tue, 25 Aug 2015 15:30:18 +0000 (17:30 +0200)] 
Build system: delete the InstallExtraPackages variable

Just install all packages that are built. Don't make an exception for
the dph and extra packages.

You can control whether the dph and extra packages should be build using
the variables BUILD_DPH and BUILD_EXTRA_PKGS. These variables didn't
exist before. But now that they do, InstallExtraPackages isn't really
needed anymore.

Reviewed by: austin

Differential Revision:

4 years agoBuild system: remove hack for Mac OSX in (#10476)
Thomas Miedema [Mon, 7 Sep 2015 13:58:33 +0000 (15:58 +0200)] 
Build system: remove hack for Mac OSX in (#10476)

Cross-compilation on Mac OSX currently doesn't work. While building
stage 1, the build system uses the `ar` for the target architecture
instead of the `ar` for build/host architecture.

The cause is a hack added in 24746fe78024a1edab843bc710c79c55998ab134
(2010), to supporting bootstrap compilers built with older versions of
Xcode. Xcode 4.3 started installing command line tools in a different
location. Assuming this all behind us now, and the paths didn't change
again (you never now), we can delete the hack.

Deleting the hack fixes the cross compilation issue. Tested by Trac user

Reviewed by: austin

Differential Revision:

4 years agoBuild system: detect when user cloned from GitHub
Thomas Miedema [Mon, 7 Sep 2015 13:28:30 +0000 (15:28 +0200)] 
Build system: detect when user cloned from GitHub

Cloning the ghc repository from GitHub doesn't work out of the box. It
requires installing some special url rewrites into ~/.gitconfig. The
build fails mysteriously if you forget. This patch tries to detect when
you cloned from GitHub, and warns you if you didn't set those url

This hopefully lowers to barrier to contribute to GHC by a tiny bit. At
least one /r/haskell user ran into this recently.

Test Plan:
cloned from github, ran ./boot, saw the message. Installed url
rewrites, and ran ./boot again, didn't see the message.

Reviewed by: austin

Differential Revision:

4 years agoFurther simplify the story around minimum/maximum
Joachim Breitner [Mon, 7 Sep 2015 11:48:10 +0000 (13:48 +0200)] 
Further simplify the story around minimum/maximum

After I have found out that I should look at -ddump-prep and not
-ddump-core, I noticed that these days, GHC is perfectly capeable of
turning (the equivalent) of foldl to (the equivalent) of foldl' if the
operation in question is strict. So instead of using rewrite rules to
rewrite maximum to a strictMaximum for certain types, we simply use

This also marks maximum/minimum as INLINEABLE, so that client code can
get similar specializations, hopefully even automatically. And inded,
minimum applied to [Double] produces good code (although due to
inlineing, not due to specialization, it seems).

I checked (by looking at the core) that this still fixes #10788.

Differential revision:

4 years agoSPECIALIZE strictMinimum for Int and Integer
Joachim Breitner [Mon, 7 Sep 2015 11:19:50 +0000 (13:19 +0200)] 
SPECIALIZE strictMinimum for Int and Integer

This fixes a regression reported in #10788, where due to less inlining
compared to earlier versions, we’d get worse code. With the SPECIALIZE,
we get the good code, and moreover, the good code is in List.hs and
_not_ inlined to the use site, so smaller code size and less compilation

4 years agoBuild system: cleanup utils/ghc-pkg/
Thomas Miedema [Thu, 9 Jul 2015 23:02:31 +0000 (01:02 +0200)] 
Build system: cleanup utils/ghc-pkg/

There used to be a lot of custom make code to build ghc-pkg with the
stage0 compiler. Commit ac5a314504554ddef0e855ef9e2fcf51e961f4a6
thankfully cleaned this up, by using the build settings from the
ghc-pkg.cabal file.

This commit removes some remains of the old way of installing ghc-pkg
when Stage1Only=YES. Notably, we called both `build-prog` as
`shell-wrapper`. This is surely wrong, because `build-prog` already
calls `shell-wrapper`. It isn't needed to set WANT_INSTALLED_WRAPPER
either; build-prog does that for us.

This prevents the following warnings when Stage1Only=YES:
  utils/ghc-pkg/ warning:
    overriding commands for target `install_utils/ghc-pkg_dist_wrapper'
  utils/ghc-pkg/ warning:
    ignoring old commands for target `install_utils/ghc-pkg_dist_wrapper'

Also add more comments and restructure a bit.

Reviewed by: austin

Differential Revision:

4 years agoBuild system: simplify *-llvm BuildFlavours (#10223)
Thomas Miedema [Tue, 25 Aug 2015 15:49:32 +0000 (17:49 +0200)] 
Build system: simplify *-llvm BuildFlavours (#10223)

Note that SRC_HC_OPTS are added to every Haskell compilation. So
there isn't any need to also add `-fllvm` to GhcStage1HcOpts,
GhcStage2HcOpts and GhcLibHcOpts.

Small bug fix: make sure we test for -fllvm in SRC_HC_OPTS, to check
whether the bootstrap compiler is affected by bug #9439.

Reviewed by: austin

Differential Revision:

4 years agoBuild system: put each BuildFlavour in a separate file (#10223)
Thomas Miedema [Mon, 31 Aug 2015 12:39:47 +0000 (14:39 +0200)] 
Build system: put each BuildFlavour in a separate file (#10223)

This allows easier diffing of different BuildFlavours, including

Reviewed By: bgamari, austin

Differential Revision:

4 years agotracing: Kill EVENT_STARTUP
Ben Gamari [Mon, 31 Aug 2015 20:39:13 +0000 (22:39 +0200)] 
tracing: Kill EVENT_STARTUP

This has been unnecessary for quite some time due to the create/delete
capability events.

4 years agoEventLog: Factor out ensureRoomFor*Event
Ben Gamari [Mon, 31 Aug 2015 20:00:10 +0000 (22:00 +0200)] 
EventLog: Factor out ensureRoomFor*Event

4 years agouser-guide: Add missing <para> tags around <listitem> body
Ben Gamari [Fri, 4 Sep 2015 16:49:23 +0000 (18:49 +0200)] 
user-guide: Add missing <para> tags around <listitem> body

Otherwise this is ill-formed DocBook

4 years agoghc-pkg: don't print ignored errors when verbosity=0
Thomas Miedema [Fri, 4 Sep 2015 14:59:44 +0000 (16:59 +0200)] 
ghc-pkg: don't print ignored errors when verbosity=0

Lines like the following are filling up the build logs:

  binary- cannot find any of
  ["Data/Binary.hi","Data/Binary.p_hi","Data/Binary.dyn_hi"] (ignoring)

4 years agoBuild system: implement `make install-strip` (#1851)
Thomas Miedema [Sat, 15 Aug 2015 15:45:57 +0000 (17:45 +0200)] 
Build system: implement `make install-strip` (#1851)

Reviewed by: bgamari

Differential Revision:

4 years agoFix T6018th test failure
Jan Stolarek [Fri, 4 Sep 2015 03:15:06 +0000 (05:15 +0200)] 
Fix T6018th test failure

4 years agoMake Data.List.foldr1 inline
Joachim Breitner [Wed, 2 Sep 2015 22:58:38 +0000 (15:58 -0700)] 
Make Data.List.foldr1 inline

Previously, foldr1 would be defiend recursively and thus not inline.
This is bad, for example, when maximumBy has a strict comparison
function: Before the BBP, it was implemented via foldl1, which inlined
and yielded good code. With BBP, it goes via foldr1, so we better inline
this as well. Fixes #10830.

Differential Revision:

4 years agoTestsuite: ignore line number differences in call stacks (#10834)
Thomas Miedema [Thu, 3 Sep 2015 12:56:50 +0000 (14:56 +0200)] 
Testsuite: ignore line number differences in call stacks (#10834)

Differential Revision:

4 years agoTestsuite: only print msg when timeout kills process unexpectedly
Thomas Miedema [Thu, 3 Sep 2015 14:13:42 +0000 (16:13 +0200)] 
Testsuite: only print msg when timeout kills process unexpectedly

Differential Revision:

4 years agoTestsuite: fix tcfail220 - Maybe is wired-in now
Thomas Miedema [Thu, 3 Sep 2015 15:01:10 +0000 (17:01 +0200)] 
Testsuite: fix tcfail220 - Maybe is wired-in now

This fixes validate.

374457809de343f409fbeea0a885877947a133a2 (D202) mentions: "This patch
also wires-in Maybe data type".

A conflicting definition of a wired-in type in a .hsig file doesn't seem
to cause compilation to fail. This is probably a bug, but a small one.
Since SPJ in ffc21506894c7887d3620423aaf86bc6113a1071 swept this under
the rug, by removing `data Bool a b c d = False` from tcfail220.hsig,
I'm going to do the same here.

D1098 touches these files, so ezyang can decide whether this problem
warrants fixing when doing a rebase.

Differential Revision:

4 years agoAccept underscores in the module parser. (Thanks spinda for the fix.)
Edward Z. Yang [Thu, 3 Sep 2015 21:16:03 +0000 (14:16 -0700)] 
Accept underscores in the module parser. (Thanks spinda for the fix.)

Signed-off-by: Edward Z. Yang <>
4 years agoAdd test for T10836 (expected broken)
Jan Stolarek [Thu, 3 Sep 2015 17:28:44 +0000 (19:28 +0200)] 
Add test for T10836 (expected broken)

4 years agoInjective type families
Jan Stolarek [Fri, 11 Jul 2014 11:54:45 +0000 (13:54 +0200)] 
Injective type families

For details see #6018, Phab:D202 and the wiki page:

This patch also wires-in Maybe data type and updates haddock submodule.

Test Plan: ./validate

Reviewers: simonpj, goldfire, austin, bgamari

Subscribers: mpickering, bgamari, alanz, thomie, goldfire, simonmar,

Differential Revision:

GHC Trac Issues: #6018

4 years agoTestsuite: delete dead code
Thomas Miedema [Thu, 27 Aug 2015 23:00:31 +0000 (01:00 +0200)] 
Testsuite: delete dead code

4 years agoTestsuite: by default run all tests for a single way
Thomas Miedema [Thu, 27 Aug 2015 10:44:15 +0000 (12:44 +0200)] 
Testsuite: by default run all tests for a single way

`make test` now runs all tests for a single way only. Use `make slowtest` to
get the previous behaviour (i.e. run all tests for all ways).

The intention is to use this new `make test` setting for Phabricator, as
a reasonable compromise between `make fasttest` (what it previously
used) and a fullblown `make slowtest` (which runs all tests for all

See Note [validate and testsuite speed] in toplevel Makefile.

Differential Revision:

4 years agoFix some tests that were broken by D861
Eric Seidel [Wed, 2 Sep 2015 18:17:01 +0000 (20:17 +0200)] 
Fix some tests that were broken by D861

I didn't realize that `./validate` does not run every test :(

Test Plan: ./validate --slow

Update submodule hpc.

Differential Revision:

4 years agoTestsuite: mark 4 tests expect_broken_for(#10712, opt_ways)
Thomas Miedema [Wed, 2 Sep 2015 16:49:25 +0000 (18:49 +0200)] 
Testsuite: mark 4 tests expect_broken_for(#10712, opt_ways)

Please revert when #10712 is fixed.

4 years agoTestsuite: update expected output
Thomas Miedema [Wed, 2 Sep 2015 16:30:07 +0000 (18:30 +0200)] 
Testsuite: update expected output

4 years agoTestsuite: don't warn about missing specialisations
Thomas Miedema [Wed, 2 Sep 2015 13:45:57 +0000 (15:45 +0200)] 
Testsuite: don't warn about missing specialisations

They can only occur with `-O`, but we want tests to produce the same
output for all test ways.

This brings us closer to passing the complete testsuite.

Differential Revision:

4 years agostm: Fix test case
Ben Gamari [Wed, 2 Sep 2015 13:34:56 +0000 (09:34 -0400)] 
stm: Fix test case

Updates stm submodule.

4 years agoImprove the error messages for class instance errors
Simon Peyton Jones [Wed, 2 Sep 2015 12:05:36 +0000 (14:05 +0200)] 
Improve the error messages for class instance errors

Summary: See Note [Displaying potential instances].

Reviewers: austin

Subscribers: KaneTW, thomie

Differential Revision:

4 years agoExpand declaration QQs first (#10047)
Michael Smith [Wed, 2 Sep 2015 11:57:44 +0000 (13:57 +0200)] 
Expand declaration QQs first (#10047)

Declaration QuasiQuoters do not cause a group split like $(...)
splices, and are run and expanded before other declarations in
the group.

Resolves the lingering issue with #10047, and fixes broken tests
qq007 and qq008.

Test Plan: validate

Reviewers: goldfire, austin, bgamari

Reviewed By: bgamari

Subscribers: goldfire, simonpj, thomie, spinda

Differential Revision:

GHC Trac Issues: #10047

4 years agoAllow annotations though addTopDecls (#10486)
Michael Smith [Wed, 2 Sep 2015 11:56:27 +0000 (13:56 +0200)] 
Allow annotations though addTopDecls (#10486)

addTopDecls restricts what declarations it can be used to add. Adding
annotations via this method works fine with no special changes apart
from adding AnnD to the declaration whitelist.

Test Plan: validate

Reviewers: austin, goldfire, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10486

4 years agoUse a response file for linker command line arguments #10777
Michael Snoyman [Wed, 2 Sep 2015 11:31:25 +0000 (13:31 +0200)] 
Use a response file for linker command line arguments #10777

On Windows, we're constrained to 32k bytes total for command line
arguments.  When building large projects, this limit can be exceeded.
This patch changes GHC to always use response files for linker
arguments, a feature first used by Microsoft compilers and added to GCC
(over a decade ago).

Alternatives here include:

* Only use this method on Windows systems
* Check the length of the command line arguments and use that to decide
  whether to use this method

I did not pursue either of these, as I believe it would make the patch
more likely to break in less tested situations.

Test Plan:
Confirm that linking still works in general. Ideally: compile a very
large project on Windows with this patch. (I am attempting to do that
myself now, but having trouble getting the Windows build tool chain up
and running.)

Reviewers: goldfire, hvr, rwbarton, austin, thomie, bgamari, Phyx

Reviewed By: thomie, bgamari, Phyx

Subscribers: erikd, awson, #ghc_windows_task_force, thomie

Differential Revision:

GHC Trac Issues: #8596, #10777

4 years agoAdd test for updating a record with existentially quantified fields.
Matthew Pickering [Wed, 2 Sep 2015 11:28:34 +0000 (13:28 +0200)] 
Add test for updating a record with existentially quantified fields.

Test Plan: ./validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

4 years agoFix trac #10413
Ben Gamari [Wed, 2 Sep 2015 11:26:22 +0000 (13:26 +0200)] 
Fix trac #10413

Test Plan: Validate.

Reviewers: austin, tibbe, bgamari

Reviewed By: tibbe, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10413

4 years agoUse IP based CallStack in error and undefined
Eric Seidel [Wed, 2 Sep 2015 08:22:01 +0000 (10:22 +0200)] 
Use IP based CallStack in error and undefined

This patch modifies `error`, `undefined`, and `assertError` to use
implicit call-stacks to provide better error messages to users.

There are a few knock-on effects:

- `GHC.Classes.IP` is now wired-in so it can be used in the wired-in
  types for `error` and `undefined`.

- `TysPrim.tyVarList` has been replaced with a new function
  `TysPrim.mkTemplateTyVars`. `tyVarList` made it easy to introduce
  subtle bugs when you need tyvars of different kinds. The naive

  tv1 = head $ tyVarList kind1
  tv2 = head $ tyVarList kind2

  would result in `tv1` and `tv2` sharing a `Unique`, thus substitutions
  would be applied incorrectly, treating `tv1` and `tv2` as the same
  tyvar. `mkTemplateTyVars` avoids this pitfall by taking a list of kinds
  and producing a single tyvar of each kind.

- The types `GHC.SrcLoc.SrcLoc` and `GHC.Stack.CallStack` now live in

- The type `GHC.Exception.ErrorCall` has a new constructor
  `ErrorCallWithLocation` that takes two `String`s instead of one, the
  2nd one being arbitrary metadata about the error (but usually the
  call-stack). A bi-directional pattern synonym `ErrorCall` continues to
  provide the old API.

Updates Cabal, array, and haddock submodules.

Reviewers: nh2, goldfire, simonpj, hvr, rwbarton, austin, bgamari

Reviewed By: simonpj

Subscribers: rwbarton, rodlogic, goldfire, maoe, simonmar, carter,
liyang, bgamari, thomie

Differential Revision:

GHC Trac Issues: #5273