4 years agoSrcLoc: Eliminate constructors of RealSrcSpan
Ben Gamari [Fri, 18 Dec 2015 16:21:22 +0000 (17:21 +0100)] 
SrcLoc: Eliminate constructors of RealSrcSpan

This type is occurs very often but previously had multiple, meaning it
could not be unboxed. Even worse, these constructors didn't offer any
compelling safety benefits. Thankfully, the type is abstract, so
changing the representation to be a single-constructor type was quite

Reviewers: austin

Subscribers: alanz, thomie, hvr

Differential Revision:

4 years agotcCheckSatisfiability: less aggressive superclass expansion
Simon Peyton Jones [Fri, 18 Dec 2015 15:34:17 +0000 (15:34 +0000)] 
tcCheckSatisfiability: less aggressive superclass expansion

In the pattern-match check we are looking for a proof of
*unsatisfiablity* among a bunch of givens.  The unsat-ness might be
hidden in the superclasses, so we must expand them.  But in the common
case where the constraints are satisfiable, we don't want to expand
a recursive superclass forever.

This is all a bit arbitrary, but then the whole question is
undecidable anyway.

The bug in Trac #10592 comment:12 was that I expanded superclasses
forever.  This patch fixes it.

4 years agoTest Trac #11248, #11249
Simon Peyton Jones [Fri, 18 Dec 2015 15:30:45 +0000 (15:30 +0000)] 
Test Trac #11248, #11249

4 years Rename build/ to shake-build/
Ben Gamari [Fri, 18 Dec 2015 12:33:42 +0000 (13:33 +0100)] Rename build/ to shake-build/

Last naming change... I promise.

4 years Rename shake/ to build/
Ben Gamari [Fri, 18 Dec 2015 10:57:52 +0000 (11:57 +0100)] Rename shake/ to build/


4 years agoGHCi.Run: Remove redundant language pragma
Ben Gamari [Fri, 18 Dec 2015 10:56:37 +0000 (11:56 +0100)] 
GHCi.Run: Remove redundant language pragma

4 years agoUpdate Win32 submodule to fix 77b7f24543f fallout
Herbert Valerio Riedel [Fri, 18 Dec 2015 11:56:38 +0000 (12:56 +0100)] 
Update Win32 submodule to fix 77b7f24543f fallout

Turns out Win32 wasn't de-tabbed yet... sigh...

[skip ci]

4 years agoComments only
Simon Peyton Jones [Fri, 18 Dec 2015 08:50:37 +0000 (08:50 +0000)] 
Comments only

4 years agoUpdate directory submodule to v1.2.5.0 release
Herbert Valerio Riedel [Fri, 18 Dec 2015 09:53:17 +0000 (10:53 +0100)] 
Update directory submodule to v1.2.5.0 release

This is the designated release to go with GHC 8.0.1

4 years agoFix PowerPC build
Erik de Castro Lopo [Fri, 18 Dec 2015 09:21:19 +0000 (20:21 +1100)] 
Fix PowerPC build

Replace incorrect `ppc_HOST_ARCH` with `powerpc_HOST_ARCH`.

Test Plan: Build on PowerPC

Reviewers: hvr, austin, bgamari

Subscribers: thomie

Differential Revision:

4 years agoUse `-Wno-tabs` more targetted
Herbert Valerio Riedel [Fri, 18 Dec 2015 09:45:22 +0000 (10:45 +0100)] 
Use `-Wno-tabs` more targetted

So far only `time` (fixed upstream already though) and `xhtml` still require
`-Wno-tabs`, so let's apply that warning suppression flag only there.

This also updates the haskeline submodule to pull in a tab-fix

4 years agoDocumentation for -fexternal-interpreter
Simon Marlow [Fri, 18 Dec 2015 09:08:36 +0000 (09:08 +0000)] 
Documentation for -fexternal-interpreter

4 years agoTestsuite Windows: fix ghcpkg03 and ghcpkg05
Thomas Miedema [Thu, 17 Dec 2015 23:49:45 +0000 (00:49 +0100)] 
Testsuite Windows: fix ghcpkg03 and ghcpkg05

4 years agoTestsuite Windows: fix sigof01m, sigof012m and sigof02dm
Thomas Miedema [Thu, 17 Dec 2015 23:45:28 +0000 (00:45 +0100)] 
Testsuite Windows: fix sigof01m, sigof012m and sigof02dm

4 years agoTestsuite: widen lazy-bs-alloc 3->5%
Thomas Miedema [Thu, 17 Dec 2015 23:36:36 +0000 (00:36 +0100)] 
Testsuite: widen lazy-bs-alloc 3->5%

4 years agoghci: fix UNREG build (missing fromJust import)
Sergei Trofimovich [Fri, 18 Dec 2015 00:00:41 +0000 (00:00 +0000)] 
ghci: fix UNREG build (missing fromJust import)

libraries/ghci/GHCi/InfoTable.hsc:249:45: error:
    • Variable not in scope: fromJust :: Maybe EntryFunPtr -> a0
    • Perhaps you meant ‘fromList’ (imported from GHC.Exts)

Signed-off-by: Sergei Trofimovich <>
Test Plan: build --enable-unregisterised ghc

Reviewers: simonmar, bgamari, austin

Reviewed By: austin

Subscribers: thomie

Differential Revision:

4 years agoRandom typo fixes
Herbert Valerio Riedel [Thu, 17 Dec 2015 22:59:59 +0000 (23:59 +0100)] 
Random typo fixes

[skip ci]

4 years agoUpdate containers submodule to v0.5.7.0 release
Herbert Valerio Riedel [Thu, 17 Dec 2015 22:30:53 +0000 (23:30 +0100)] 
Update containers submodule to v0.5.7.0 release

This is the designated release to go with GHC 8.0.1

This release doesn't need any warning-suppression flags anymore, so
remove those from mk/

/cc @foxik

4 years agoMove Data.Functor.(Classes,Compose,Product,Sum) into base
RyanGlScott [Thu, 17 Dec 2015 19:22:25 +0000 (20:22 +0100)] 
Move Data.Functor.(Classes,Compose,Product,Sum) into base

These modules were previously provided by the `transformers`
package. Hence the submodule update.

This patch was originally contributed by M Farkas-Dyck and
subsequently taken over and completed by Ryan.

The original proposal discussion can be found at

This addresses #11135

Differential Revision:

4 years agoTestsuite: mark frontend01 conditionally expect_broken on #10301
Thomas Miedema [Thu, 17 Dec 2015 20:42:04 +0000 (21:42 +0100)] 
Testsuite: mark frontend01 conditionally expect_broken on #10301

This should fix validate on Travis.

4 years agoSuppress warnings when compiling primitive and random
Thomas Miedema [Thu, 22 Oct 2015 15:50:03 +0000 (17:50 +0200)] 
Suppress warnings when compiling primitive and random

And fix a redundant constraint warning in a test that requires

4 years agoBuild system: allow bindist without docs
Thomas Miedema [Tue, 27 Oct 2015 22:43:58 +0000 (23:43 +0100)] 
Build system: allow bindist without docs

Useful for testing 'make binary-dist-prep' when HADDOCK_DOCS=NO.

Reviewed by: bgamari

Differential Revision:

4 years agoTestsuite: allow spaces in TEST_HC passed in by the user
Thomas Miedema [Wed, 28 Oct 2015 09:35:08 +0000 (10:35 +0100)] 
Testsuite: allow spaces in TEST_HC passed in by the user

Don't use the GNU make function 'realpath' (reverting e66a81c6),
because it doesn't handle spaces in paths. Instead, use 'cygpath' to
convert Windows style paths (e.g. C:/foo/) to mingw style paths (e.g.
c/foo/), and then call 'which'.

 * make TEST_HC=ghc
 * make TEST_HC=/d/home/thomie/ghc-validate/bindisttest/install\ \ \ dir/bin/ghc
 * make TEST_HC=D:/home/thomie/ghc-validate/bindisttest/install\ \ \ dir/bin/ghc

Reviewed by: Phyx

Differential Revision:

4 years agoBuild system: also put scripts in libexecdir/bin
Thomas Miedema [Thu, 17 Dec 2015 18:45:13 +0000 (19:45 +0100)] 
Build system: also put scripts in libexecdir/bin

This follows a similar change in
4905b83a2d448c65ccced385343d4e8124548a3b, where binaries are installed
in libexecdir/bin instead of libexecdir.

This fixes a problem with ghc not able to find ghc-split, when

4 years agoFix #11230.
Richard Eisenberg [Tue, 15 Dec 2015 22:36:32 +0000 (17:36 -0500)] 
Fix #11230.

Previously, we were optimizing away all case expressions over
coercions with dead binders. But sometimes we want to force
the coercion expression. Like when it contains an error.

Test case: typecheck/should_run/T11230

4 years agoFix tcTyClTyVars to handle SigTvs
Richard Eisenberg [Tue, 15 Dec 2015 18:47:14 +0000 (13:47 -0500)] 
Fix tcTyClTyVars to handle SigTvs

Previously, tcTyClTyVars required that the names of the LHsQTyVars
matched up exactly with the names of the kind of the given TyCon.
It now does a bit of matching up when necessary to relax this

This commit enables a few tests that had previously been disabled.

The shortcoming this addresses is discussed in #11203, but that
ticket is not directly addressed here.

Test case: polykinds/SigTvKinds, perf/compiler/T9872d

4 years agoIO Handles: update comments [skip ci]
Thomas Miedema [Mon, 14 Dec 2015 16:00:27 +0000 (17:00 +0100)] 
IO Handles: update comments [skip ci]

* hSetEcho, hGetEcho and hIsTerminalDevice are part of the Haskell2010
report (but not Haskell98)

* there are great `Note`s in GHC.IO.Handle.Types. Link to them.

4 years agoLexer: update outdated comments [skip ci]
Thomas Miedema [Wed, 11 Nov 2015 01:17:56 +0000 (02:17 +0100)] 
Lexer: update outdated comments [skip ci]

The test for TemplateHaskell was removed in

4 years agoTestsuite: #10712 is fixed
Thomas Miedema [Thu, 17 Dec 2015 17:18:30 +0000 (18:18 +0100)] 
Testsuite: #10712 is fixed

Verified by running:

  make TEST='exceptionsrun001 T3279 conc012 conc014' slowtest

4 years agoRemove warning-suppression flags for Cabal
Herbert Valerio Riedel [Thu, 17 Dec 2015 15:52:55 +0000 (16:52 +0100)] 
Remove warning-suppression flags for Cabal

Cabal is currently warning free. So let's drop the `-w`-flags.

/cc @dcoutts

4 years agoDisable recomp015 on ARM
Ben Gamari [Thu, 17 Dec 2015 14:24:41 +0000 (15:24 +0100)] 
Disable recomp015 on ARM

Due to differences in assembly syntax. See #11022.

4 years agoT9961 allocations crept further upwards
Ben Gamari [Thu, 17 Dec 2015 14:10:18 +0000 (16:10 +0200)] 
T9961 allocations crept further upwards


4 years agoUpdate Cabal submodule
Ben Gamari [Thu, 17 Dec 2015 12:41:09 +0000 (13:41 +0100)] 
Update Cabal submodule

Previously it didn't build on Windows.

4 years agoRemove unused T10524.stderr
Simon Peyton Jones [Wed, 16 Dec 2015 10:38:54 +0000 (10:38 +0000)] 
Remove unused T10524.stderr

4 years agoImprove pretty-printing in pprIfaceIdBndr
Simon Peyton Jones [Mon, 14 Dec 2015 13:34:26 +0000 (13:34 +0000)] 
Improve pretty-printing in pprIfaceIdBndr

In particular, add parnes when we need an explicit type.

4 years agousers_guide: Remove extraneous vertical whitespace
Ben Gamari [Thu, 17 Dec 2015 11:26:43 +0000 (12:26 +0100)] 
users_guide: Remove extraneous vertical whitespace

4 years agoAdd -fprint-typechecker-elaboration flag (fixes #10662)
Eugene Akentyev [Thu, 17 Dec 2015 11:22:44 +0000 (12:22 +0100)] 
Add -fprint-typechecker-elaboration flag (fixes #10662)

Reviewers: thomie, austin, bgamari

Reviewed By: thomie, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10662

4 years agoReify DuplicateRecordFields by label, rather than by selector
Adam Gundry [Thu, 17 Dec 2015 11:19:23 +0000 (12:19 +0100)] 
Reify DuplicateRecordFields by label, rather than by selector

See `Note [Reifying field labels]` in `TcSplice`. This makes
typical uses of TH work better with `DuplicateRecordFields`.
If `reify` is called on the `Name` of a field label produced by
the output of a previous `reify`, and there are multiple  fields
with that label defined in the same module, it may fail with
an ambiguity error.

Test Plan:
Added tests, and manually tested that this makes
Aeson's `deriveJSON` avoid the `$sel:` prefixes.

Reviewers: simonpj, goldfire, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11103

4 years agoFix #11232.
Richard Eisenberg [Thu, 17 Dec 2015 11:18:47 +0000 (12:18 +0100)] 
Fix #11232.

I somehow forgot to propagate roles into UnivCos. Very
simple fix, happily.

Test Plan: simplCore/should_compile/T11232

Reviewers: bgamari, austin, simonpj

Reviewed By: simonpj

Subscribers: simonpj, thomie

Differential Revision:

GHC Trac Issues: #11232

4 years agoConditionally show plural "s" in warnings
David Luposchainsky [Thu, 17 Dec 2015 11:17:32 +0000 (12:17 +0100)] 
Conditionally show plural "s" in warnings

Redundant constraints and defaulting warnings had "constraint(s)" in
their messages; the "s" is now conditional based on the number of things
warned about.

Reviewers: hvr, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

4 years agorules/haddock: Add EXTRA_HADDOCK_OPTS flag
Ben Gamari [Thu, 17 Dec 2015 11:15:27 +0000 (12:15 +0100)] 
rules/haddock: Add EXTRA_HADDOCK_OPTS flag

Allowing one to pass the new `--hyperlinked-source` option to generate
pretty marked-up sources for the core libraries.

Test Plan: Try it

Reviewers: hvr, austin

Reviewed By: austin

Subscribers: thomie

Differential Revision:

4 years agoBuild system: Make cGhcRtsWithLibdw flag a proper Bool
Ben Gamari [Thu, 17 Dec 2015 11:14:53 +0000 (12:14 +0100)] 
Build system: Make cGhcRtsWithLibdw flag a proper Bool

Test Plan: validate

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision:

4 years agoAdd Shake configuration to
Ben Gamari [Thu, 17 Dec 2015 11:14:17 +0000 (12:14 +0100)] 
Add Shake configuration to

The Shake build system requires that this file be generated by autoconf.
Generate it if we find a shake tree.

Reviewers: austin, hvr

Reviewed By: hvr

Subscribers: thomie, erikd

Differential Revision:

4 years agoBuild system: Cabalize genapply
Ben Gamari [Thu, 17 Dec 2015 11:13:17 +0000 (12:13 +0100)] 
Build system: Cabalize genapply

Test Plan: Validate

Reviewers: thomie, austin

Reviewed By: thomie, austin

Differential Revision:

4 years agoFix libffi dependency, and remove redundant LibFFI.hsc
Simon Marlow [Thu, 17 Dec 2015 11:03:29 +0000 (03:03 -0800)] 
Fix libffi dependency, and remove redundant LibFFI.hsc

LibFFI.hsc was moved to libraries/ghci/GHCi/FFI.hsc, I just forgot to
remove the old one.  We also need an explicit dependency on libffi,
which moves from compiler/ to the top-level (because
libraries/ghci/ is auto-generated).

4 years agoFix haddock hyperlinker
Ben Gamari [Wed, 16 Dec 2015 22:33:08 +0000 (23:33 +0100)] 
Fix haddock hyperlinker

Updates haddock submodule

4 years agoTcTypeable: Don't use bogus fingerprints when suppress-uniques is enabled
Ben Gamari [Wed, 16 Dec 2015 20:09:54 +0000 (21:09 +0100)] 
TcTypeable: Don't use bogus fingerprints when suppress-uniques is enabled

Previously the Typeable implementation would intentionally create TyCon
representations with bogus fingerprints to avoid fingerprints (which may
change often) from leaking into test output. As pointed out by Richard
in #10376 this is very bad as simply enabling a debug flag,
`-dsuppress-uniques`, completely breaks the soundness of `Typeable`!

This patch removes this behavior and replaces it with logic in the
testsuite driver to filter out spurious changes due to Typeable

Test Plan: Validate

Reviewers: austin, simonpj, goldfire

Reviewed By: goldfire

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10376

4 years agotestsuite: Add missing LiteralsTest2.hs
Ben Gamari [Thu, 17 Dec 2015 11:08:02 +0000 (06:08 -0500)] 
testsuite: Add missing LiteralsTest2.hs

4 years agoBump haddock expected performance numbers
Ben Gamari [Thu, 17 Dec 2015 09:40:57 +0000 (10:40 +0100)] 
Bump haddock expected performance numbers

This was a pretty brutal upgrade, with >100% increase in allocations
while processing `base`. Ugh.

4 years agoFix tests when run in parallel
Simon Marlow [Thu, 17 Dec 2015 09:37:23 +0000 (01:37 -0800)] 
Fix tests when run in parallel

4 years agoaccept output
Simon Marlow [Thu, 17 Dec 2015 09:32:20 +0000 (01:32 -0800)] 
accept output

4 years agoRemote GHCi, -fexternal-interpreter
Simon Marlow [Wed, 18 Nov 2015 16:42:24 +0000 (16:42 +0000)] 
Remote GHCi, -fexternal-interpreter

(Apologies for the size of this patch, I couldn't make a smaller one
that was validate-clean and also made sense independently)

(Some of this code is derived from GHCJS.)

This commit adds support for running interpreted code (for GHCi and
TemplateHaskell) in a separate process.  The functionality is
experimental, so for now it is off by default and enabled by the flag

Reaosns we want this:

* compiling Template Haskell code with -prof does not require
  building the code without -prof first

* when GHC itself is profiled, it can interpret unprofiled code, and
  the same applies to dynamic linking.  We would no longer need to
  force -dynamic-too with TemplateHaskell, and we can load ordinary
  objects into a dynamically-linked GHCi (and vice versa).

* An unprofiled GHCi can load and run profiled code, which means it
  can use the stack-trace functionality provided by profiling without
  taking the performance hit on the compiler that profiling would

Amongst other things; see for more details.

Notes on the implementation are in Note [Remote GHCi] in the new
module compiler/ghci/GHCi.hs.  It probably needs more documenting,
feel free to suggest things I could elaborate on.

Things that are not currently implemented for -fexternal-interpreter:

* The GHCi debugger
* :set prog, :set args in GHCi
* `recover` in Template Haskell
* Redirecting stdin/stdout for the external process

These are all doable, I just wanted to get to a working validate-clean
patch first.

I also haven't done any benchmarking yet.  I expect there to be slight hit
to link times for byte code and some penalty due to having to
serialize/deserialize TH syntax, but I don't expect it to be a serious
problem.  There's also lots of low-hanging fruit in the byte code
generator/linker that we could exploit to speed things up.

Test Plan:
* validate
* I've run parts of the test suite with
EXTRA_HC_OPTS=-fexternal-interpreter, notably tests/ghci and tests/th.
There are a few failures due to the things not currently implemented
(see above).

Reviewers: simonpj, goldfire, ezyang, austin, alanz, hvr, niteria, bgamari, gibiansky, luite

Subscribers: thomie

Differential Revision:

4 years agoGHC doesn't have a way to ask for user-package-db, so Cabal reimplemented it.
Edward Z. Yang [Wed, 16 Dec 2015 18:39:12 +0000 (10:39 -0800)] 
GHC doesn't have a way to ask for user-package-db, so Cabal reimplemented it.

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

Reviewers: austin, bgamari

Subscribers: thomie

Differential Revision:

4 years agoAdd test for #10897
Matthew Pickering [Wed, 16 Dec 2015 23:16:15 +0000 (23:16 +0000)] 
Add test for #10897

4 years agoUpdate transformers submodule to latest v0.5.0.0
Herbert Valerio Riedel [Wed, 16 Dec 2015 22:31:34 +0000 (23:31 +0100)] 
Update transformers submodule to latest v0.5.0.0

`transformers-` will be the next version of `transformers`
and this is the designated version to be used for GHC 8.0.1

This needs to update the haskeline submodule in order to relax
the upper bound for the major version bump to 0.5

4 years agoUpdate Cabal submodule to latest snapshot
Herbert Valerio Riedel [Wed, 16 Dec 2015 22:22:42 +0000 (23:22 +0100)] 
Update Cabal submodule to latest snapshot

This needs minor adaptations to ghc-cabal due to

4 years agoNote [The equality types story] in TysPrim
Richard Eisenberg [Wed, 16 Dec 2015 18:04:09 +0000 (13:04 -0500)] 
Note [The equality types story] in TysPrim

This supercedes the Note recently written in TysWiredIn.

4 years agoLook through type synonyms in GADT kind signatures
Jan Stolarek [Wed, 16 Dec 2015 11:57:45 +0000 (12:57 +0100)] 
Look through type synonyms in GADT kind signatures

Summary: Fixes #11237

Test Plan: ./validate

Reviewers: goldfire, austin, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11237

4 years agoSynchronize Haddock submodule with master branch
Ben Gamari [Wed, 16 Dec 2015 16:24:40 +0000 (17:24 +0100)] 
Synchronize Haddock submodule with master branch

Thanks for Matthew Pickering for managing this rebase.

4 years agoImprove detection of `fdatasync(2)` (re #11137)
Herbert Valerio Riedel [Wed, 16 Dec 2015 16:40:48 +0000 (17:40 +0100)] 
Improve detection of `fdatasync(2)` (re #11137)

This updates the `unix` submodule to pull in an improved
Autoconf test for `fdatasync(2)` in cases where `<unistd.h>` lacks
a declaration, but linking against `fdatasync` works which led to a
false positive previously.

4 years agoUpdate haddock submodule
Ben Gamari [Wed, 16 Dec 2015 12:47:51 +0000 (07:47 -0500)] 
Update haddock submodule

Also rename and move the horribly named isVanillaLSig to Haddock as
isUserLSig, reflecting the fact that it returns whether the signature
was provided by the user or generated.

4 years agoGHC.Stack: Fix Haddock markup
Ben Gamari [Wed, 16 Dec 2015 11:27:34 +0000 (12:27 +0100)] 
GHC.Stack: Fix Haddock markup

4 years agoStart using `-W` instead of `-f(no-)warn` in some places
Herbert Valerio Riedel [Wed, 16 Dec 2015 12:32:32 +0000 (13:32 +0100)] 
Start using `-W` instead of `-f(no-)warn` in some places

This replaces some occurences of `-f(no-)warn` with the new `-W`-aliases
introduced via 2206fa8cdb120932 / #11218, in cases which are guaranteed
to be invoked with recent enough GHC (i.e. the stage1+ GHC).

After this commit, mostly the compiler and the testsuite remain using
`-f(wo-)warn...` because the compiler needs to be bootstrappable with
older GHCs, while for the testsuite it's convenient to be able to quickly
compare the behavior to older GHCs (which may not support the new flags yet).

The compiler-part can be updated to use the new flags once GHC 8.3 development

Reviewed By: quchen

Differential Revision:

4 years agoAdd `-W(no-)xxx` aliases for `-f(no-)warn-xxx` flags
David Luposchainsky [Wed, 16 Dec 2015 10:42:00 +0000 (11:42 +0100)] 
Add `-W(no-)xxx` aliases for `-f(no-)warn-xxx` flags

This also updates the user's guide to refer to the `-W`-based warning
flags by default.

Quoting the release note entry:

| Warnings can now be controlled with `-W(no-)...` flags in addition to
| the old `-f(no-)warn...` ones. This was done as the first part of a
| rewrite of the warning system to provide better control over warnings,
| better warning messages, and more common syntax compared to other
| compilers. The old `-fwarn...`-based warning flags will remain
| functional for the forseeable future.

This is part of
and addresses #11218

Reviewed By: hvr, bgamari

Differential Revision:

4 years agoUpdate binary submodule to binary-0.8 snapshot
Herbert Valerio Riedel [Wed, 16 Dec 2015 10:37:20 +0000 (11:37 +0100)] 
Update binary submodule to binary-0.8 snapshot

This requires tweaking version constraints to allow this new major version
of `binary`.

Starting with binary-0.8, `Binary Version` is de-orphaned into `binary`.
This requires some minor adaptations to remove/hide orphan instances.

/cc @kolmodin

Differential Revision:

4 years agoUpdate pretty submodule to v1.1.3.2 release
Herbert Valerio Riedel [Tue, 15 Dec 2015 23:12:32 +0000 (00:12 +0100)] 
Update pretty submodule to v1.1.3.2 release

The `pretty-` release is the version designated for GHC 8.0.1

/cc @dterei

Differential Revision:

4 years agoExpose enabled language extensions to TH
Ben Gamari [Tue, 15 Dec 2015 22:57:46 +0000 (23:57 +0100)] 
Expose enabled language extensions to TH

This exposes `template-haskell` functions for querying the language
extensions which are enabled when compiling a module,

- an `isExtEnabled` function to check whether an extension is enabled
- an `extsEnabled` function to obtain a full list of enabled extensions

To avoid code duplication this adds a `GHC.LanguageExtensions` module to
`ghc-boot` and moves `DynFlags.ExtensionFlag` into it. A happy
consequence of this is that the ungainly `DynFlags` lost around 500
lines. Moreover, flags corresponding to language extensions are now
clearly distinguished from other flags due to the `LangExt.*` prefix.

Updates haddock submodule.

This fixes #10820.

Test Plan: validate

Reviewers: austin, spinda, hvr, goldfire, alanz

Reviewed By: goldfire

Subscribers: mpickering, RyanGlScott, hvr, simonpj, thomie

Differential Revision:

GHC Trac Issues: #10820

4 years agoprimops: Mark actions evaluated by `catch*` as lazy
Ben Gamari [Tue, 15 Dec 2015 19:08:17 +0000 (20:08 +0100)] 
primops: Mark actions evaluated by `catch*` as lazy

There is something very peculiar about the `catch` family of operations
with respect to strictness analysis: they turn divergence into
non-divergence. For this reason, it isn't safe to mark them as strict in
the expression whose exceptions they are catching. The reason is this:


    let r = \st -> raiseIO# blah st
    in catch (\st -> ...(r st)..) handler st

If we give the first argument of catch a strict signature, we'll get a
demand 'C(S)' for 'r'; that is, 'r' is definitely called with one
argument, which indeed it is. The trouble comes when we feed 'C(S)' into
'r's RHS as the demand of the body as this will lead us to conclude that
the whole 'let' will diverge; clearly this isn't right.

This is essentially the problem in #10712, which arose when
7c0fff41789669450b02dc1db7f5d7babba5dee6 marked the `catch*` primops as
being strict in the thing to be evaluated. Here I've partially reverted
this commit, again marking the first argument of these primops as lazy.

Fixes #10712.

Test Plan: Validate checking `exceptionsrun001`

Reviewers: simonpj, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10712, #11222

4 years agoAdd testcase for #11224
Ben Gamari [Tue, 15 Dec 2015 20:50:40 +0000 (20:50 +0000)] 
Add testcase for #11224

Test Plan: Validate

Reviewers: austin, mpickering

Reviewed By: mpickering

Subscribers: mpickering, thomie

Differential Revision:

GHC Trac Issues: #11224

4 years agobase: NonEmpty: Fix documentation example
Ben Gamari [Tue, 15 Dec 2015 20:50:36 +0000 (21:50 +0100)] 
base: NonEmpty: Fix documentation example

Fixes #11178.

4 years agoNarrow scope of special-case for unqualified printing of names in core libraries
Ben Gamari [Tue, 15 Dec 2015 15:08:52 +0000 (16:08 +0100)] 
Narrow scope of special-case for unqualified printing of names in core libraries

Commit 547c597112954353cef7157cb0a389bc4f6303eb modifies the
pretty-printer to render names from a set of core packages (`base`,
`ghc-prim`, `template-haskell`) as unqualified. The idea here was that
many of these names typically are not in scope but are well-known by the
user and therefore qualification merely introduces noise.

This, however, is a very large hammer and potentially breaks any
consumer who relies on parsing GHC output (hence #11208). This commit
partially reverts this change, now only printing `Constraint` (which
appears quite often in errors) as unqualified.

Fixes #11208.

Updates tests in `array` submodule.

Test Plan: validate

Reviewers: hvr, thomie, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11208

4 years agoComment layout only
Simon Peyton Jones [Tue, 15 Dec 2015 14:26:34 +0000 (14:26 +0000)] 
Comment layout only

4 years agoAllow recursive (undecidable) superclasses
Simon Peyton Jones [Tue, 15 Dec 2015 14:26:13 +0000 (14:26 +0000)] 
Allow recursive (undecidable) superclasses

This patch fulfils the request in Trac #11067, #10318, and #10592,
by lifting the conservative restrictions on superclass constraints.

These restrictions are there (and have been since Haskell was born) to
ensure that the transitive superclasses of a class constraint is a finite
set.  However (a) this restriction is conservative, and can be annoying
when there really is no recursion, and (b) sometimes genuinely recursive
superclasses are useful (see the tickets).

Dimitrios and I worked out that there is actually a relatively simple way
to do the job. It’s described in some detail in

   Note [The superclass story] in TcCanonical
   Note [Expanding superclasses] in TcType

In brief, the idea is to expand superclasses only finitely, but to
iterate (using a loop that already existed) if there are more
superclasses to explore.

Other small things

- I improved grouping of error messages a bit in TcErrors

- I re-centred the haddock.compiler test, which was at 9.8%
  above the norm, and which this patch pushed slightly over

4 years agoComments on equality types and classes
Simon Peyton Jones [Tue, 15 Dec 2015 14:22:37 +0000 (14:22 +0000)] 
Comments on equality types and classes

This is really just doucumenting one aspect of the kind-equality patch.

See especially Note [Equality types and classes] in TysWiredIn.
Other places should just point to this Note.

Richard please check for veracity.

4 years agoImprove documentation for -XStrict
Simon Peyton Jones [Tue, 15 Dec 2015 14:19:52 +0000 (14:19 +0000)] 
Improve documentation for -XStrict

In particular, highlight that we do not put bangs on nested patterns

4 years agoFix formatting complaint from Sphinx
Simon Peyton Jones [Tue, 15 Dec 2015 14:19:12 +0000 (14:19 +0000)] 
Fix formatting complaint from Sphinx

4 years agoReset process submodule to v1.4.1.0 release tag
Herbert Valerio Riedel [Tue, 15 Dec 2015 13:37:55 +0000 (14:37 +0100)] 
Reset process submodule to v1.4.1.0 release tag

The `process-` release is the version designated for GHC 8.0.1

/cc @snoyberg

4 years agoUpdate expected test output for 32 bit platforms
Erik de Castro Lopo [Tue, 15 Dec 2015 10:53:11 +0000 (21:53 +1100)] 
Update expected test output for 32 bit platforms

Test Plan: Run tests on a 32 bit platform

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

4 years agoTysWiredIn: Fix a comment - Note [TYPE] is in TysPrim
Ömer Sinan Ağacan [Tue, 15 Dec 2015 01:05:43 +0000 (20:05 -0500)] 
TysWiredIn: Fix a comment - Note [TYPE] is in TysPrim

4 years agoDocument -XOverloadedLabels
Adam Gundry [Tue, 15 Dec 2015 00:11:03 +0000 (01:11 +0100)] 
Document -XOverloadedLabels

This adds documentation of the new `OverloadedLabels` extension to
the users' guide.  Thanks to @bgamari for patiently reminding me
to get this done.  Feedback welcome.

Test Plan: N/A

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, bgamari

Differential Revision:

4 years agoDynFlags: delete function that doesn't do anything
Thomas Miedema [Tue, 15 Dec 2015 00:07:39 +0000 (01:07 +0100)] 
DynFlags: delete function that doesn't do anything

Reviewers: austin, bgamari

Reviewed By: austin, bgamari

Differential Revision:

4 years agoDynFlags: remove Opt_Static
Thomas Miedema [Tue, 15 Dec 2015 00:07:24 +0000 (01:07 +0100)] 
DynFlags: remove Opt_Static

There are currently 2 different ways to test for a static or dynamic

    * Test if WayDyn is in ways
    * Test if Opt_Static is set

The problem is that these can easily go out of sync, especially when
using the

This commit replaces all queries of Opt_Static with an equivalent query
WayDyn. This would have prevented bug #8294 and fixes #11154.

Reviewers: hvr, austin, bgamari

Reviewed By: austin, bgamari

Differential Revision:

GHC Trac Issues: #10636

4 years agoFix runghc when $1_$2_SHELL_WRAPPER = NO
RyanGlScott [Tue, 15 Dec 2015 00:02:46 +0000 (01:02 +0100)] 
Fix runghc when $1_$2_SHELL_WRAPPER = NO

When that variable isn't on (which is always the case on Windows),
`runghc` naively attempts to invoke `ghc` by finding an executable
simply named `ghc`. This won't work if `ghc` doesn't exist (e.g., if
we're building GHC and using `ghc-stage2` instead). A simple fix is to
test for the existence of `ghc` beforehand, and if that fails, fall back
on `ghc-stage2`.

Fixes #11185.

Test Plan: ./validate

Reviewers: austin, hvr, thomie, bgamari

Reviewed By: thomie, bgamari

Differential Revision:

GHC Trac Issues: #11185

4 years agoMention "handle is semi-closed" in error messages
Thomas Miedema [Tue, 15 Dec 2015 00:02:39 +0000 (01:02 +0100)] 
Mention "handle is semi-closed" in error messages

Semi-closedness is mentioned in the Haskell report, so lets not hide it
from users.

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Differential Revision:

4 years agoDynFlags Remove -fwarn-context-quantification flag
Ben Gamari [Tue, 15 Dec 2015 00:01:39 +0000 (01:01 +0100)] 
DynFlags Remove -fwarn-context-quantification flag

As mentioned in #4426 these warnings are now errors since the Great
Wildcards Refactor of 2015 (1e041b7382b6aa329e4ad9625439f811e0f27232).
I've opened #11221 to ensure we remove the last traces of the option in

Test Plan: validate

Reviewers: austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4426

4 years agoTest #9632 in dependent/should_compile/T9632
Richard Eisenberg [Mon, 14 Dec 2015 20:59:21 +0000 (15:59 -0500)] 
Test #9632 in dependent/should_compile/T9632

4 years agoAdd IsString Outputable.SDoc instance
Herbert Valerio Riedel [Mon, 14 Dec 2015 19:55:08 +0000 (20:55 +0100)] 
Add IsString Outputable.SDoc instance

This allows to conveniently interpret string literals as `text`
when `-XOverloadedStrings` is in effect.

For what it's worth, `Text.PrettyPrint.Doc` also possesses such
an instance.

This is a spin-off from D1240

Reviewed By: bgamari

Differential Revision:

4 years agoAdd testcase for #11216
Ben Gamari [Mon, 14 Dec 2015 14:14:36 +0000 (15:14 +0100)] 
Add testcase for #11216

4 years agoMake binds in do-blocks strict when -XStrict (#11193)
Adam Sandberg Eriksson [Mon, 14 Dec 2015 14:03:15 +0000 (15:03 +0100)] 
Make binds in do-blocks strict when -XStrict (#11193)

Previously bindings in `do` blocks were omitted. With `-XStrict`
do content <- action
should be equivalent to
do !content <- action

Fixes #11193.

Reviewers: bgamari, austin

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11193

4 years agoSuggest import Data.Kinds when * is out of scope
Richard Eisenberg [Mon, 14 Dec 2015 14:02:54 +0000 (15:02 +0100)] 
Suggest import Data.Kinds when * is out of scope

With -XTypeInType, `*` must be imported to be used. This patch makes
sure the user knows this.

But I'm not sure this is the best way to deal with `*`. Feedback welcome
on either this small fix or the approach to `*`, in general.

You may wish to see `Note [HsAppsTy]` in HsTypes if you want to take a
broader view.

Test Plan: dependent/should_fail/RenamingStar

Reviewers: simonpj, bgamari, austin

Subscribers: thomie

Differential Revision:

4 years agoUse Cxt for deriving clauses in TH (#10819)
Ben Gamari [Mon, 14 Dec 2015 14:01:12 +0000 (15:01 +0100)] 
Use Cxt for deriving clauses in TH (#10819)

Deriving clauses in the TH representations of data, newtype, data
instance, and newtype instance declarations previously were just [Name],
which didn't allow for more complex derived classes, eg. multi-parameter

This switches out [Name] for Cxt, representing the derived classes as
types instead of names.

Test Plan: validate

Reviewers: goldfire, spinda, austin

Reviewed By: goldfire, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10819

4 years agoSome more typos in comments
Gabor Greif [Mon, 14 Dec 2015 09:43:23 +0000 (10:43 +0100)] 
Some more typos in comments

4 years agoDon't pass CC= explicitly to `./configure` scripts
Herbert Valerio Riedel [Mon, 14 Dec 2015 09:42:17 +0000 (10:42 +0100)] 
Don't pass CC= explicitly to `./configure` scripts

This is a follow-up to fcc6b1d / D1608 which is made possible
by the recent Cabal update:

As `ghc-cabal` is called with `--with-gcc`, this gets passed to `./configure`
as `CC=...` argument. So we don't need to set `CC=...` ourselves explicitly again.

Prior to the changes in Cabal (pulled in via  0bf0cf936c7) and fcc6b1d,
`./configure` scripts would be called with a `--with-cc` argument followed by a
`--with-gcc` argument.

After this commit, `./configure` will be passed a single `CC=...` argument
constructed by the `Cabal` library.

Reviewed By: erikd

Differential Revision:

4 years agoUse idiomatic way to tell Autoconf the c compiler
Herbert Valerio Riedel [Mon, 14 Dec 2015 06:36:37 +0000 (07:36 +0100)] 
Use idiomatic way to tell Autoconf the c compiler

The non-idiomatic `--with-cc` flag was added via

However, `--with-cc` seems rather fragile and support for `--with-cc` needs
to be added explicitly to autoconf-based Cabal packages. The `CC=` flag, however,
is supported natively by GNU Autoconf, so let's use the standard facility for that.

Relatedly, Cabal prior to version 1.24 used a similiar flag `--with-gcc=...`,
but starting with Cabal-1.24 this has been changed to use `CC=...` instead as well

This also updates a few submodules removing the now obsolete `--with-cc` flag

Reviewed By: trofi, thomie, erikd

Differential Revision:

4 years agoUpdate Cabal submodule
Herbert Valerio Riedel [Sun, 13 Dec 2015 22:37:27 +0000 (23:37 +0100)] 
Update Cabal submodule

4 years agoconfigure: add support for 'sh4' (Trac #11209)
Sergei Trofimovich [Sun, 13 Dec 2015 12:36:47 +0000 (12:36 +0000)] 
configure: add support for 'sh4' (Trac #11209)

Debian has Renesas SH4 (SuperH) port with a triplet:


Patch by glaubitz adds 'sh4' CPU to recognize target
as ArchUnknown.

Signed-off-by: Sergei Trofimovich <>
4 years agoRemove redundant imports
Richard Eisenberg [Sat, 12 Dec 2015 22:31:31 +0000 (17:31 -0500)] 
Remove redundant imports

4 years agoFix release notes markup
Ben Gamari [Sat, 12 Dec 2015 19:46:20 +0000 (20:46 +0100)] 
Fix release notes markup

4 years agoRefactor type families in Template Haskell
John Leo [Sat, 12 Dec 2015 18:28:18 +0000 (19:28 +0100)] 
Refactor type families in Template Haskell

Fixes #10902.

Test Plan: validate

Reviewers: goldfire, austin, hvr, jstolarek, bgamari

Reviewed By: jstolarek, bgamari

Subscribers: hvr, thomie

Differential Revision:

GHC Trac Issues: #10902

4 years agoBuild system: fix 'make install-strip' in bindist
Thomas Miedema [Sat, 12 Dec 2015 16:02:28 +0000 (17:02 +0100)] 
Build system: fix 'make install-strip' in bindist

The INSTALL_PROGRAM variable is set in mk/, so we have to
include that file before using it.

Running 'make install' before './configure' in a bindist will now also
display a nice message.

Reviewers: hvr, austin, bgamari

Reviewed By: bgamari

Differential Revision:

GHC Trac Issues: #1851