3 years agoBump Cabal submodule ghc-8.0.1-rc2
Ben Gamari [Thu, 4 Feb 2016 16:16:47 +0000 (17:16 +0100)] 
Bump Cabal submodule

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

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

(cherry picked from commit bbc0ec5733df434878b02f7556a1cc947718a8b1)

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

Overhaul the Overhauled Pattern Match Checker

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

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

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

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

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

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

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

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

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

Test Plan: validate

Reviewers: goldfire, bgamari, hvr, austin

Subscribers: simonpj, thomie

Differential Revision:

(cherry picked from commit 28f951edfe50ea5182065144340061ec326781f5)

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

(cherry picked from commit db121b2ec4596b99fed9781ec2d055f29e0d5b20)

3 years agoUse the in_scope set in lint_app
Bartosz Nitka [Wed, 27 Jan 2016 19:59:02 +0000 (11:59 -0800)] 
Use the in_scope set in lint_app

This makes the call to `substTy` satisfy the invariant from
Note [The substitution invariant] in TyCoRep.

Test Plan: ./validate --slow

Reviewers: goldfire, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11371

(cherry picked from commit 63700a193557ed63a1da18a6a059cb7ec5596796)

3 years agoFix some substitution InScopeSets
Richard Eisenberg [Tue, 26 Jan 2016 03:00:47 +0000 (22:00 -0500)] 
Fix some substitution InScopeSets

This is relevant to #11371.

(cherry picked from commit 2899aa580d633103fc551e36c977720b94f5b41c)

3 years agoRename "open" subst functions
Bartosz Nitka [Tue, 26 Jan 2016 19:59:37 +0000 (11:59 -0800)] 
Rename "open" subst functions

This is the renaming that @simonpj requested:
· zipOpenTCvSubst  -> zipTvSubst   (It only deals with tyvars)

· zipOpenTCvSubstCoVars -> zipCvSubst   (it only deals with

· zipOpenTCvSubstBinders ->  zipTyBinderSubst  (it only deals
with TyBinders, not covars)
plus the `mk` variant.

Test Plan: ./validate

Reviewers: simonpj, goldfire, austin, bgamari

Subscribers: thomie, simonpj

Differential Revision:

GHC Trac Issues: #11371

(cherry picked from commit 5dcae88bd0df440abe78c3d793d21aca6236fc25)

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

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

Reviewers: austin, hvr, KaneTW, bgamari

Reviewed By: KaneTW, bgamari

Subscribers: thomie, KaneTW

Differential Revision:

GHC Trac Issues: #10284

(cherry picked from commit a7ad0b91e7dace173ed95f31b221628d50c175e8)

3 years agoDefine CTYPE for more Posix types
Herbert Valerio Riedel [Sat, 30 Jan 2016 17:50:17 +0000 (18:50 +0100)] 
Define CTYPE for more Posix types

See also b9f636b3aa962154c1b1515a3acecfbe9071b308 for explaination,
as `unix` is slowly migrating to make more use of CApiFFI we need
more accurately annotated CTYPES.

(cherry picked from commit 6c7760b26133a0490f613895a37ff67045249fc8)

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

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

Test Plan: added a testcase

Reviewers: simonpj, bgamari, goldfire, austin

Reviewed By: simonpj, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11524

(cherry picked from commit 07ed24132ebe62aab15f14a655506decdf252ff9)

3 years agoProperly track live registers when saving the CCCS.
Geoffrey Mainland [Thu, 28 Jan 2016 14:58:37 +0000 (09:58 -0500)] 
Properly track live registers when saving the CCCS.

When saving the CCCS, we now correctly track the set of live registers and pass
them to the jump_SAVE_CCCS macro. This is now a variadic macro, but variadic
macros are supported by GCC since 3.0 and by all versions of clang, so this
should not be a problem.

Test Plan:
./validate with the following build options:

BuildFlavour = quick-llvm
SRC_HC_OPTS_STAGE1 = -fllvm-fill-undef-with-garbage

Reviewers: bgamari, simonmar, austin, rwbarton, simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11487

(cherry picked from commit 6544f8de1ed575378f14b82a2eaa06cab58b2d65)

3 years agoCode formatting cleanup.
Geoffrey Mainland [Thu, 28 Jan 2016 15:34:53 +0000 (10:34 -0500)] 
Code formatting cleanup.

(cherry picked from commit 90f688e892427b1894b6aacb1f8de8d2e41ecb56)

3 years agoAdd type signatures.
Geoffrey Mainland [Thu, 28 Jan 2016 14:58:28 +0000 (09:58 -0500)] 
Add type signatures.

(cherry picked from commit 4d0e4fe66892f6700c2bcd4ddcd1d1a837c38a56)

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

(cherry picked from commit 483858e9aa3efae540bcc496574b9ff02a6e34a9)

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

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

(cherry picked from commit 92c46a447e676fc15d014b4d6aa20052ff9ba1d3)

3 years agofix validate breakage
Simon Marlow [Wed, 27 Jan 2016 16:57:44 +0000 (08:57 -0800)] 
fix validate breakage

(Travis said it was OK!)

(cherry picked from commit 0d5ddad900257a1a31658e5d9fc4be6648462588)

3 years agoRemote GHCi: parallelise BCO serialization
Simon Marlow [Mon, 1 Feb 2016 16:39:50 +0000 (16:39 +0000)] 
Remote GHCi: parallelise BCO serialization

Serialization of BCOs is slow, but we can parallelise it when using
ghci -j<n>.  It parallelises nicely, saving multiple seconds off the
link time in a large example I have.

Test Plan:
* validate
* `ghci -fexternal-interpreter` in `nofib/real/anna`

Reviewers: niteria, bgamari, ezyang, austin, hvr, erikd

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11100

(cherry picked from commit c996db5b1802ebeb93420785127f7fd55b7ec0c0)

3 years agoRemote GHCi: batch the creation of strings
Simon Marlow [Mon, 1 Feb 2016 16:19:10 +0000 (16:19 +0000)] 
Remote GHCi: batch the creation of strings

This makes a big performance difference especially when loading a
large number of modules and using parallel compilation (ghci -jN).

Test Plan:
* validate
* `ghci -fexternal-interpreter` in `nofib/real/anna`

Reviewers: niteria, bgamari, ezyang, austin, hvr, erikd

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11100

(cherry picked from commit 7cb1fae2d6ec90b10708a2631cd1069561177bd4)

3 years agoRemote GHCi: Optimize the serialization/deserialization of byte code
Simon Marlow [Fri, 29 Jan 2016 11:27:50 +0000 (11:27 +0000)] 
Remote GHCi: Optimize the serialization/deserialization of byte code

Summary: This cuts allocations by about a quarter.

Test Plan:
* validate
* `ghci -fexternal-interpreter` in `nofib/real/anna`

Reviewers: niteria, bgamari, ezyang, austin, hvr, erikd

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11100

(cherry picked from commit 2fb6a8c30567e7d071ffcf88e22ea7f72f60b826)

3 years agoUpdate unix submodule to latest snapshot
Herbert Valerio Riedel [Mon, 1 Feb 2016 18:38:46 +0000 (19:38 +0100)] 
Update unix submodule to latest snapshot

Besides containing more internal refactorings,
this update also bumps unix's version number to

(cherry picked from commit ddd38e7dce5d841b89479a4496b117553f0feeec)

3 years agoAvoid mangled/derived names in GHCi autocomplete (fixes #11328)
Adam Gundry [Mon, 1 Feb 2016 15:41:03 +0000 (16:41 +0100)] 
Avoid mangled/derived names in GHCi autocomplete (fixes #11328)

This changes `getRdrNamesInScope` to use field labels rather than
selector names for fields from modules with `DuplicateRecordFields`
enabled. Moreover, it filters out derived names (e.g. type
representation bindings) that shouldn't show up in autocomplete.

Test Plan: New test ghci/should_run/T11328

Reviewers: kolmodin, austin, bgamari, simonpj

Reviewed By: bgamari, simonpj

Subscribers: simonpj, thomie

Differential Revision:

GHC Trac Issues: #11328

(cherry picked from commit dd0b7c78f64f2498594d3ef89d3bf884402f14d9)

3 years agoRemote GHCi: create cost centre stacks in batches
Simon Marlow [Thu, 21 Jan 2016 09:46:13 +0000 (09:46 +0000)] 
Remote GHCi: create cost centre stacks in batches

Towards optimising the binary serialisation that
-fexternal-interpreter does, this saves quite a bit of time when using
-fexternal-interpreter with -prof.

(cherry picked from commit a496f82d5684f3025a60877600e82f0b29736e85)

3 years agoRefactor the typechecker to use ExpTypes.
Richard Eisenberg [Thu, 14 Jan 2016 04:29:17 +0000 (23:29 -0500)] 
Refactor the typechecker to use ExpTypes.

The idea here is described in [wiki:Typechecker]. Briefly,
this refactor keeps solid track of "synthesis" mode vs
"checking" in GHC's bidirectional type-checking algorithm.
When in synthesis mode, the expected type is just an IORef
to write to.

In addition, this patch does a significant reworking of
RebindableSyntax, allowing much more freedom in the types
of the rebindable operators. For example, we can now have
`negate :: Int -> Bool` and
`(>>=) :: m a -> (forall x. a x -> m b) -> m b`. The magic
is in tcSyntaxOp.

This addresses tickets #11397, #11452, and #11458.


(cherry picked from commit 00cbbab3362578df44851442408a8b91a2a769fa)

3 years agoTidy up tidySkolemInfo
Simon Peyton Jones [Wed, 6 Jan 2016 17:11:34 +0000 (17:11 +0000)] 
Tidy up tidySkolemInfo

Previously tidySkolemInfo used tidyOpenType, and returned a new
TidyEnv.  But that's not needed any more, because all the skolems
should be in scope in the constraint tree.

I also removed a (now-unnecessary) field of UnifyForAllSkol

(cherry picked from commit 290a553e9bd98ed43765cf8e7a70ebc95c187253)

3 years agoPut docs in /usr/share/doc/ghc-<version>
Thomas Miedema [Fri, 29 Jan 2016 19:30:47 +0000 (20:30 +0100)] 
Put docs in /usr/share/doc/ghc-<version>

`make install` puts libraries in a direcory containing the version
number. Do the same for the docs, such that multiple installs can live

Delete unused ghcdocdir.

Test Plan:
make show! VALUE=docdir

Reviewed by: bgamari

Differential Revision:

GHC Trac Issues: #11354

(cherry picked from commit b61f5f734d08fe9cdca3ac06560fc15e97aa77ab)

3 years agoTypo in docs
Ben Gamari [Mon, 1 Feb 2016 13:33:15 +0000 (14:33 +0100)] 
Typo in docs

Spelling mistakes fixed,

 * identiy > identity
 * suprising > surprising

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

(cherry picked from commit 02e3ce0bc65f586376c3d2ecab498a4c5a3f6a54)

3 years agoFix LOOKS_LIKE_PTR for 64-bit platforms
Reid Barton [Mon, 1 Feb 2016 13:32:38 +0000 (14:32 +0100)] 
Fix LOOKS_LIKE_PTR for 64-bit platforms

I'm not sure what this is used for. But it won't correctly
detect RTS-filled slop on 64-bit platforms.

Test Plan:
Untested. But I did verify that

    unsigned long x = (unsigned long)0xaaaaaaaaaaaaaaaaULL;

compiles warning-free and produces the expected output using both
gcc and clang, with -Wall -Wextra -O, and with and without -m32.

Reviewers: simonmar, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

(cherry picked from commit ba88aab0d1223cd5066a66500360df4bddb159d1)

3 years agoImplement basic uniform warning set tower
Herbert Valerio Riedel [Mon, 1 Feb 2016 13:32:30 +0000 (14:32 +0100)] 
Implement basic uniform warning set tower

This implements/completes the current basic warning sets to provide the
following tower of warning sets (i.e. each line subsumes the warnings
from the sets listed below):

- `-Weverything`
- `-Wall`
- `-Wextra` (alias of `-W`)
- `-Wdefault`

So for each of flags there's also a complement `-Wno-...` flag, which
subtracts the given set from the current enabled-warnings state.

Thus, we can now easily perform simple set subtraction operations, as
warning flags are evaluated from left-to-right on the command line.

So e.g.

- `-Weverything -Wno-all -Wno-compat` enables *all* warnings not enabled
  by `-Wall` and `-Wcompat`.

- `-Wextra -Wno-default` only warnings that `-Wextra` provides
  beyond the default warnings.

Reviewers: quchen, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

(cherry picked from commit 86897e1fe23cb26fa2278e86542b34c33301606a)

3 years agoHide the CallStack implicit parameter
Eric Seidel [Mon, 1 Feb 2016 13:32:19 +0000 (14:32 +0100)] 
Hide the CallStack implicit parameter

The implicit parameter isn't actually very relevant to the CallStack
machinery, so we hide the implementation details behind a constraint

type HasCallStack = (?callStack :: CallStack)

This has a few benefits:

1. No need to enable `ImplicitParams` in user code.
2. No need to remember the `?callStack` naming convention.
3. Gives us the option to change the implementation details in the
future with less user-land breakage.

The revised `CallStack` API is exported from `GHC.Stack` and makes no
mention of the implicit parameter.

Test Plan: ./validate

Reviewers: simonpj, austin, hvr, bgamari

Reviewed By: simonpj, bgamari

Subscribers: thomie

Projects: #ghc

Differential Revision:

(cherry picked from commit 94048f9fb01c541215cfc9cc215af83566b63236)

3 years agoRestore original alignment for info tables
Simon Brenner [Wed, 27 Jan 2016 10:05:35 +0000 (11:05 +0100)] 
Restore original alignment for info tables

This was broken in 4a32bf925b8aba7885d9c745769fe84a10979a53, meaning
that info tables and subsequent code are no longer guaranteed to have
the recommended alignment.  Split up the section header and section
alignment printers, and print an appropriate alignment directive before
each info table.

Fixes Trac #11486

Reviewers: austin, bgamari, rwbarton

Reviewed By: bgamari, rwbarton

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11486

(cherry picked from commit 0dc7b36c3c261b3eccf8460581fcd3d71f6e6ff6)

3 years agorts/Timer: Actually fix #9105
Ben Gamari [Wed, 27 Jan 2016 10:05:23 +0000 (11:05 +0100)] 
rts/Timer: Actually fix #9105

jberthold astutely pointed out that the previous fix (D1822) could not
have possibly fixed the issue as the patch would only have had any
effect if !PROFILING.

Test Plan: Check for reduced CPU usage when compiled with `-prof` but
without `+RTS -p`

Reviewers: simonmar, austin, jberthold

Reviewed By: simonmar, jberthold

Subscribers: simonmar, thomie

Differential Revision:

GHC Trac Issues: #9105

(cherry picked from commit 1c6130d91420dc835c281bc9b13d603b7aa49b59)

3 years agoghci: fix trac issue #11481
Benjamin Bykowski [Wed, 27 Jan 2016 10:05:13 +0000 (11:05 +0100)] 
ghci: fix trac issue #11481

Test Plan: validate

Reviewers: thomie, austin, bgamari

Reviewed By: bgamari

Differential Revision:

GHC Trac Issues: #11481

(cherry picked from commit 1f6d1422f9fe875e1d150b423c4864b42d96b8db)

3 years agoTypos in comments
Gabor Greif [Wed, 27 Jan 2016 10:11:04 +0000 (11:11 +0100)] 
Typos in comments

(cherry picked from commit 448ea978318a9f8c9bb611803aa01f934b111fe9)

3 years agoFix a typo in the note name in comments
Bartosz Nitka [Wed, 27 Jan 2016 09:55:52 +0000 (01:55 -0800)] 
Fix a typo in the note name in comments

This is `subsititution` to `substitution`, plus one instance of
the note that I missed.

Test Plan: docufix

Reviewers: simonpj, bgamari, austin, goldfire

Reviewed By: simonpj, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11371

(cherry picked from commit 45fd83bb5ed3a66320eb873039b65566f53ed36a)

3 years agoEnable RemoteGHCi on Windows
Tamar Christina [Wed, 27 Jan 2016 09:20:11 +0000 (10:20 +0100)] 
Enable RemoteGHCi on Windows

Makes the needed changes to make RemoteGHCi work on Windows.
The approach passes OS Handles areound instead of the Posix Fd
as on Linux.

The reason is that I could not find any real documentation about
the behaviour of Windows w.r.t inheritance and Posix FDs.

The implementation with Fd did not seem to be able to find the Fd
in the child process. Instead I'm using the much better documented
approach of passing inheriting handles.

This requires a small modification to the `process` library.

Test Plan: ./validate On Windows x86_64

Reviewers: thomie, erikd, bgamari, simonmar, austin, hvr

Reviewed By: simonmar

Subscribers: #ghc_windows_task_force

Differential Revision:

GHC Trac Issues: #11100

(cherry picked from commit 44a5d51a4892b85c7eba09dcb90ca02245637812)

3 years agoBuild profiling libraries on `validate --slow` (#11496)
Thomas Miedema [Tue, 26 Jan 2016 23:08:53 +0000 (00:08 +0100)] 
Build profiling libraries on `validate --slow` (#11496)

(cherry picked from commit e2bdf03a63b09feabee76e2efd33eb56739324ac)

3 years agoTestsuite: fixup req_profiling tests (#11496)
Thomas Miedema [Tue, 26 Jan 2016 12:07:38 +0000 (13:07 +0100)] 
Testsuite: fixup req_profiling tests (#11496)

* T2552 (#10037) is failng for all threaded opt_ways, not for WAY=prof.
* TH_spliceE5_prof (#11495) is failing when ghc_dynamic
* Rename ghci_dynamic to ghc_dynamic. It's the same thing.

(cherry picked from commit eeb67c9b833d95fa69932c34a3175054dacb83e2)

3 years agoConstruct in_scope set in mkTopTCvSubst
Bartosz Nitka [Tue, 26 Jan 2016 19:26:06 +0000 (11:26 -0800)] 
Construct in_scope set in mkTopTCvSubst

The pre-condition on `mkTopTCvSubst` turned out to be wrong and
not satisfied by any of the callers. I've fixed it, so that it
constructs the in_scope set from the range of the substitution.
`mkTopTCvSubst` was also unnecessarily general it is never called
with `CoVars`, so I changed the type signature and added an assertion.

Test Plan: ./validate --slow

Reviewers: goldfire, simonpj, bgamari, austin

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11371

(cherry picked from commit 144ddb414a8a4f40df1ad9ab27fcdf38f30db4d3)

3 years agoSplit off -Wunused-type-variables from -Wunused-matches
RyanGlScott [Tue, 26 Jan 2016 17:33:19 +0000 (12:33 -0500)] 
Split off -Wunused-type-variables from -Wunused-matches

Previously, `-Wunused-matches` would fire whenever it detected unused type
variables in a type family or data family instance. This can be annoying for
users who wish to use type variable names as documentation, as being
`-Wall`-compliant would mean that they'd have to prefix many of their type
variable names with underscores, making the documentation harder to read.

To avoid this, a new warning `-Wunused-type-variables` was created that only
encompasses unused variables in family instances. `-Wunused-matches` reverts
back to its role of only warning on unused term-level pattern names. Unlike
`-Wunused-matches`, `-Wunused-type-variables` is not implied by `-Wall`.

Fixes #11451.

Test Plan: ./validate

Reviewers: goldfire, ekmett, austin, hvr, simonpj, bgamari

Reviewed By: simonpj, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11451

(cherry picked from commit 6817703b31840620cca8596ca62ed70633934972)

3 years agoFix segmentation fault when .prof file not writeable
Thomas Miedema [Tue, 26 Jan 2016 00:11:49 +0000 (01:11 +0100)] 
Fix segmentation fault when .prof file not writeable

There are two ways to do retainer profiling. Quoting from the user's guide:
  1. `+RTS -hr` "Breaks down the graph by retainer set"
  2. `+RTS -hr<cc> -h<x>`, where `-h<x>` is one of normal heap profiling
     break-down options (e.g. `-hc`), and `-hr<cc> means "Restrict the
     profile to closures with retainer sets containing cost-centre
     stacks with one of the specified cost centres at the top."

Retainer profiling writes to a .hp file, like the other heap profiling
options, but also to a .prof file. Therefore, when the .prof file is not
writeable for whatever reason, retainer profiling should be turned off

This worked ok when running the program with `+RTS -hr` (option 1), but a
segfault would occur when using `+RTS -hr<cc> -h<x>`, with `x!=r` (option 2).

This commit fixes that.

Reviewed by: bgamari

Differential Revision:

GHC Trac Issues: #11489

(cherry picked from commit 6d2bdfd8d40b926d7a11d003213220022a63d9f5)

3 years agoNicer error on +RTS -hc without -rtsopts or -prof
Thomas Miedema [Mon, 25 Jan 2016 19:07:31 +0000 (20:07 +0100)] 
Nicer error on +RTS -hc without -rtsopts or -prof

 * without -rtsopts: Most RTS options are disabled. Link with -rtsopts to enable them.
 * with -rtsopts: invalid heap profile option: -hc
 * the flag -hc requires the program to be built with -prof

Copy `Note [OPTION_SAFE vs OPTION_UNSAFE]` from commit 8c7ad0bd.

Reviewed by: bgamari

Differential Revision:

(cherry picked from commit e24a9b5de00bc2669a52a1f9905bd40e7be0d857)

3 years agoPass InScopeSet to substTy in lintTyApp
Bartosz Nitka [Thu, 21 Jan 2016 19:30:07 +0000 (11:30 -0800)] 
Pass InScopeSet to substTy in lintTyApp

This is the fix proposed in #11371:
In other cases, we already have the in-scope set in hand. Example: in
CoreLint.lintTyApp we find a call to substTyWith. But Lint carries an
in-scope set, so it would be easy to pass it to substTyWith.

Test Plan: ./validate --slow (only pre-existing problems)

Reviewers: simonpj, goldfire, austin, nomeata, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11371

(cherry picked from commit 01809bcd4c9066244d705360f0d9a3a2176385f4)

3 years agoFix three broken tests involving exceptions
Simon Peyton Jones [Tue, 26 Jan 2016 12:36:21 +0000 (12:36 +0000)] 
Fix three broken tests involving exceptions

See comment:16 in Trac #10712. The tests were wrong, not GHC!

(cherry picked from commit 3798b2aad8f62cb18e6147b54c57a9a4ad6c23f4)

3 years agoUpdate process submodule to release
Herbert Valerio Riedel [Tue, 26 Jan 2016 11:41:23 +0000 (12:41 +0100)] 
Update process submodule to release

Most notably, this pulls in a feature needed for #11100 (remote ghci)

(cherry picked from commit f1885dfd7ee84fae478e2e8398d2eff14ee36b2c)

3 years agoUpdate transformers submodule to release
Herbert Valerio Riedel [Tue, 26 Jan 2016 11:03:23 +0000 (12:03 +0100)] 
Update transformers submodule to release

This shouldn't have any noticeable API changes for GHC

(cherry picked from commit 9b716950e1c9e99afe2840ef804e5b3343ef3653)

3 years agoMinor users-guide markup fixup [skip ci]
Herbert Valerio Riedel [Tue, 26 Jan 2016 11:00:58 +0000 (12:00 +0100)] 
Minor users-guide markup fixup [skip ci]

(cherry picked from commit 5f5dc8626e59272f7055f57d9a651c9bbb3a6ee5)

3 years agoMissed plural renaming in user's guide
Herbert Valerio Riedel [Tue, 26 Jan 2016 10:59:40 +0000 (11:59 +0100)] 
Missed plural renaming in user's guide

Follow-up to 132c20894d102558cc8f3aee5bc289425d0ddb24

[skip ci]

(cherry picked from commit 34c9a4e4290595adc2e59024f9bfdc914b0f6dd3)

3 years agoFix two cloning-related bugs
Simon Peyton Jones [Tue, 26 Jan 2016 09:30:50 +0000 (09:30 +0000)] 
Fix two cloning-related bugs

Crikey!  Not just one but two bugs in type variable cloning,
both dating from the days before PolyKinds.  Both were shown up
by Trac #11330.

1. In SetLevels, when floating a case expression we must clone its
   binders, *and* do so in a telescope-aware way, because the
   constructor may bind a kind variable that appears in the kind
   of a type variable.

   Instead of doing this (wrongly) by steam, call CoreSubst.cloneBndrs.

   I added Notes and did other refactoring at the same time.

2. It turned out that CoreSubst.cloneBndrs calls TyCoRep.cloneTyVarBndr,
   and that too was bogus!  It didn't substitute in the kind of the
   TyVar being cloned.  There was even a comment to say "variables can't
   appear in kinds".  Thta hasn't been true for a long time now.

Easily fixed.

Interestingly, I then found that test
was emitting a new inexhaustive-pattern-match warning.  Sure enough
it was valid!  So the lack of cloning in cloneTyVarBndr really was
causing an observable bug; just one that we had not observed.

(cherry picked from commit 016a0bd1ba129134dfa612db0d96e01644fa7b9f)

3 years agoKill off zipTopTCvSubst in favour of zipOpenTCvSubst
Simon Peyton Jones [Tue, 26 Jan 2016 09:37:06 +0000 (09:37 +0000)] 
Kill off zipTopTCvSubst in favour of zipOpenTCvSubst

As Bartosz has discovered, the invariants for substitutions were
wrong, and in particular the "mkTop...Subst" and "zipTop..Subst"
functions were building substitutions that didn't obey even the
old invariants.

This patch kills of the bogus zipTopTCvSubst in favour of the
more robust zipOpenTCvSubst.

I tripped over this because my upcoming patch (concerning SetLevels,
Trac #11330) triggered an ASSERT failure in the substitution
well-formedness assertion in TyCoRep.

(cherry picked from commit 1c6d70c2121fd1126fcc2458bdbcc856e19598c2)

3 years agoAdd "ticks-exhausted" comment
Simon Peyton Jones [Tue, 26 Jan 2016 09:24:33 +0000 (09:24 +0000)] 
Add "ticks-exhausted" comment

This code deliberately builds a subtle negative-occurrence-of-data-type
example, described in the paper, so with -O it'll give "simplifier
ticks exhausted".

This patch just adds a comment to explain.

(cherry picked from commit 47b3f58889caa71bf096a149e58c2a9b94b75a7d)

3 years agoWhite space only
Simon Peyton Jones [Tue, 26 Jan 2016 09:00:57 +0000 (09:00 +0000)] 
White space only

(cherry picked from commit cf788a53df3ada686ec516c2edffeb54b632065f)

3 years agorts: Disable tick timer unless really needed
Ben Gamari [Fri, 22 Jan 2016 15:22:13 +0000 (16:22 +0100)] 
rts: Disable tick timer unless really needed

Trac #9105 notes significant CPU usage by an otherwise idle process when
compiled with profiling. The reason for this is that we keep the tick
timer active in the profiling RTS even if profiling wasn't requested at

If the user requests any sort of profiling then we need to keep the
timer active to ensure that samples are collected.

Test Plan: Validate, check CPU usage, ensure profiling still works

Reviewers: simonmar, austin

Reviewed By: simonmar, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #9105

(cherry picked from commit b01288d509b0f9e45f23ae48f2366f85f489089c)

3 years agoEnsure that we don't produce code for pre-ARMv7 without barriers
Ben Gamari [Mon, 25 Jan 2016 20:19:04 +0000 (21:19 +0100)] 
Ensure that we don't produce code for pre-ARMv7 without barriers

We are unable to produce load/store barriers for pre-ARMv7 targets.
Phab:D894 added dummy cases to SMP.h for these barriers to prevent the
build from failing under the assumption that there are no SMP-capable
devices of this vintage. However, #10433 points out that it is more
correct to simply set NOSMP for such targets.

Tested By: rwbarton

Test Plan: Validate

Reviewers: erikd, rwbarton, austin

Reviewed By: rwbarton

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10433

3 years agoImplement -Wunrecognised-warning-flag
Ben Gamari [Mon, 25 Jan 2016 16:14:49 +0000 (17:14 +0100)] 
Implement -Wunrecognised-warning-flag

This allows the user to avoid warnings for warning flags that GHC
doesn't recognise. See #11429 for details..

Test Plan: Validate with T11429[abc] tests

Reviewers: austin, hvr

Reviewed By: hvr

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11429

3 years agoAvoid recursive use of immSuperClasses
Simon Peyton Jones [Mon, 25 Jan 2016 08:29:12 +0000 (08:29 +0000)] 
Avoid recursive use of immSuperClasses

In fixing Trac #11480 I had omitted to deal with FunDeps.oclose,
which was making recursive use of immSuperClasses, and hence
going into a loop in the recursive case.

Solution: use transSuperClasses, which takes care not to.
(cherry picked from commit 42c6263f23cf3f00035389637862944e0594bc7a)

3 years agouser-guide: Note order-dependence of flags
Ben Gamari [Mon, 25 Jan 2016 14:18:13 +0000 (15:18 +0100)] 
user-guide: Note order-dependence of flags

This supplements the description previously added in
6400c7687223c5b2141176aa92f7ff987f61aba6. See #10560 for details.

Test Plan: read it

Reviewers: austin

Subscribers: thomie, hvr

Differential Revision:

GHC Trac Issues: #10560

(cherry picked from commit 128b678061120270d3d4fe3eccd1b7dc76a8de35)

3 years agoBetter document behavior of -Wmissed-specialisations
Ben Gamari [Mon, 25 Jan 2016 14:18:04 +0000 (15:18 +0100)] 
Better document behavior of -Wmissed-specialisations

Test Plan: Read it

Reviewers: austin

Subscribers: thomie

Differential Revision:

(cherry picked from commit 6e2658f67bcdbc7fd0ebd2ef6abcd13a6bec80bc)

3 years agoRename -Wmissing-monadfail-instance to plural-form
Herbert Valerio Riedel [Mon, 25 Jan 2016 13:51:50 +0000 (14:51 +0100)] 
Rename -Wmissing-monadfail-instance to plural-form

This warning flag was recently introduced as part of #10751. However,
it was missed during code-review that almost all existing warning
flags use a plural-form, so for consistency this commit renames
that warning flag to `-Wmissing-monadfail-instances`.

Test Plan: local validate (still running)

Reviewers: quchen, goldfire, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10751

(cherry picked from commit 132c20894d102558cc8f3aee5bc289425d0ddb24)

3 years agoHscTypes: Fix typo in comment
Ben Gamari [Sat, 23 Jan 2016 21:51:51 +0000 (22:51 +0100)] 
HscTypes: Fix typo in comment

(cherry picked from commit bc1e085c5dc239b66e970fdc5117aec0933a9a37)

3 years agoShow error message for unknown symbol on Elf_Rel platforms
Reid Barton [Mon, 25 Jan 2016 14:12:40 +0000 (09:12 -0500)] 
Show error message for unknown symbol on Elf_Rel platforms

Summary: This is already the behavior on Elf_Rela platforms, and is helpful.

Reviewers: simonmar, austin, bgamari, erikd

Reviewed By: erikd

Subscribers: thomie

Differential Revision:

(cherry picked from commit 5c8233388983a5af9fda5f3395ad28f4e0392f98)

3 years agoFix exprIsHNF (Trac #11248)
Simon Peyton Jones [Mon, 25 Jan 2016 11:16:18 +0000 (11:16 +0000)] 
Fix exprIsHNF (Trac #11248)

Blimey!  CoreUtils.exprIsHNFlike had not one but two bugs.

 * is_hnf_like treated coercion args like type args
   (result: exprIsHNF might wrongly say True)

 * app_is_value treated type args like value args
   (result: exprIsHNF might wrongly say False)

Bizarre.  This goes back to at least 2012. It's amazing that it
hasn't caused more trouble.

It was discovered by a Lint error when compiling Trac #11248 with -O.

(cherry picked from commit 3c060f36f6eb4d359f252168e2f97b573d017080)

3 years agoSpecial-case implicit params in superclass expansion
Simon Peyton Jones [Fri, 22 Jan 2016 16:34:18 +0000 (16:34 +0000)] 
Special-case implicit params in superclass expansion

This issue came up in Trac #11480, and is documented in
Note [When superclasses help] in TcRnTypes.

We were getting a spurious warning
  T11480.hs:1:1: warning:
     solveWanteds: too many iterations (limit = 4)

The fix is easy.  A bit of refactoring along the way.

The original bug report in Trac #11480 appears to work
fine in HEAD and the 8.0 branch but I added a regression
test in this commit as well.

(cherry picked from commit ff21795a0b9253e811a45626d5686e981ed07f82)

3 years agoAdd -fwarn-redundant-constrains to test for #9708
Thomas Miedema [Sun, 24 Jan 2016 01:49:42 +0000 (02:49 +0100)] 
Add -fwarn-redundant-constrains to test for #9708

Fixes validate on Travis.

Reviewed by: bgamari

Differential Revision:

(cherry picked from commit 2c6fe5b8a854f06ea9574f7dca545b4c2d35b811)

3 years agoRemove `replaceDynFlags` from `ContainsDynFlags`
Thomas Miedema [Tue, 19 Jan 2016 10:54:36 +0000 (11:54 +0100)] 
Remove `replaceDynFlags` from `ContainsDynFlags`

Refactoring only. It's shorter, and brings
`HasDynFlags/ContainsDynFLags` in line with `HasModule/ContainsModule`.
Introduce `updTopEnv`.

Reviewed by: bgamari

Differential Revision:

(cherry picked from commit edc68b2ffe833e487ae6b2b04cd9be18e40a5a5e)

3 years agoDocs: delete section on Hierarchical Modules
Thomas Miedema [Sun, 24 Jan 2016 12:07:47 +0000 (13:07 +0100)] 
Docs: delete section on Hierarchical Modules

This information is mostly useless, since hierarchical modules are valid
Haskell2010 and everybody knows how to use them.

Reviewed by: bgamari

Differential Revision:

(cherry picked from commit 98d6a29e534350efd6aa72c0bf9d9e3ac4a76107)

3 years agouser-guide: Document -L RTS flag
Ben Gamari [Sat, 23 Jan 2016 21:03:04 +0000 (22:03 +0100)] 
user-guide: Document -L RTS flag

See #5641.

(cherry picked from commit 923d2151db261cac36577bcaffa6be41c3f374f9)

3 years agoDon't add ticks around type applications (#11329)
Reid Barton [Sat, 23 Jan 2016 20:30:04 +0000 (15:30 -0500)] 
Don't add ticks around type applications (#11329)

Test Plan: validate --slow

Reviewers: austin, bgamari, goldfire

Reviewed By: goldfire

Subscribers: thomie

Differential Revision:

(cherry picked from commit ec8778862aeb9c3f6b861bc732045db9f58b9b61)

3 years agouser-guide: Fix typos
Ben Gamari [Sat, 23 Jan 2016 20:12:24 +0000 (21:12 +0100)] 
user-guide: Fix typos

(cherry picked from commit b5e52bfc9e331a9ed2b3a30b790cfa331935aebe)

3 years agouser-guide: Reformat warning lists
Ben Gamari [Sat, 23 Jan 2016 18:17:45 +0000 (19:17 +0100)] 
user-guide: Reformat warning lists

(cherry picked from commit 6f96109b283dd5e4364062c5f71e0b11a9dfb9cd)

3 years agomkUserGuidePart: Better flag cross-referencing
Ben Gamari [Sat, 23 Jan 2016 18:10:59 +0000 (19:10 +0100)] 
mkUserGuidePart: Better flag cross-referencing

(cherry picked from commit 1be8491b0c3b07be2ec91feb557502ca06d1e078)

3 years agoRemove -Wredundant-superclasses from standard warnings
Ben Gamari [Sat, 23 Jan 2016 17:40:33 +0000 (18:40 +0100)] 
Remove -Wredundant-superclasses from standard warnings

It is impossible to write warning-free code under the three-release
policy with this flag enabled by default. See #11370 for details.

(cherry picked from commit 8e9a87025f954a2704850bc71cb497f768d5d595)

3 years agoGive a more verbose error message when desugaring a HsTypeOut
Reid Barton [Sat, 23 Jan 2016 12:13:31 +0000 (13:13 +0100)] 
Give a more verbose error message when desugaring a HsTypeOut

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

(cherry picked from commit 7cd37c599fa83817b51234ff2ff79e4e4896b117)

3 years agoSmall doc fix
Adam Sandberg Eriksson [Sat, 23 Jan 2016 12:13:07 +0000 (13:13 +0100)] 
Small doc fix

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

(cherry picked from commit 06c2547326773db85af9c8a076d6ad2710aa5912)

3 years agoAdd test for Trac #11056
RyanGlScott [Sat, 23 Jan 2016 12:03:26 +0000 (13:03 +0100)] 
Add test for Trac #11056

Reviewers: thomie, austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton

Differential Revision:

GHC Trac Issues: #11056

(cherry picked from commit 4e04043d1bb458439d3c3db3ffa9851bff780083)

3 years agoDo not count void arguments when considering a function for loopification.
Jonas Scholl [Fri, 22 Jan 2016 15:21:57 +0000 (16:21 +0100)] 
Do not count void arguments when considering a function for loopification.

This fixes #11372 by omitting arguments with a void-type when checking
whether a self-recursive tail call can be optimized to a local jump.
Previously, a function taking a real argument and a State# token
would report an arity of 1 in the SelfLoopInfo in getCallMethod,
but a self-recursive call would apply it to 2 arguments, one of them
being the State# token, thus no local jump would be generated.
As the State# token is not represented by anything at runtime, we can
ignore it and thus trigger the loopification optimization.

Test Plan: ./validate

Reviewers: austin, bgamari, simonmar

Reviewed By: bgamari

Subscribers: simonmar, thomie

Differential Revision:

GHC Trac Issues: #11372

(cherry picked from commit 4d51bfc8975f9c6c3ab6d293c48f98da85210d5f)

3 years agoFix a formatting error in the user's guide
Eric Seidel [Fri, 22 Jan 2016 15:16:46 +0000 (16:16 +0100)] 
Fix a formatting error in the user's guide


seems to confuse ReST into producing an extended code-span


fixes it, but there may be a better solution

Test Plan: build the user's guide and inspect the last paragraph of
" Implicit CallStacks"

Reviewers: bgamari

Reviewed By: bgamari

Projects: #ghc

Differential Revision:

(cherry picked from commit 6e5f8285005895fe4f1915ddea99b72f8ee91834)

3 years agoMark some ghci tests as req_interp
Reid Barton [Fri, 22 Jan 2016 15:00:27 +0000 (10:00 -0500)] 
Mark some ghci tests as req_interp

Test Plan: validate

Reviewers: bgamari, austin

Reviewed By: bgamari, austin

Subscribers: thomie

Differential Revision:

(cherry picked from commit 65881c014f81f62f90dcb0977528411010b1d1a7)

3 years agoDon't print "Loaded GHCi configuration" message in ghc -e (#11478)
Reid Barton [Fri, 22 Jan 2016 14:59:20 +0000 (09:59 -0500)] 
Don't print "Loaded GHCi configuration" message in ghc -e (#11478)

Also don't print it if the user specifically requested
non-verbose output with -v0.

Since this means there is no longer any test that checks
for the message, add such a test.

Test Plan: validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11478

(cherry picked from commit 9048c3dfee1c7c9171114c349714095b3abcc47a)

3 years agoAdd test for #11473
Ben Gamari [Fri, 22 Jan 2016 12:33:36 +0000 (13:33 +0100)] 
Add test for #11473

(cherry picked from commit 89bdac7635e6ed08927d760aa885d3e7ef3edb81)

3 years agoTyCoRep: Restore compatibility with GHC 7.8
Ben Gamari [Sat, 23 Jan 2016 17:00:38 +0000 (18:00 +0100)] 
TyCoRep: Restore compatibility with GHC 7.8

MIN_VERSION_GLASGOW_HASKELL was only introduced in 7.10.

3 years agoImplement `-Wnoncanonical-monadfail-instances` warning
Herbert Valerio Riedel [Sun, 24 Jan 2016 13:46:44 +0000 (14:46 +0100)] 
Implement `-Wnoncanonical-monadfail-instances` warning

The MonadFail proposal implemented so far via #10751 only warns about
missing `MonadFail` instances based on existence of failible pattern
matches in `do`-blocks.

However, based on the noncanonical Monad warnings implemented via #11150
we can provide a different mechanism for detecting missing `MonadFail`
instances quite cheaply. That is, by checking for canonical `fail` definitions.

In the case of `Monad`/`MonadFail`, we define the canonical implementation of
`fail` to be such that the soft-deprecated method shall (iff overridden) be
defined in terms of the non-deprecated method. Consequently, in case of
`MonadFail`, the `Monad(fail)` method shall be defined as alias of
the `MonadFail(fail)` method.

This allows us at some distant point in the future to remove `fail` from
the `Monad` class, while having GHC ignore/tolerate such literal canonical
method definitions.

Reviewed By: bgamari, RyanGlScott

Differential Revision:

(cherry picked from commit fd6dd41c67f3bd23bbf074357219cfd251eb53d6)

3 years agoUser's guide: fix singular/plural typo in flagnames
Herbert Valerio Riedel [Sun, 24 Jan 2016 14:33:48 +0000 (15:33 +0100)] 
User's guide: fix singular/plural typo in flagnames

(cherry picked from commit 8b5ea7ce66647a3b918ab39fd05ad8be6a0d50b4)

3 years agoDefault non-canonical CallStack constraints
Eric Seidel [Fri, 22 Jan 2016 11:45:53 +0000 (12:45 +0100)] 
Default non-canonical CallStack constraints

Test Plan: `make test TEST=T11462`

Reviewers: austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

Projects: #ghc

Differential Revision:

GHC Trac Issues: #11462

(cherry picked from commit 835a2a24a605f8e458f57c71aa67e9983593b5e4)

3 years agoMake a constraint synonym for repeated BinaryStringRep and use it.
Edward Z. Yang [Thu, 21 Jan 2016 18:27:58 +0000 (19:27 +0100)] 
Make a constraint synonym for repeated BinaryStringRep and use it.

Test Plan: validate

Reviewers: austin, thomie, bgamari

Reviewed By: thomie, bgamari

Subscribers: thomie

Differential Revision:

(cherry picked from commit adb721bd0eb60ab4c55d5197933e8090fe6297c5)

3 years agoImprove comments in CmmSwitch
Joachim Breitner [Thu, 21 Jan 2016 16:55:48 +0000 (17:55 +0100)] 
Improve comments in CmmSwitch

addressing some valuable feedback by thomie at

Differential Revision:

(cherry picked from commit b617e9fe9ce22fb108b7e4a6694167dd893b9dfc)

3 years agosphinx-build: fix python stack overflow (Trac #10950)
Sergei Trofimovich [Thu, 21 Jan 2016 21:43:37 +0000 (21:43 +0000)] 
sphinx-build: fix python stack overflow (Trac #10950)

commit a034031a102bc08c76a6cdb104b72922ae22c96b did not
fix problem completely. Stack overflows still occasionally

Easy to test by the following Torture Test:

  while sphinx-build -T -N -E -a -b html \
        -d docs/users_guide/.doctrees-html \
        -D latex_paper_size=letter \
        docs/users_guide docs/users_guide/build-html/users_guide
    echo again

sphinx build large nested data structures when parses GHC manual
(docs/users_guide/glasgow_exts.rst is 455KB in size) which
can't be serialized useing default python call stack depth of 1000

The patch increases stack depth 10 times. Survived 2 hours of
Torture Test.

Signed-off-by: Sergei Trofimovich <>
Test Plan: ran Torture Test to make sure it is stable

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10950

(cherry picked from commit 4c11db6377aa4fba0c4d70a1e9508247fd053bce)

3 years agoFix docstring GHC.IO.Handle.FD.openFileBLocking
Thomas Miedema [Thu, 21 Jan 2016 20:16:05 +0000 (21:16 +0100)] 
Fix docstring GHC.IO.Handle.FD.openFileBLocking

Fixes #4248.

(cherry picked from commit 4c4a0a52d3ca5befd2a632544e9541703007e356)

3 years agoAdd -ignore-dot-ghci to tests that use --interactive
Reid Barton [Thu, 21 Jan 2016 18:50:00 +0000 (13:50 -0500)] 
Add -ignore-dot-ghci to tests that use --interactive

(cherry picked from commit 2ffc2606cfc58768ddc6dd53f270ba7088c43f3c)

3 years agoUpdate and improve documentation in Data.Foldable
Ben Gamari [Thu, 21 Jan 2016 13:51:01 +0000 (14:51 +0100)] 
Update and improve documentation in Data.Foldable

Previously there were a few obsolete references to `Data.List` and
the descriptions were lacking examples.

Fixes #11065.

Test Plan: Read it.

Reviewers: ekmett, goldfire, hvr, austin

Reviewed By: hvr

Subscribers: nomeata, thomie

Differential Revision:

GHC Trac Issues: #11065

(cherry picked from commit 7cb893f562346d5aa986bd88863335aabbf7e95f)

3 years agorel-notes: Note the return of -Wmonomorphism-restriction
Ben Gamari [Thu, 21 Jan 2016 13:49:01 +0000 (14:49 +0100)] 
rel-notes: Note the return of -Wmonomorphism-restriction

(cherry picked from commit 3883f99c7ea99204a2f15c1e4b7521a4c0b1c527)

3 years agouser-guide: Refer to MIN_VERSION_GLASGOW_HASKELL from intro
Ben Gamari [Thu, 21 Jan 2016 10:30:24 +0000 (11:30 +0100)] 
user-guide: Refer to MIN_VERSION_GLASGOW_HASKELL from intro

And fix markup.

(cherry picked from commit 928484d2b021fc968d5f2dfe490dc0ad201dc7df)

3 years agouser-guide:: Improve -D description
Ben Gamari [Thu, 21 Jan 2016 10:36:00 +0000 (11:36 +0100)] 
user-guide:: Improve -D description

(cherry picked from commit f23b578f792a357fa754604188eea46ca46cf613)

3 years agoTyCoRep: Restore compatibility with 7.10.1
Ben Gamari [Thu, 21 Jan 2016 10:19:23 +0000 (11:19 +0100)] 
TyCoRep: Restore compatibility with 7.10.1

Sadly CallStack wasn't present in 7.10.1, breaking the build when
bootstrapping from this version.

This patch essentially disables CallStack support for stage1 builds with
7.10.*. This doesn't seem so unreasonable though as stage2 will still

Test Plan: Validate with 7.10.1

Reviewers: gridaphobe, jstolarek, austin

Reviewed By: jstolarek

Subscribers: thomie, jstolarek

Differential Revision:

GHC Trac Issues: #11472

(cherry picked from commit ede055eb230ac33da276f1416678f99e32e83da2)

3 years agoAllow implicit parameters in constraint synonyms
Simon Peyton Jones [Thu, 21 Jan 2016 12:26:50 +0000 (12:26 +0000)] 
Allow implicit parameters in constraint synonyms

This fixes Trac #11466.

It went bad by accident in
 commit ffc21506894c7887d3620423aaf86bc6113a1071
 Refactor tuple constraints

(cherry picked from commit 395ec414ff21bc37439194bb31a8f764b38b0fca)

3 years agoStrip casts in checkValidInstHead
Simon Peyton Jones [Wed, 20 Jan 2016 16:04:20 +0000 (16:04 +0000)] 
Strip casts in checkValidInstHead

This patch addresses Trac #11464.

The fix is a bit crude (traverse the type to remove CastTys),
but it's also simple.

See Note [Casts during validity checking] in TcValidity

(cherry picked from commit b2e6350fb23403f1c88c5cfed5270d78dbdb6573)

3 years agoImprove pretty-printing of UnivCo
Simon Peyton Jones [Wed, 20 Jan 2016 14:10:08 +0000 (14:10 +0000)] 
Improve pretty-printing of UnivCo

We really need to know the UnivCoProvenance to make sense
of UnivCos in debug output

(cherry picked from commit b3ee37ce2b4ebde0f0e5574e2e50b2177bddf361)

3 years agoComments only
Simon Peyton Jones [Wed, 20 Jan 2016 14:09:35 +0000 (14:09 +0000)] 
Comments only

(cherry picked from commit 6f95e23249c18d2e808b6586d2efecd3f3f0fb50)

3 years agoRe-add missing kind generalisation
Simon Peyton Jones [Tue, 19 Jan 2016 13:18:39 +0000 (13:18 +0000)] 
Re-add missing kind generalisation

When splitting H98/GADT syntax in ConDecl we lost a key
kind-generalisation step.

I also renamed tcHsTyVarBndrs to tcExplicitTKBnders, by analogy
with tcImplicitTkBndrs.

This fixes Trac #11459.

Merge to 8.0.

(cherry picked from commit c572430cdade1d8c66fa9c4f1f251dfce09243f0)

3 years agosubstTy to substTyUnchecked to fix Travis build
Bartosz Nitka [Wed, 20 Jan 2016 16:58:52 +0000 (08:58 -0800)] 
substTy to substTyUnchecked to fix Travis build

This fixes the immediate problem from

Test Plan: ./validate

Reviewers: bgamari, austin, thomie

Differential Revision:

GHC Trac Issues: #11371

(cherry picked from commit 48d4bc53c517d5e2ac3ff734a7d7a0e2d9454717)

3 years agoCheck InScopeSet in substTy and provide substTyUnchecked
Bartosz Nitka [Tue, 19 Jan 2016 11:25:39 +0000 (03:25 -0800)] 
Check InScopeSet in substTy and provide substTyUnchecked

This adds sanity checks to `substTy` that implement:

> when calling substTy subst ty it should be the case that the in-scope
> set in the substitution is a superset of
> * The free vars of the range of the substitution
> * The free vars of ty minus the domain of the substitution

and replaces violators with unchecked version. The violators were found
by running the GHC test suite.

This ensures that I can work on this incrementally and that what I fix won't
be undone by some other change.

It also includes a couple of fixes that I've already done.

Test Plan: ./validate

Reviewers: simonmar, goldfire, simonpj, austin, bgamari

Reviewed By: simonpj, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11371

(cherry picked from commit 9d33adb6f352ad4e488067a8756928b3778920e0)