Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: nominolo/ghc
base: master
head fork: ghc/ghc
Checking mergeability… Don't worry, you can still create the pull request.
This comparison is big! We're only showing the most recent 250 commits
Commits on Mar 11, 2015
@ezyang ezyang Update Cabal submodule to latest 1.22 snapshot
This changes the library file name format

NOTE: This patch originally updated to Cabal HEAD, but was reduced to
      update to Cabal 1.22 HEAD by hvr as this is needed in order to
      update the filepath submodule to version 1.4.0, and subsequently
      to be cherry-picked into the ghc-7.10 branch

Signed-off-by: Edward Z. Yang <>

Reviewed By: austin

Differential Revision:
@hvr hvr Update filepath submodule to filepath-1.4 snapshot
This also needs to update a couple of other submodules
to update the upper bound on filepath to allow this major
version bump to
@hvr hvr Rename ty{Con,peRep}Hash to ty{Con,peRep}Fingerprint
This is a follow-up change to 56e0ac9

See also discussion at

Reviewed By: simonpj

Differential Revision:
@thomie thomie Cleanup test framework string formatting
* Use format strings instead of string concatenation.
* Wrap `config.compiler`, `config.hpc` etc. in quotes in `mk/`, so we
  don't have to in .T scripts and driver/

Update hpc submodule (test cleanup)

Reviewers: austin

Differential Revision:
@thomie thomie Update submodule hpc (includes fix for #9619)
Reviewers: austin

Differential Revision:
@thomie thomie testsuite: use same flags for ghci way and scripts
The ghci script tests were using different RTS flags from the normal
ghci tests. This commit makes them use the same flags.

Reviewers: austin

Differential Revision:
Commits on Mar 12, 2015
@erikd erikd Use the gold linker for linux/ARM and android/ARM targets.
Fixes #8976 and #9873 by making use of the Binutils
linker explicit whenever the target is linux/ARM or android/ARM.
This does not affect iOS where Apple provides its own linker.

In order to achieve this, we need to add `-fuse-ld=gold` to
the SettingsCCompilerLinkFlags setting and set
SettingsLdCommand to `` (or `${target}` when
cross-compiling). In addition, simplifying the use of

This patch was tested by ensuring that the following worked
as expected:

  * Native builds on linux/x86_64 (nothing changed).
  * Native builds on linux/arm (and uses the gold linker).
  * Linux to linux/arm cross compiles (and uses the cross
    gold linker).

Contributions by Ben Gamari, Joachim Breitner and Reid Barton.

Reviewers: nomeata, bgamari, austin, rwbarton

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #8976 #9873
Commits on Mar 13, 2015
@thomie thomie Move the function strip_quotes to
If one runs the testsuite with a profiling compiler, during the import
of ``, `` sets the global variable `gs_working`. To
do so, it executes a few statements which require the function
`strip_quotes` to be in scope. But that function only gets defined at
the very end of

This patch moves the definition of `strip_quotes` to, which
is imported at the very top of This unbreaks the nightly

Reviewed By: austin

Differential Revision:
Commits on Mar 14, 2015
@trommler trommler Link temporary shared objects with `--no-as-needed`
Some ELF link editors default to `--as-needed` and record only
those libraries in DT_NEEDED tags that are needed to resolve
undefined symbols in the shared object to be created.

In Template Haskell we rely on all symbols that were defined
in modules compiled so far to be available in the current
temporary shared object. To prevent the link editor from
dropping the DT_NEEDED tag for the previously linked temporary
shared object we need to override the link editors default and
specify `--no-as-needed` on the command line. This is for GNU ld
and GOLD ld.

This addresses #10110

TODO: regression test

Reviewed By: hvr

Differential Revision:
@ezyang ezyang We need to import 'cast' on Windows
This fixes breakage introduced via

Signed-off-by: Edward Z. Yang <>

Reviewed By: hvr

Differential Revision:
Commits on Mar 15, 2015
@hvr hvr Update Haddock submodule
This pulls in a cherry-picked commit adding support for
the new `--package-name` and `--package-version` flags and thus
helps addressing #10115.
@hvr hvr Update Cabal submodule to latest snapshot
This addresses the Cabal side of #10115 as this pulls in the following two

> Make sure to pass the package key to ghc
> Haddock: Use --package-{name|version} when available
Commits on Mar 16, 2015
@thoughtpolice thoughtpolice libraries/win32: update submodule
Signed-off-by: Austin Seipp <>
@simonpj simonpj Test Trac #10156 817d2c3
@thomie thomie Fix testsuite driver for a profiling compiler
This should have been part of commit 5258566, to allow expansion of
'{hp2ps}' in a command string to `config.hp2ps`.

Reviewed by: austin

Differential Revision:
@thomie thomie Dont call unsafeGlobalDynFlags if it is not set
Parsing of static and mode flags happens before any session is started,
i.e., before the first call to 'GHC.withGhc'. Therefore, to report
errors for invalid usage of these two types of flags, we can not call
any function that needs DynFlags, as there are no DynFlags available yet
(unsafeGlobalDynFlags is not set either). So we always print "on the
commandline" as the location, which is true except for Api users, which
is probably ok.

When reporting errors for invalid usage of dynamic flags we /can/ make
use of DynFlags, and we do so explicitly in

Before, we called unsafeGlobalDynFlags when an invalid (combination of)
flag(s) was given on the commandline, resulting in panics (#9963). This
regression was introduced in 1d6124d.

Also rename showSDocSimple to showSDocUnsafe, to hopefully prevent this
from happening again.

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #9963
@erikd erikd Fix build on amd64/solaris.
Commit 71fcc4c breaks the 64bit build on Solaris 11. Solaris
is a multi-lib OS so both 32bit and 64bit binaries may  be run, but
by default it compiles to 32bit so that -m64 needs to be added in
the appropriate place when compiling for 64 bits.

Patch-from: Karel Gardas <>

Reviewers: kgardas, austin

Subscribers: thomie

Differential Revision:
Commits on Mar 17, 2015
@thomie thomie Fix Windows testsuite driver
This got broken in commit 5258566.
@simonpj simonpj Refactor the extra-deps stuff for hs-boot
See Note [Extra dependencies from .hs-boot files] in RnSource

No change in behaviour
@simonpj simonpj Comments, white space, and small refactoring
The only real change is a new type synonym ImpRuleEdges
No significant changes at all
@simonpj simonpj Move declaration of Rulebase from Rules to CoreSyn
This allow HscTypes to import CoreSyn rather than Rules, which makes
module loops easier to avoid.  At one point in my recent travels this
was important; I'm not sure it's so important now, but it's a good
thing anyway.

In any case CoreRule is defined in CoreSyn, so this move make sense.
@phadej phadej Add more MonadZip instances
Summary: Add MonadZip Alt and MonadFix Alt instances

Reviewers: ekmett, dfeuer, hvr, austin

Reviewed By: austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10107
@thoughtpolice thoughtpolice Add release note entry for D716
Signed-off-by: Austin Seipp <>
@edsko edsko Expose listPackageConfigMap
This is useful for code that needs to search the package config map for
packages satisfying a certain condition.

Reviewed By: ezyang

Differential Revision:
@thomie thomie hpc: use System.FilePath.(</>) instead of (++)
BAD: "." ++ "/" ++ "/absolute/path" == ".//absolute/path"
GOOD: "." </> "/absolute/path" == "/absolute path"

Also replace `++ ".ext"` with `<.> "ext"`. Although it doesn't fix any
bugs in this instance, it might in some other. As a general rule it's
better not to use (++) on FilePaths.

Reviewed By: austin, hvr

Differential Revision:

GHC Trac Issues: #10138
Commits on Mar 18, 2015
@ggreif ggreif Typos in comments 6f40060
@simonpj simonpj Comments only fad7bb0
@thomie thomie Remove mention of `-unreg` in error message
The `-unreg` flag was removed in commit dade8ab (2007), see #1008.

Commits on Mar 19, 2015
@hvr hvr Update filepath/hpc/process submodules
These updates these 3 submodules to their respective released tagged
commits. No source-code changes are involved with this update.
@hvr hvr Update Cabal submodule to 1.22 branch tip c4aa959
@thomie thomie Remove comments and flag for GranSim
The GranSim code was removed in dd56e9a and 297b05a in 2009, and perhaps
other commits I couldn't find.

Reviewed By: austin

Differential Revision:
@thomie thomie Refactor Linker.hs: use System.Directory.findFile
Use System.Directory.findFile instead of a custom implementation. Also change
FilePath concatenation with ++ by </>. Refactoring only.

Reviewed By: austin

Differential Revision:
@thomie thomie Refactor: follow hlint suggestions in Linker.hs
Reviewed By: austin

Differential Revision:
@yav yav Improve `Typeable` solver. 3a0019e
@thoughtpolice thoughtpolice win32/base: Remove redundant import
This causes ./validate to trip -Werror on Windows.

Signed-off-by: Austin Seipp <>
@thoughtpolice thoughtpolice libraries: update win32 submodule
This update fixes #10165.

Signed-off-by: Austin Seipp <>
@yav yav Merge branch 'master' of git:// a07ff3b
@yav yav Remove unused parameter to `EvTypeableTyCon` 75ef8b3
@thoughtpolice thoughtpolice testsuite: add a regression test for #10011
Signed-off-by: Austin Seipp <>
Commits on Mar 20, 2015
@hvr hvr Update deepseq submodule to tag
This deepseq update drops the redundant ghc-prim dependency for GHC>=7.6
@simonpj simonpj Modify test th/T10019 to wobble less
The TH output contains uniques which change too much.
So I took the length of the string instead. Crude,
perhaps too crude, but it'll still show up most significant
output changes
@hvr hvr Bump ghc-prim to
This major version bump was made necessary by
f44333e which changed the type
signatures of prefetch primops, as well as other changes
such as 051d694 turning `Any` into
an abstract closed type family.

Reviewed By: ekmett

Differential Revision:
@hvr hvr Try to reconstruct a changelog for TH 2.10
[skip ci]

(cherry picked from commit 9d15af8)
@hvr hvr Update bytestring submodule to release tag c746f01
Commits on Mar 21, 2015
@hvr hvr Update Cabal submodule to Cabal-v1.22.2.0 rls tag
this submdoule updates pulls in only meta-data changes
@mpickering mpickering Correct documentation in `Parser`.
Removed a trailing `in` from the final line which caused a compilation
error. [skip ci]

Reviewed by: thomie

Differential Revision:
Commits on Mar 22, 2015
@thoughtpolice thoughtpolice testsuite: add test for #10177
Signed-off-by: Austin Seipp <>
@hvr hvr Update haskeline submodule to release tag
This fixes compilation under windows with pre-AMP GHCs
although it's not clear if bootstrapping GHC was affected.
(see judah/haskeline#20 for details)
@thomie thomie Clarify meaning of the RTS `taskCount` variable
In #9261, there was some confusion about the meaning of the taskCount
stats variable in the rts.

It turns out that taskCount is not decremented when a worker task is
stopped (i.e. from workerTaskStop), but only when freeMyTask is called,
which frees the task bound to the current thread. So taskCount is the
current number of bound tasks + the total number of worker tasks.

This makes the calculation of the current number of bound tasks in
rts/Stats.c correct _as is_.

[skip ci]

Reviewed By: austin

Differential Revision:
@nomeata nomeata New lint check: exprIsHNF = True and alts = [] is bogus 29f7c10
@nomeata nomeata Test case for #10176
originally provided by Neil Mitchell. Despite what he observed, I can
observe the bug even with all in one module.
@nomeata nomeata Trim Call Arity
to not accidentially invalidate a strictness signature with a Diverges
result info. This seems to fix #10176.

Differential Revision:
@thoughtpolice thoughtpolice docs: make gen_contents_index --verbose more verbose
Signed-off-by: Austin Seipp <>
@kgardas kgardas fix bus error (misaligned data access) on SPARC in __decodeDouble_Int64
Reviewers: austin

Subscribers: thomie

Differential Revision:
@carlostome carlostome rts: check arguments to flags that don't have any
There were some flags of the RTS that when given an argument (which they
don't have) were not firing an error.
e.g -Targument when the flag -T has no argument.
Now this is an error and affects the following flags:
-B -w -T -Z -P -Pa -c -t

Signed-off-by: Carlos Tomé <>

Reviewed By: austin, thomie, hvr

Differential Revision:

GHC Trac Issues: #9839
Commits on Mar 23, 2015
@hvr hvr Update integer-gmp2's changelog for release
[skip ci]

(cherry picked from commit 7bd3efe)
@hvr hvr Fix integer-gmp source tarball distribution
The `configure` script checks for presence of `install-sh` even if
it's not used, so we simply add it to the distribution to make `configure`
@nomeata nomeata Minor fix to Note [Trimming arity]
[ci skip]
@thomie thomie Fix quasiquotation test (#4150) f72074e
@hvr hvr Minor bump `base` version to
We've accumulated enough to justify a minor version bump to,
but not enough to justify a major version bump yet as far as I can see.
@hvr hvr Update base changelog regarding 4.8.1 changes
Turns out we've been a bit too lazy and quite a few undocumented changes have
accumulated in `base` relative to GHC 7.10's `base-`...

[skip ci]
@thomie thomie Make testsuite driver Python 2.6 compatible again
Another bug in the #10164 series. Only Python 2.7 and up allow you to
omit the positional argument specifiers in format strings.

Test Plan: this fixes the Solaris builders

Reviewed By: kgardas

Differential Revision:

GHC Trac Issues: #10164
@goldfirere goldfirere Do proper depth checking in the flattener to avoid looping.
This implements (roughly) the plan put forward in comment:14:ticket:7788,
fixing #7788, #8550, #9554, #10139, and addressing concerns raised in #10079.
There are some regressions w.r.t. GHC 7.8, but only with pathological type
families (like F a = F a). This also (hopefully -- don't have a test case)
fixes #10158. Unsolved problems include #10184 and #10185, which are both
known deficiencies of the approach used here.

As part of this change, the plumbing around detecting infinite loops has
changed. Instead of -fcontext-stack and -ftype-function-depth, we now have
one combined -freduction-depth parameter. Setting it to 0 disbales the
check, which is now the recommended way to get (terminating) code to
typecheck in releases. (The number of reduction steps may well change between
minor GHC releases!)

This commit also introduces a new IntWithInf type in BasicTypes
that represents an integer+infinity. This type is used in a few
places throughout the code.

Tests in
  typecheck/should_compile/T10184  (expected broken)
  typecheck/should_compile/T10185  (expected broken)

This commit also changes performance testsuite numbers, for the better.
@nomeata nomeata exprIsBottom should look through type lambdas
as evaluting (\ (@ a) -> e) diverges if and only if evaluating e
diverges. This was found in the context of #10180.
@nomeata nomeata New Lint check: no alternatives implies bottoming expression
detected either by exprIsBottom or by an empty type.

This was suggested by SPJ and fixes #10180.
@nomeata nomeata New lint check: Check idArity invariants (#10181)
The arity of an id should not be larger than what the type allows, and
it should also not contradict the strictness signature. This adds a lint
check for that.

This broke test T8743, uncovering a bug in the SOURCE import machinery,
which is now filed as #10182.
@nomeata nomeata Add Note [No alternatives lint check]
in a follow up to #10180.
@nomeata nomeata isEmptyTy: Improve comment
[skip ci]
@erikd erikd Do version specific detection of LLVM tools (#10170).
The LLVM developers seem to make breaking changes in the LLVM IR
language between major releases. As a consumer of the LLVM tools
GHC now needs to be locked more tightly to a single version of
the LLVM tools.

GHC HEAD currently only supports LLVM version 3.6. This commit
changes the configure script to look for `llc-3.6` and `opt-3.6`
before looking for `llc` and `opt`. If the former are not found,
but the later are, check that they actually are version 3.6.

At the same time, when detecting known problems with the LLVM
tools (ie #9439) test for it using the versions of the LLVM tools
retrieved from the bootstrap compiler's settings file.

Test Plan: Manual testing.

Reviewers: thomie, rwbarton, nomeata, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10170
Commits on Mar 24, 2015
@ezyang ezyang Fix bug in hs-libraries field munging.
Signed-off-by: Edward Z. Yang <>

Test Plan: validate with 7.8 stage0 and HEAD stage0

Reviewers: austin, kgardas

Subscribers: thomie

Differential Revision:
@nomeata nomeata exprIsBottom: Make use of isEmptyTy (#10186)
Any expression with of empty type is necessary bottom, so we can use
that here. No effects known, but it is the right thing to do and
validate, so lets do it.

Differential Revision:
@nomeata nomeata Empty alternative lint check: Explain why there are two checks 9cdd2e6
@thomie thomie Delete DynFlag for NDP way
The last trace of NDP was removed in 2008 in commit:

NDP stood for 'Nested Data Parallelism'. It was superseded by Data
Parallel Haskell (DPH).

Reviewed By: austin

Differential Revision:
@nomeata nomeata Some stress tests for the empty case linter
This is a variation of T2431 where the emptyness of the type is hidden
behind a newtype, a type family and a closed type family. In all cases,
it would be sound for the compiler to determine that the equality type
is empty and the case alternatives may be dropped.

At the moment, GHC does _not_ determine that. But if it ever does, this
test ensures that we do not forget to make the lint from #10180 smarter
as well.
@simonpj simonpj Improve environment handling in TcBinds
This is a minor refactoring, but it simplifies the code quite a bit

* Decrease the number of variants of tcExtend in TcEnv
* Remove "not_actually_free" from TcEnv.tc_extend_local_env2
* Simplify plumbingof the "closed" flag
* Remove redundant scoping of wild-card variables
@simonpj simonpj More comments (related to Trac #10180) 33cfa5f
Commits on Mar 25, 2015
@fumieval fumieval Add Monad instance for `((,) a)` (#10190)
This was proposed a couple of times in the past, e.g.


but its implementation had been blocked by the fact that `Monoid` wasn't
in scope where the `Monad` class was defined. Since the AMP/FTP restructuring
this is no longer the case.
Commits on Mar 26, 2015
@hvr hvr Fix Git-commit-id detection for RELEASE=YES
By mistake, the Git-commit-id detection was only enabled for
`RELEASE=NO` (since the date-based GHC version computation is
only active in that case). With this commit the commit-id
detection is active regardless of the `RELEASE`-setting.

This is a follow-up to 73e5e2f
Commits on Mar 27, 2015
@rwbarton rwbarton Remove some unimplemented GranSim primops
An attempt to use these resulted in an error like:

[1 of 1] Compiling Main             ( p.hs, p.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 7.8.4 for x86_64-unknown-linux):
	emitPrimOp: can't translate PrimOp  parAt#{v}

Test Plan: validate

Reviewers: thomie, austin

Reviewed By: thomie, austin

Subscribers: thomie

Differential Revision:
@rwbarton rwbarton Update list of primops that don't get wrappers (#10191)
The list was 14 years old, and there don't seem to be any problems
with seq# or par#; the other par*# primops were not actually
implemented at all and were removed in D758.

Test Plan:
validate; will also try to locally validate an unregisterised build
in case there was some truth to the deleted comment

Reviewers: austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10191
@thomie thomie Rename driver phases C(obj)cpp to C(obj)cplusplus
Cpp     = Pre-process C
Ccpp    = Compile C++
Cobjcpp = Compile Objective-C++
CmmCpp  = Pre-process Cmm

Quite confusing! This commit renames `Ccpp` to `Ccplusplus`, and
`Cobjcpp` to `Cobjcplusplus`. The two letters `p-p` keep standing for
`pre-processing` throughout the compiler.

Reviewed By: austin

Differential Revision:
Commits on Mar 28, 2015
@thomie thomie Rename C(obj)cplusplus to C(obj)cxx
Reviewed By: kgardas

Differential Revision:
Commits on Mar 29, 2015
@ezyang ezyang Doc typofix.
Signed-off-by: Edward Z. Yang <>
Commits on Mar 30, 2015
@dalaing dalaing Renames some files to help with validation cleanup (#10212)
Test Plan: validate twice

Reviewed by: thomie

Differential Revision:
@nomeata nomeata Refactor the story around switches (#10137)
This re-implements the code generation for case expressions at the Stg →
Cmm level, both for data type cases as well as for integral literal
cases. (Cases on float are still treated as before).

The goal is to allow for fancier strategies in implementing them, for a
cleaner separation of the strategy from the gritty details of Cmm, and
to run this later than the Common Block Optimization, allowing for one
way to attack #10124. The new module CmmSwitch contains a number of
notes explaining this changes. For example, it creates larger
consecutive jump tables than the previous code, if possible.

nofib shows little significant overall improvement of runtime. The
rather large wobbling comes from changes in the code block order
(see #8082, not much we can do about it). But the decrease in code size
alone makes this worthwhile.

        Program           Size    Allocs   Runtime   Elapsed  TotalMem
            Min          -1.8%      0.0%     -6.1%     -6.1%     -2.9%
            Max          -0.7%     +0.0%     +5.6%     +5.7%     +7.8%
 Geometric Mean          -1.4%     -0.0%     -0.3%     -0.3%     +0.0%

Compilation time increases slightly:
        -1 s.d.                -----            -2.0%
        +1 s.d.                -----            +2.5%
        Average                -----            +0.3%

The test case T783 regresses a lot, but it is the only one exhibiting
any regression. The cause is the changed order of branches in an
if-then-else tree, which makes the hoople data flow analysis traverse
the blocks in a suboptimal order. Reverting that gets rid of this
regression, but has a consistent, if only very small (+0.2%), negative
effect on runtime. So I conclude that this test is an extreme outlier
and no reason to change the code.

Differential Revision:
@dalaing dalaing Remove an unused include that doesn't exist on OS X (#10211) c37ee4a
@thomie thomie Delete unused field `PipeEnv.pe_isHaskellishFile` b1d6a60
@thomie thomie Syntax check package-qualified imports (#9225)
Version numbers are not allowed in the package name of a
package-qualified import.

Reviewed By: austin, ezyang

Differential Revision:
Commits on Mar 31, 2015
@hvr hvr Add `integer-gmp` specific hint to
[skip ci]
@hvr hvr Drop old integer-gmp-0.5 from GHC source tree
This completes what c774b28 (#9281)
started.  `integer-gmp-1.0` was added as an additional
`libraries/integer-gmp2` folder while retaining the ability to configure
GHC w/ the old `integer-gmp-0.5` to have a way back, and or the ability
to easily switch between old/new `integer-gmp` for benchmark/debugging

This commit removes the old `libraries/integer-gmp` folder and moves
`libraries/integer-gmp2` into its place, while removing any mentions of
"gmp2" as well as the to support two different `integer-gmp` packages in
GHC's source-tree.

Reviewed By: austin

Differential Revision:
@Rufflewind Rufflewind Testsuite: suppress errors when running GS on
Suppress the errors that appear in standard output when running gs on since it's expected to fail anyway.

Reviewed By: thomie, austin

Differential Revision:
@thomie thomie Explicitly check for -C on registerised build (#7563)
Show a more descriptive error message.

Reviewed By: austin

Differential Revision:
@thomie thomie Don't throw exception when start_phase==stop_phase (#10219)
Just do nothing instead. This bug only shows up when using `-x hspp` in
--make mode on registerised builds.

Reviewed By: austin

Differential Revision:
@thomie thomie Don't treat .hcr and .raw_s as haskellish suffixes
.hcr: external core
.raw_s: direct output from the c compiler, back in the day

Reviewed By: austin

Differential Revision:
@thomie thomie Testsuite: redirect stderr to /dev/null when running GS on
This is a followup to a3d0a7a.

Reviewed by: Rufflewind

Differential Revision:
@ezyang ezyang uBackpack: simplified Backpack description.
Signed-off-by: Edward Z. Yang <>
Commits on Apr 01, 2015
@thomie thomie Don't `make accept` output of expect_broken tests
When running `make accept` on a directory in the testsuite, don't accept
the output of tests that are marked as expect_broken. This makes it
easier to review `git diff` after running `make accept`.

When you change an error message in the compiler that shows up in the
output of many tests, you can run `make accept` in the testsuite
directory, and all expected test output will be updated. But since your
change didn't magically fix all the other bugs in the compiler for which
we have an expect_broken test, the output for those tests should
probably not be updated.

Before, the effect of running `make accept` could be that some tests
would end up in the 'unexpected passes' group.

[skip ci]

Reviewed By: austin

Differential Revision:
@thomie thomie Change which files --make thinks are 'Haskellish' (#10220)
`.hspp` and `.hscpp` are haskell files that have already been preprocessed.

Treat `.hspp` and `.hscpp` as Haskellish sources again, as they were before
commit a10e199. This way, ghc --make will load their imports.

Make sure that `.cmm` and `.cmmcpp` are still not treated as Haskellish,
by moving them out of `haskell_src_suffixes` (but still keeping them in
haskellish_suffixes, though I'm not sure what the purpose of that group

Reviewed By: austin

Differential Revision:
@thomie thomie Reformat build flavours in (#10223)
Use same format for each build flavour, to make it easier to compare
them. Refactoring only.

Reviewed By: austin

Differential Revision:
@thomie thomie Filter out `-Rghc-timing` for V=0 builds (#10223)
Reviewed By: austin

Differential Revision:
@ezyang ezyang Indentation only.
Signed-off-by: Edward Z. Yang <>
Commits on Apr 02, 2015
@phadej phadej Fake (->) fixity declaration (#10145)
Reviewed By: simonpj, austin

Differential Revision:
@thomie thomie Do not set -fasm explicitly in (#10223)
On platforms that support -fasm, it is already the default, so we don't
have to set it.

Reviewed By: austin, erikd (tested on powerpc and armhf)

Differential Revision:
@thomie thomie Disable same warnings for normal builds as for validate (#10223)
The default validate settings currently disable some warnings in the
libraries. This patch moves those settings to a new file called
`mk/`, and applies them also to normal builds.

Through uncommenting a line in, developers can now build with

-Werror is not the default, because:
* We can not guarantee that the build is warning free on platforms we
  don't run regularly run validate (as part of continuous integration
  systems), and we still want the build to go through on those
* quoting rwbarton on irc > "I think -Werror by default has come up in
  the past and the argument was that it is too annoying when you are
  doing nontrivial development"

Reviewed By: austin

Differential Revision:
@dalaing dalaing Change 'Tab character' warnings so there is one per file (#9723)
Reviewed By: nomeata, thomie

Differential Revision:

Signed-off-by: Dave Laing <>
@trofi trofi libffi: backport noexecstack fix for x86/win32.S
Got detected by gentoo's QA preinstall hook:
 * RWX --- --- usr/lib/ghc-7.10.1/rts/
 * RWX --- --- usr/lib/ghc-7.10.1/rts/
 * RWX --- --- usr/lib/ghc-7.10.1/rts/
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_p.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_l.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_debug.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_debug.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_l.a:win32.o
 * !WX --- --- usr/lib/ghc-7.10.1/rts/libCffi_thr_p.a:win32.o

Signed-off-by: Sergei Trofimovich <>

Test Plan: built ghc-7.10.1 binary and checked stacks as NX

Reviewers: rwbarton, hvr, austin

Reviewed By: austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10208
@thomie thomie Fix validate linenumber off-by-one 48977c8
Commits on Apr 03, 2015
@trommler trommler clarify --no-as-needed is only needed on ELF
From the code it was not clear that `--no-as-needed` was not necessary
on Windows. Add this fact and describe the fix for #10110 in a separate

See audit for rGHC1b7f59769052fd8193c6acc561216e070d0ca335 raised
by @thomie.

Reviewed By: thomie

Differential Revision:

GHC Trac Issues: #10110
@Javran Javran docs: remove unused -ddump flags from users guide 78c79e3
@scpmw scpmw Restore unwind information generation
While we want to reduce the amount of information generated into
debug_info, it really doesn't make sense to remove block information
for unwinding.

This is a simple oversight introduced in 4ab5702, which severly
reduces the usefulness of generated unwind data. Thanks to bitonic
for spotting this!

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10236
@Kinokkory Kinokkory parser: allow type-level cons in prefix position
Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10188
@bgamari bgamari Data.Complex: Derive Generic
Reviewed By: hvr, austin

Differential Revision:
@dalaing dalaing Remove an incorrect statement about -fwarn-tabs
Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10213
@thomie thomie Don't `make accept` output of `expect_broken_for` tests
This is a followup to d4cf705, which
did the same for `expect_broken` tests.

Reviewed By: austin

Differential Revision:
@thomie thomie Comments only, mostly typos
[skip ci]
@thoughtpolice thoughtpolice testsuite: fix failing amd64/Windows perf tests
Signed-off-by: Austin Seipp <>
@thoughtpolice thoughtpolice rts/linker: make an error msg a debug msg
This fixes more testsuite failures on Windows.

Signed-off-by: Austin Seipp <>
@thoughtpolice thoughtpolice testsuite: skip T10017 on Windows
Signed-off-by: Austin Seipp <>
Commits on Apr 05, 2015
@rwbarton rwbarton Whitespace only 89eef44
@rwbarton rwbarton Update hsc2hs submodule a1404e8
@nomeata nomeata CmmSwitch: Do not trip over a case with no (valid) branches
This fixes #10245. I did not commit the test case, as it fails
unconditionally with a compiler built with -DDEBUG, so maybe it is bogus
Haskell anyways.
Commits on Apr 06, 2015
@nomeata nomeata Test case for #10246
still marked known_broken. This also adds the test case for #10245,
which should pass once #10246 is fixed.
@thomie thomie User's guide: .a files can be 2-2.5x larger with -split-objs
And remove warning. This feature is available through cabal even.

Reviewed By: austin

Differential Revision:
@dalaing dalaing Stop profiling output from running together (#8811)
Reviewed By: thomie

Differential Revision:
@trofi trofi fix '&stg_interp_constr_entry' FFI type to be FunPtr
It used to be Ptr, which is slightly incorrect.
ia64 has different representations for those types.

Found when tried to build unregisterised ghc with -flto,
GCC's link-time optimisation which happens to check
data / code declaration inconsistencies.

It our case 'stg_interp_constr_entry' is an RTS function:
   StgFunPtr f (StgFunPtr)
while '"&f" :: Ptr()' produces
   StgWordArray f[];

Signed-off-by: Sergei Trofimovich <>

Reviewers: simonmar, hvr, austin

Reviewed By: austin

Subscribers: thomie

Differential Revision:
@Javran Javran fix typo
[skip ci]

Differential Revision:
Commits on Apr 07, 2015
@simonmar simonmar Replace hooks by callbacks in RtsConfig (#8785)
Hooks rely on static linking semantics, and are broken by -Bsymbolic
which we need when using dynamic linking.

Test Plan: Built it

Reviewers: austin, hvr, tibbe

Differential Revision:
@simonmar simonmar Add +RTS -O<size> to control the minimum old gen size 890461e
@simonmar simonmar Add -n to the RTS help output 93f3a64
@thomie thomie Typechecker: refactoring only
* don't call `nlHsPar`, as `genOpApp` already does so.
* don't reimplement `isUnboxedTupleTyCon` and `isBoxedTupleTyCon`.

Reviewed By: austin

Differential Revision:
@thomie thomie testdriver: delete unused ways
And mention more prominently that `-DDEBUG` and tests that call
`compiler_stats_num_fields` don't play well together

Reviewed By: austin

Differential Revision:
@vikasmenon vikasmenon Suggest how to fix .ghci when it is group writeable (#8248)
chmod 664 $PATH_TO_GHCI_CONF/.ghci

Run ghci. You will now get a warning + a suggestion:

  *** WARNING: $PATH_TO_GHCI_CONF/.ghci is writable by someone else, IGNORING!
  Suggested fix: execute 'chmod 644 $PATH_TO_GHCI_CONF/.ghci'

Execute fix and the warning should disappear.

Reviewed By: mboes, thomie

Differential Revision:
@simonpj simonpj Fix a long-standing bug in the demand analyser
This patch fixes Trac #10148, an outright and egregious
bug in the demand analyser.

It is explained in Note [Demand on case-alternative binders]
in Demand.hs.

I did some other minor refactoring.

To my astonishment I got some big compiler perf changes

* perf/compiler/T5837: bytes allocated -76%
* perf/compiler/T5030: bytes allocated -10%
* perf/compiler/T3294: max bytes used  -25%

Happy days
@simonpj simonpj Reduce module qualifiers in pretty-printing
The change is in HscTypes.mkPrintUnqualified, and suppresses the
module qualifier on Names from ghc-prim, base, and template-haskell,
where no ambiguity can aries.  It's somewhat arbitrary, but helps
with things like 'Constraint' which are often not in scope, but
occasionally show up in error messages.
@simonpj simonpj Error msg wibbles from reduced module prefixes c897613
@simonpj simonpj GHC.Prim.Constraint is not built-in syntax
This fixes Trac #10233
@simonpj simonpj Do not quantify over the function itself in a RULE
We were erroneously quantifying over the function when it
had a dictionary type. A bit pathological, but possible.

This fixes Trac #10251
@simonpj simonpj Put quotes round a Name in an error message
Cosmetic consistency only
@simonpj simonpj More aggressive Given/Wanted overlap check
This fixes Trac #10195

For some reason we considered untouchability before, but Trac #10195
shows that this is positively worng.

See Note [Instance and Given overlap] in TcInteract.

Looking at the Git log, it seems that this bug was introduced at the
same time that we introduced the Given/Wanted overlap check in the first
@simonpj simonpj Look inside synonyms for foralls when unifying
This fixes Trac #10194
@trommler trommler Replace endian test by 64-bit word access in T7600
In commit 3f30912 an include `ghcconfig.h` was added for

Converting the floating point array to a `Word64` array avoids
using the preprocessor altogether and leads to smaller code.

Fixes #10239

Reviewed By: rwbarton, austin

Differential Revision:

GHC Trac Issues: #10239
@trofi trofi rts/Linker.c: distinct between DATA and CODE labels when importing
The patch is a last major piece to make unregisterised GHC build
under GCC's link-time optimizer.

Before the patch we imported everything external as functions.
Now we distinct between global variables and functions.

The difference is crucial on ia64 and a complement to fixes:
    > d82f592
    > CMM: add a mechanism to import C .data labels
    > e18525f
    > pprC: declare extern cmm primitives as functions, not data

Signed-off-by: Sergei Trofimovich <>

Reviewed By: austin

Differential Revision:
@ezyang ezyang Don't repeat package key with -dppr-debug when package info is missing.
Signed-off-by: Edward Z. Yang <>

Reviewed By: austin

Differential Revision:
@alanz alanz The production for `pquals` is incorrect; the specifics are in D803.
Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10207
@alanz alanz The production for squals is incorrect; see D806 for specifics.
This diff depends on D803.

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10214
@simonpj simonpj Test Trac #10148 eacda92
@simonpj simonpj More error message wibbles
..due to suppressing base-package module names.

Needs a submodule update on array.
@simonpj simonpj Final error message wibble a058ad6
@ezyang ezyang Support for multiple signature files in scope.
A common pattern when programming with signatures is to combine multiple
signatures together (signature linking).  We achieve this by making it
not-an-error to have multiple, distinct interface files for the same module
name, as long as they have the same backing implementation.  When a user
imports a module name, they get ALL matching signatures dumped into their

On the way, I refactored the module finder code, which now distinguishes
between exact finds (when you had a 'Module') and regular finds (when
you had a 'ModuleName').  I also refactored the package finder code to
use a Monoid instance on LookupResult to collect together various results.

ToDo: At the moment, if a signature is declared in the local package,
it completely overrides any remote signatures.  Eventually, we'll want
to also pull in the remote signatures (or even override the local signature,
if the full implementation is available.)  There are bunch of ToDos in the
code for what to do once this is done.

ToDo: At the moment, whenever a module name lookup occurs in GHCi and we
would have seen a signature, we instead continue and return the Module
for the backing implementation.  This is correct for most cases, but there
might be some situations where we want something a little more fine-grained
(e.g. :browse should only list identifiers which are available through
the in-scope signatures, and not ALL of them.)

Signed-off-by: Edward Z. Yang <>

Test Plan: validate

Reviewers: simonpj, hvr, austin

Subscribers: carter, thomie

Differential Revision:

GHC Trac Issues: #9252
@ezyang ezyang Commit missing T10148 files and ignore the built executable.
Signed-off-by: Edward Z. Yang <>
@ezyang ezyang Axe one-shot sig-of
We're getting rid of -sig-of foo:A usage, because
it doesn't make sense in any compilation mode besides one-shot,
and we don't expect users to use it anyway.

Signed-off-by: Edward Z. Yang <>

Test Plan: validate

Reviewers: simonpj, austin

Subscribers: thomie

Differential Revision:
@ezyang ezyang Ignore temporary ./configure files.
Signed-off-by: Edward Z. Yang <>
Commits on Apr 08, 2015
@simonpj simonpj Test Trac #8030 53cc9af
@dalaing dalaing Fixes a compiler error with -DDEBUG (#10265)
Test Plan: validate

Reviewers: austin, ezyang, erikd, rwbarton

Reviewed By: ezyang, erikd, rwbarton

Subscribers: erikd, thomie

Differential Revision:

GHC Trac Issues: #10265
Commits on Apr 09, 2015
@rwbarton rwbarton Import rand using capi
Summary: Android has no rand symbol (it's a static inline function there).

Test Plan: ghc-android builds

Reviewers: trofi, austin, hvr

Reviewed By: hvr

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10274
@simonpj simonpj Comments about AnyK 2d68aa6
@simonpj simonpj Comments in rejigConRes d9b0be3
@simonpj simonpj Comments only 702fc77
@simonpj simonpj Make the evidence in a CtGiven into an EvId
Note [Bind new Givens immediately] in TcRnTypes

We were never using the generality.  Result: less code, more efficient.
Cake for everyone.
Commits on Apr 10, 2015
@ggreif ggreif Typos in error messages and in comments 9d16808
@erikd erikd configure : LLVM and LD detections improvements (#10234).
* distrib/ : Detect correct version of LLVM tools as
  was done for the top level in 42448e3.
* aclocal.m4 : Add a FIND_LD macro that can be used in both
  configure scripts.
* Use new FIND_LD macro in both configure scripts.

Signed-off-by: Erik de Castro Lopo <>

Test Plan: validate on amd64-linux and armhf-linux.

Reviewers: rwbarton, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10234
Commits on Apr 14, 2015
@thoughtpolice thoughtpolice Fix autoconf's check for create_timer()
GHC build system have custom autoconf check for `create_timer()`
function from librt. Check description says that it checks for
`CLOCK_REALTIME` timer, but checking code also checks for
`CLOCK_PROCESS_CPUTIME_ID` timer, which is not commonly present (for
example, FreeBSD doesn't have it). This makes whole check fail despite
the fact that FreeBSD have `create_timer()` call and supports
`CLOCK_REALTIME`. As a consequence, GHC RTS falls back to using SIGALRM
for its timing machinery. Not only it's very ancient codepath, it also
break some FFI bindings to C code that isn't prepared for syscall
interruption caused by SIGALRM delivery.

Grepping through ghc source code reveals that `USE_TIMER_CREATE`
defininition in the config.h doesn't imply having
`CLOCK_PROCESS_CPUTIME_ID`. The only place where
`CLOCK_PROCESS_CPUTIME_ID` is used is rts/posix/GetTime.c and this code
handles the absence of `CLOCK_PROCESS_CPUTIME_ID` gracefully.

This patch makes autoconf checking code to check only for
`timer_create(CLOCK_REALTIME, ...)` and fixes check description.

Reviewed By: austin

Differential Revision:
@hvr hvr Derive Generic instance for System.Exit.ExitCode
Reviewed By: austin

Differential Revision:
@hvr hvr Derive Generic instance for Data.Version.Version
Reviewed By: austin

Differential Revision:
@luite luite use projectVersion from DynFlags rather than cProjectVersion for vers…

Reviewed By: edsko, austin

Differential Revision:

GHC Trac Issues: #10232
@alanz alanz parser: opt_kind_sig has incorrect SrcSpan
The production for opt_kind_sig is

  opt_kind_sig :: { Located (Maybe (LHsKind RdrName)) }
          :                             { noLoc Nothing }
          | '::' kind                   {% ajl (sLL $1 $> (Just $2)) AnnDcolon (gl $1) }

The outer Location is used only to get the full span for the enclosing
declration, and is then stripped. The inner LHsKind then has a SrcSpan that does
not include the '::'

Extend the SrcSpan on $2 to include $1

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10209
@alanz alanz parser: API Annotations : guardquals1 does not annotate commas properly
The `guardquals1` production includes

   : guardquals1 ',' qual  {% addAnnotation (gl $ last $ unLoc $1) AnnComma
                                             (gl $2) >>
                               return (sLL $1 $> ($3 : unLoc $1)) }

The AnnComma should be attached to `(gl $ head $ unLoc $1)`, rather than

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10256
@alanz alanz parser : the API annotation on opt_sig is being discarded
The opt_sig production is defined as

  opt_sig :: { ([AddAnn],Maybe (LHsType RdrName)) }
          : {- empty -}                   { ([],Nothing) }
          | '::' sigtype                  { ([mj AnnDcolon $1],Just $2) }

It is used in the alt and decl_no_th productions, but neither of them
add the returned annotations.

This commit captures the annotations in the calling productions.

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10254
@simonpj simonpj Zap usage info in CSE (Trac #10218)
Trac #10218 reports a subtle bug that turned out to be:

- CSE invalidated the usage information computed
  by earlier demand analysis, by increasing sharing

- that made a single-entry thunk into a multi-entry thunk

- and with -feager-blackholing, that led to <<loop>>

The patch fixes it by making the CSE pass zap usage information for
let-bound identifiers.   It can be restored by -flate-dmd-anal.

(But making -flate-dmd-anal the default needs some careful work;
see Trac #7782.)
@simonpj simonpj Comments only 25f2d68
@simonpj simonpj Comments and white space only a2ce3af
@k-bx k-bx Add "error:" prefix to error-messages
Add "error:" prefix to error-messages, also lowercase "Warning:"
message to match GCC behavior closer.

Reviewed By: thomie, austin

Differential Revision:

GHC Trac Issues: #10021
@ezyang ezyang Remove LlvmCodeGen panic variants.
It's pretty irritating having hasktags with multiple top-level
declarations with the same type; hasktags can't figure out which
declaration you actually wanted.

Signed-off-by: Edward Z. Yang <>

Reviewed By: dterei, austin

Differential Revision:
@alanz alanz API Annotations : ExprWithTySig processing discards annotated spans
In RdrHsSyn.checkAPat the processing for ExprWithTySig is defined as

   ExprWithTySig e t _ -> do e <- checkLPat msg e
                             -- Pattern signatures are parsed as sigtypes,
                             -- but they aren't explicit forall points.  Hence
                             -- we have to remove the implicit forall here.
                             let t' = case t of
                                        L _ (HsForAllTy Implicit _ _
                                             (L _ []) ty) -> ty
                                        other -> other
                             return (SigPatIn e (mkHsWithBndrs t'))

The t' variable ends up losing its original SrcSpan in the first case
branch. This results in annotations becoming detached from the AST.

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10255
@alanz alanz ApiAnnotations : lexer discards comment close in nested comment
When parsing a nested comment, such as

  {-  nested comment  -}
  {-# nested pragma  #-}

The lexer returns the comment annotation as

  {-  nested comment
  {-# nested pragma  #

Restore the missing comment end markers in the annotation.

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #10277
@int-e int-e Implement -f[no-]print-unicode-syntax flag for unicode syntax output …

There is currently no way to separate whether UnicodeSyntax is accepted
for input from the corresponding output syntax using unicode symbols.
This patch implements a separate flag for affecting ghc(i)'s output.

Signed-off-by: Bertram Felgenhauer <>

Reviewed By: nomeata, austin

Differential Revision:

GHC Trac Issues: #8959
@simonpj simonpj Do not allow Typeable on constraints (Trac #9858)
The astonishingly-ingenious trio of
Shachaf Ben-Kiki, Ørjan Johansen and Nathan van Doorn
managed to persuade GHC 7.10.1 to cough up unsafeCoerce.

That is very bad. This patch fixes it by no allowing Typable
on Constraint-kinded things.  And that seems right, since
it is, in effect, a form of impredicative polymorphism,
which Typeable definitely doesn't support.

We may want to creep back in the direction of allowing
Typeable on constraints one day, but this is a good
fix for now, and closes a terrible hole.
Commits on Apr 15, 2015
@simonpj simonpj Fix fundep coverage-condition check for poly-kinds
See Note [Closing over kinds in coverage] in FunDeps.
I'd already fixed this bug once, for Trac #8391, but I put the
call to closeOverKinds in the wrong place, so Trac #10109
failed.  (It checks the /liberal/ coverage condition, which

The fix was easy: move the call to the right place!
@nomeata nomeata Improve Call Arity performance
This improves how the Call Arity deals with "boring" variables. Boring
variables are those where it does not bother to include in the analysis
result, so whenever something is looked up in the analysis result, we
have to make a conservative assumption about them.

Previously, we extended the result with such conservative information
about them, to keep the code uniform, but that could blow up the amount
of data passed around, even if only temporarily, and slowed things down.

We now pass around an explicit list (well, set) of variable that are
boring and take that into account whenever we use the result. Not as
pretty, but noticably faster.
Commits on Apr 16, 2015
@nomeata nomeata Call Arity: Trade precision for performance in large mutually recursi…
…ve groups

Sometimes (especial with derived Data instances, it seems), one can have
very large mutually recursive bindings. Calculating the Call Arity
analysis result with full precision is an expensive operation in these
case. So above a certain threshold (25, for no good reason besides
intuition), skip this calculation and assume the recursion is not
linear, which is a conservative result.

With this, the Call Arity analysis accounts for 3.7% of the compile time
of haskell-src-exts. Fixes #10293

Differential Revision:
@yav yav Add exception for `KnownNat` and `KnownSymbol` in super classes.
The situation is similar to `Typeable`---we can't set the evidence
outside the solver because we have custom solving rules.  This is safe
because the computed super-class instances can't possibly depend
on the new instance.
@yav yav Fixes (hopefully!) T9858
The changes are:
  1. No impredicative types in `Typeable`
  2. Distinguish normal tuples, from tuples of constraints.
@yav yav Fix test output. e68e8ca
@yav yav Fix test output ea579d9
@yav yav Rename tests so that they have a unique name. 3b90d8c
Commits on Apr 17, 2015
@Javran Javran Better hints when RTS options not available (Trac #9579)
This patch provides user with a better hint when most RTS options
are not available (not compiled with `-rtsopts`).

A new field "rtsOptsEnabled" is added into RtsFlags.MiscFlags to
tell the availablity of RTS options.

Some concerns:
* Unlike other flag fields in "libraries/base/GHC/RTS/Flags.hsc",
  "RtsOptsEnabled" is defined in "includes/RtsAPI.h" and lacks
  constant macros. Therefore In "GHC.RTS", "RtsOptsEnabled" simply
  derives Enum instance and reads as of type "CInt".

* There are other ways to change RTS options (e.g. `-with-rtsopts`),
  but it might be too verbose to mention.

Test Plan: validate

Reviewers: austin, hvr, thomie, simonmar

Reviewed By: thomie

Subscribers: thomie, rwbarton

Differential Revision:

GHC Trac Issues: #9579
@ezyang ezyang Documentation for rnImports/rnImportDecl.
Signed-off-by: Edward Z. Yang <>

Test Plan: comments only

Reviewers: simonpj, austin

Subscribers: thomie

Differential Revision:
@ezyang ezyang Comments only.
Signed-off-by: Edward Z. Yang <>

Test Plan: comments only

Reviewers: simonpj, austin, goldfire

Subscribers: thomie

Differential Revision:
@ezyang ezyang Stub out pkgState with non-error, helps with debugging.
When we use -dppr-debug, we'll sometimes attempt to
hit the pkgState to give more detailed information.  It's pretty
annoying to have this fail because we haven't filled in the
pkgState: we can still get useful debugging information by
printing the raw package key.  To avoid this, we just put
in some empty stub pkgState, to be filled in later.

Signed-off-by: Edward Z. Yang <>

Test Plan: validate

Reviewers: simonpj, austin

Subscribers: thomie

Differential Revision:
@ezyang ezyang Make T9579 parallel-safe and add build outputs to .gitignore
Signed-off-by: Edward Z. Yang <>
Commits on Apr 18, 2015
@rwbarton rwbarton Test case for indirect dependencies in ghci linker (#10322) 88b8406
Commits on Apr 20, 2015
@hvr hvr Update Cabal submodule to release
Highlights since

- cabal check will fail on -fprof-auto passed as a ghc-option
- filterConfigureFlags: filter more flags.
- fix ghcjs-pkg version number handling

Addresses #10304
@simonpj simonpj Teach DmdAnal that coercions are value arguments!
The demand analyser was treating coercion args like type args,
which meant that the arguments in a strictness signature got
out of step with the arguments of a call.  Result chaos and
disaster.  Trac #10288 showed it up.

It's hard to get this bug to show up in practice because
 - functions abstracted over coercions are usually abstracted
   over *boxed* coercions
 - we don't currently unbox a boxed-coercion arg because it's
   GADT (I see how to fix this too)

But after floating, optimisation, and so on, Trac #10288 did
get a function abstracted over an unboxed coercion, and then
the -flate-dmd-anal pass went wrong.

I don't think I can come up with a test case, but I don't think
it matters too much.

Still to come
 - Fix a second bug, namely that coercion variables are wrongly
   marked as absent because DmdAnal doesn't check the the free
   variables of casts. I think this never bites in practice
   (see the follow-up commit)

 - Make GADT products work with strictness analysis
Commits on Apr 21, 2015
@simonpj simonpj Teach DmdAnal about free coercion variables
Coercion variables are used in casts and coercions, so the demand
analyser should jolly well not regard them as absent!

In fact this bug never makes a difference because even absent
unboxed-coercion arguments are passed anyway;
see WwLib.mk_abesnt_let, which returns Nothing for coercion Ids.

But it was simply wrong before and that is never cool.
@simonpj simonpj Spelling in comment d12c7cb
@simonpj simonpj Support unboxing for GADT product types
Beofre this commit we never unboxed GADT, even if they
are perfectly civilised products.

This patch liberalises unboxing slightly.
See Note [Product types] in TyCon.

Still to come
 - for strictness, we could maybe deal with existentials too
 - todo: unboxing constructor arguments
@simonpj simonpj Wibble to DmdAnal
This fixes a typo in d5773a4
    Teach DmdAnal that coercions are value arguments!
    (Trac #10288)

Sorry about that; I'm not sure how it slipped through.
@simonpj simonpj GADTs now are CPR-able
Accompanies f2d1b7f
Support unboxing for GADT product types
@erikd erikd Enable SMP and GHCi support for Aarch64
Signed-off-by: Erik de Castro Lopo <>

Test Plan: Full build on Aarch64

Reviewers: rwbarton, bgamari, austin

Subscribers: thomie

Differential Revision:
@erikd erikd Use the gold linker for aarch64/linux (#9673)
Like 32 bit Arm, Aarch64 requires use of the gold linker.

Signed-off-by: Erik de Castro Lopo <>

Test Plan: 'make install' on aarch64, validate elsewhere

Reviewers: rwbarton, bgamari, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #9673
Commits on Apr 22, 2015
@simonpj simonpj Add a blank line 3b932cc
@simonpj simonpj Fix the boot dfun impedence-matching binding
In TcRnDriver.checkHiBootIface' we were generating an
impedence-matching binding
   $fxToRecMaybe = $fToRecMaybe
but the type of the former was gotten from the *hi-boot*
file, so its type constructor was not fully fleshed out.
That should never happen.

Fix is easy, happily.  A dark corner.
@simonpj simonpj Do not decompose => (Trac #9858)
We really don't want to unify (a b) with (Eq a => ty).
The ever-ingenious Oerjan discovered this problem;
see comment:101 in Trac #9858.

See Note [Decomposing fat arrow c=>t] in Type.hs
@nomeata nomeata Mark T8743 as passing
as Simons recent commit 9b9fc4c fixed
@ezyang ezyang Don't use self {-# SOURCE #-} import in test-cases.
It's kind of buggy, c.f. #10182, and isn't motivated by any
real world programs, so we're going to get rid of it (despite
it being handy for GHC test cases.)

Signed-off-by: Edward Z. Yang <>

Test Plan: validate

Reviewers: simonpj, austin

Subscribers: thomie

Differential Revision:
@ezyang ezyang Fix #10182 by disallowing/avoiding self {-# SOURCE #-} imports
hs-boot declarations were leaking into the EPS due to
self {-# SOURCE #-} imports, and interface loading induced by
orphan instances.  For the former, we simply disallow self
{-# SOURCE #-} imports; for the latter, we simply just don't
load an interface if it would be ourself.

Signed-off-by: Edward Z. Yang <>

Test Plan: validate

Reviewers: simonpj, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10182
@simonpj simonpj Fix superclass generation in an instance
More fallout from the silent-superclass refactoring; nothing drastic.
Fixes Trac #10335.
@simonpj simonpj Comments only 9d3bd3d
@simonpj simonpj Improve error reporting for impredicative types
Don't suggest -XImpredicativeTypes; and document its flakiness
Fixes Trac #10325
@simonpj simonpj Better documetation of higher rank types
In response to suggestions on Trac #10281
@simonpj simonpj Test Trac #9858 comment:101 932f086
@nomeata nomeata Rename new T9858c to T9858d to avoid test name clash 43d7137
@nomeata nomeata Rename new T9858d to T9858e to avoid test name clash
(Next time, when fixing someone else’s mistake, I really shouldn’t do
the precise same thing.)
Commits on Apr 24, 2015
@nomeata nomeata Make sure GHC.List.last is memory-efficient
by eta-expanding its definition so that GHC optmizes the foldl here.
Also make sure that other uses of last go via foldl as well, to allow
list fusion (tested in T9339). Fixes #10260.
@goldfirere goldfirere Rename role annotations w.r.t only local decls.
Fix #10263.
@goldfirere goldfirere Fix #10285 by refusing to use NthCo on a newtype.
During this commit, I tested to make sure that CoreLint actually
catches the Core error if the typechecker doesn't.

Test case: typecheck/should_fail/T10285
@goldfirere goldfirere Fix the formal operational semantics (#10121)
This adapts the work of Christiaan Baaij to present a sensible
operational semantics for FC with mutual recursion.
@goldfirere goldfirere Test #10321 in ghci/scripts/T10321 d4cf559
@goldfirere goldfirere Test case for #10141 dc587fe
@goldfirere goldfirere Change default roles in hs-boot files. (#9204)
Test case: roles/should_compile/T9204b
@ezyang ezyang Updates to Backpack documentation based on recent visit to MSRC.
Includes lots of shaping examples, and a shaping algorithm description.

Signed-off-by: Edward Z. Yang <>
Commits on Apr 25, 2015
@hvr hvr Bump base version to
This is needed because GHC 7.10.2 requires a minor version bump to base-

Several test outputs needed base- replaced by base-
@hvr hvr Add missing since-annotations for c024af1
See also #9049
@bgamari bgamari base: Export GHC.Event(.Internal).Lifetime
This was an unfortunate oversight in the original event manager rework
patch. Fixes #10308

Differential Revision:
Commits on Apr 27, 2015
@ezyang ezyang Flesh out some more Backpack examples in the merging section.
Signed-off-by: Edward Z. Yang <>
@ezyang ezyang Backpack docs: explain alternate merging scheme.
Signed-off-by: Edward Z. Yang <>
@ezyang ezyang Full type checking Backpack details.
Signed-off-by: Edward Z. Yang <>
Commits on Apr 29, 2015
@ezyang ezyang Backpack docs: merge backpack-shaping into algorithm, sigs no longer …

Signed-off-by: Edward Z. Yang <>
@simonpj simonpj Seed SpecConstr from local calls
Seed SpecConstr based on *local* calls as well as *RHS* calls.
See Note [Seeding top-level recursive groups].  The change here
is mentioned here:

   NB: before Apr 15 we used (a) only, but Dimitrios had an example
       where (b) was  crucial, so I added that.

This is a pretty small change, requested by Dimitrios, that adds
SpecConstr call patterns from the rest of the module, as well as ones
from the RHS.

Still to come: #10346.
@simonpj simonpj A little outright bug in canEqTyVar2
I had 'ev' where I should have had 'new_ev'.  It's quite hard to make
this bug cause a failure, but I did eventually get a Lint error
somewhere.  Anyway, it's just a typo, I think.
@simonpj simonpj Don't print evidence in TcFlatten
Because when flattening a Derived constraint, the evidence doesn't exist
(it's an error thunk)
@simonpj simonpj Improve improvement in the constraint solver
This regrettably-big patch substantially improves the way in which
"improvement" happens in the constraint solver.  It was triggered by
trying to crack Trac #10009, but it turned out to solve #10340 as

The big picture, with several of the trickiest examples, is described
in Note [The improvement story] in TcInteract.

The major change is this:

* After solving we explicitly try "improvement", by
     - making the unsolved Wanteds into Deriveds
     - allowing Deriveds to rewrite Deriveds
  This more aggressive rewriting "unlocks" some extra
  guess-free unifications.

* The main loop is in TcInteract.solveSimpleWanteds, but I also ended
  up refactoring TcSimplify.simpl_loop, and its surrounding code.

  Notably, any insolubles from the Givens are pulled out
  and treated separately, rather than staying in the inert set
  during the solveSimpleWanteds loop.

There are a lot of follow-on changes

* Do not emit generate Derived improvements from Wanteds.
  This saves work in the common case where they aren't needed.

* For improvement we should really do type-class reduction on Derived
  constraints in doTopReactDict.  That entailed changing the GenInst
  constructor a bit; a local and minor change

* Some annoying faffing about with dropping derived constraints;
  see dropDerivedWC, dropDerivedSimples, dropDerivedInsols,
  and their Notes.

* Some substantial refactoring in TcErrors.reportWanteds.
  This work wasn't strictly forced, but I got sucked into it.
  All the changes are in TcErrors.

* Use TcS.unifyTyVar consistently, rather than setWantedTyBind,
  so that unifications are properly tracked.

* Refactoring around solveWantedsTcM, solveWantedsAndDrop.
  They previously guaranteed a zonked result, but it's more
  straightforward for clients to zonk.
@simonpj simonpj Test Trac #10226
Fixed by the patch for #10009
@simonpj simonpj Typeset Backpack syntax in a figure 54cefbd
Commits on Apr 30, 2015
@simonpj simonpj Tidy up treatment of FlexibleContexts
Previously (Trac #10351) we could get

    Non type-variable argument in the constraint: C [t]
    (Use FlexibleContexts to permit this)
    When checking that `f' has the inferred type
      f :: forall t. C [t] => t -> ()

which is a bit stupid: we have *inferred* a type that we
immediately *reject*.  This patch arranges that that the
generalisation mechanism (TcSimplify.decideQuantification)
doesn't pick a predicate that will be rejected by the
subsequent validity check.

This forced some minor refactoring, as usual.
@ggreif ggreif Typo fixes (mostly in comments) a3f7517
@ezyang ezyang Typeset Backpack semantic entities in figure, figure-ify all asides.
Signed-off-by: Edward Z. Yang <>
Commits on May 01, 2015
@simonpj simonpj Comments only bbfa0ca
@simonpj simonpj Refactor TyCon to eliminate TupleTyCon
This makes TupleTyCon into an ordinary AlgTyCon, distinguished
by its AlgTyConRhs, rather than a separate constructor of TyCon.

It is preparatory work for making constraint tuples into classes,
for which the ConstraintTuple tuples will have a TyConParent
of a ClassTyCon.  Tuples didn't have this possiblity before.

The patch affects other modules because I eliminated the
unsatisfactory partial functions tupleTyConBoxity and tupleTyConSort.
And tupleTyConArity which is just tyConArity.
@simonpj simonpj Update haddock submodule to track TyCon change 0d715db
@simonpj simonpj Make Derived NomEq rewrite only Derived NomEq
See Note [Deriveds do rewrite Deriveds].  The important point
is that we want to maintain the Note [Can-rewrite relation]
property, lest we risk loops.
@simonpj simonpj Kill off the default types in ghc-prim
We were trying to load the type for Integer to do defaulting
in ghc-prim, but it's simply not available at that time.
@simonpj simonpj Move IP, Symbol, Nat to ghc-prim
This motivation is to declare class IP much earlier (in ghc-prim),
so that implicit parameters (which depend on IP) is available
to library code, notably the 'error' function.

* Move class IP from base:GHC.IP
                to ghc-prim:GHC.Classes
* Delete module GHC.IP from base

* Move types Symbol and Nat
      from base:GHC.TypeLits
      to ghc-prim:GHC.Types

There was a name clash in GHC.RTS.Flags, where I renamed
the local type Nat to RtsNat.
Commits on May 04, 2015
@adamgundry adamgundry Permit empty closed type families
Fixes #9840 and #10306, and includes an alternative resolution to #8028.
This permits empty closed type families, and documents them in the user
guide. It updates the Haddock submodule to support the API change.

Test Plan: Added `indexed-types/should_compile/T9840` and updated
`indexed-types/should_fail/ClosedFam4` and `th/T8028`.

Reviewers: austin, simonpj, goldfire

Reviewed By: goldfire

Subscribers: bgamari, jstolarek, thomie, goldfire

Differential Revision:

GHC Trac Issues: #9840, #10306
@erikd erikd arm: Force non-executable stack (#10369)
Test `T703` was found to be failing on arm/linux. The solution
was to add a linker flag to explicitly set the stack to

Signed-off-by: Erik de Castro Lopo <>

Test Plan: validate on x86_64 and arm linux

Reviewers: ezyang, rwbarton, austin

Subscribers: bgamari, thomie

Differential Revision:

GHC Trac Issues: #10369
@erikd erikd Fix safeHaskell test for llvm backend
Test was failing (could not execute: pgmlc) for arm (which uses
the llvm backend) due to the `-pgmlc pgmlc` in OPTIONS_GHC. It
was also failing on amd64 in the same way when `-fllvm` was
added to the command line. Its safe to remove because the
compiler should already know which llvm tool to use.

Test Plan: validate

Reviewers: dterei, austin

Subscribers: bgamari, thomie

Differential Revision:
@ezyang ezyang Give a hint when a TH splice has a bad package key, partially fixes #…

Previously, if we got a package key in our splice, we'd give
a very unhelpful error message saying we couldn't find
a package 'base-', despite there being a package with
that source package ID.  Really, we couldn't find a package with
that *key*, so clarify, and also tell the user what the real
package key is.

Signed-off-by: Edward Z. Yang <>
@ezyang ezyang Documentation for Language.Haskell.TH.Quote.
Signed-off-by: Edward Z. Yang <>

Test Plan: validate

Reviewers: simonpj, austin

Subscribers: thomie

Differential Revision:
Commits on May 05, 2015
@erikd erikd arm: Force non-executable stack (part 2)
This was supposed to be part of commit 63a10bb but I pushed
from the wrong machine. This fixes cross compiling to arm.

Signed-off-by: Erik de Castro Lopo <>
@ezyang ezyang Doc: checkCrossStageLifting, RnSplice/TcExpr is untyped/typed bracket…
…s (#10384)

Clarify that repeated checkCrossStageLifting in RnSplice/TcExpr
check untyped/typed brackets, respectively.

Signed-off-by: Edward Z. Yang <>