3 years agoUpdate Cabal submodule to latest HEAD snapshot
Herbert Valerio Riedel [Tue, 8 Mar 2016 09:58:49 +0000 (10:58 +0100)] 
Update Cabal submodule to latest HEAD snapshot

3 years agoRefactoring around TcPatSyn.tcPatToExpr
Simon Peyton Jones [Wed, 9 Mar 2016 13:14:09 +0000 (13:14 +0000)] 
Refactoring around TcPatSyn.tcPatToExpr

Just comments, a bit of refactoring, and a better
error-reporting infrastructure

3 years agoFix the implementation of lazyId
Simon Peyton Jones [Tue, 8 Mar 2016 15:27:54 +0000 (15:27 +0000)] 
Fix the implementation of lazyId

'lazy' was doing part of its job, but not all!  In particular,
an application
  f (lazy e)
where f is strict, was still being compiled using call-by-value in
CorePrep.  This defeated the purpose of defining catch as
   catch a b = catch# (lazy a) b
See Trac #11555, and Neil Mitchell's test case in comment:14

This patch makes 'lazy' behave properly. I updated Note [lazyId magic]
in MkId, but all the action is in CorePrep.

I can't say I really like this, but it does the job.

3 years agotemplate-haskell: define `MonadFail Q` instance
Herbert Valerio Riedel [Tue, 8 Mar 2016 16:26:00 +0000 (17:26 +0100)] 
template-haskell: define `MonadFail Q` instance

When `MonadFail`is available, this patch makes `MonadFail` a superclass
of `Quasi`, and `Q` an instance of `MonadFail`.

NB: Since f16ddcee0c64a92ab911a7841a8cf64e3ac671fd, we need to be able
    to compile `template-haskell` with stage0 compilers that don't provide
    a `MonadFail` class yet. Once we reach GHC 8.3 development we can drop
    the CPP conditionals again.

Addresses #11661

Reviewed By: bgamari, goldfire

Differential Revision:

3 years agotemplate-haskell: remove redundant CPP use
Herbert Valerio Riedel [Tue, 8 Mar 2016 11:46:49 +0000 (12:46 +0100)] 
template-haskell: remove redundant CPP use

GHC 8.1's template-haskell package requires base>=4.8 anyway, so
we can assume Numeric.Natural to be available unconditionally.

3 years agotemplate-haskell: Drop use of Rank2Types/PolymorphicComponents
Herbert Valerio Riedel [Tue, 8 Mar 2016 11:42:32 +0000 (12:42 +0100)] 
template-haskell: Drop use of Rank2Types/PolymorphicComponents

As per #6032, `Rank2Types` and `PolymorphicComponents` have been
deprecated in favour of `RankNTypes`.

also update `other-extensions` in template-haskell.cabal flag to
reflect reality.

3 years agoSplit external symbol prototypes (EF_) (Trac #11395)
Sergei Trofimovich [Tue, 8 Mar 2016 08:14:08 +0000 (08:14 +0000)] 
Split external symbol prototypes (EF_) (Trac #11395)

Before the patch both Cmm and C symbols were declared
with 'EF_' macro:

    #define EF_(f)    extern StgFunPtr f()

but for Cmm symbols we know exact prototypes.

The patch splits there prototypes in to:

    #define EFF_(f)   void f() /* See Note [External function prototypes] */
    #define EF_(f)    StgFunPtr f(void)

Cmm functions are 'EF_' (External Functions),
C functions are 'EFF_' (External Foreign Functions).

While at it changed external C function prototype
to return 'void' to workaround ghc bug on m68k.
Described in detail in Trac #11395.

This makes simple tests work on m68k-linux target!

Thanks to Michael Karcher for awesome analysis
happening in Trac #11395.

Signed-off-by: Sergei Trofimovich <>
Test Plan: ran "hello world" on m68k successfully

Reviewers: simonmar, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11395

3 years agoReduce fragmentation from m32_allocator
Bartosz Nitka [Sun, 6 Mar 2016 21:18:12 +0000 (13:18 -0800)] 
Reduce fragmentation from m32_allocator

This patch brings in two improvements:
a) m32_allocator will now reuse the pages that are no longer
used by anyone else.
b) m32_allocator will preallocate the "filling" area,
so that the pages it allocates end up as a big chunk
instead of being allocated on demand in random places,
fragmenting the precious lower 2G address space.

Test Plan: testsuite - 3 tests failing with substTy asserts

Reviewers: ezyang, austin, bgamari, erikd, hsyl20, simonmar

Reviewed By: hsyl20, simonmar

Subscribers: hvr, thomie

Differential Revision:

3 years agoRevert "Mark tests for #11643, #11644, #11645 and #9406 expect_broken"
Ben Gamari [Mon, 7 Mar 2016 13:49:38 +0000 (14:49 +0100)] 
Revert "Mark tests for #11643, #11644, #11645 and #9406 expect_broken"

This reverts commit 90fa8cf2bf1677545c3f4a8bc967b1674822e90a.

As noted in #11643, these should be fixed.

Updates hpc submodule.

3 years agoGhcMake: Clang/ASSERT fix
Erik de Castro Lopo [Mon, 7 Mar 2016 13:32:07 +0000 (14:32 +0100)] 
GhcMake: Clang/ASSERT fix

Test Plan: Build with clang

Reviewers: thomie, rwbarton, austin, bgamari

Reviewed By: bgamari

Differential Revision:

3 years agoFix minimum alignment for StgClosure (Trac #11395)
Sergei Trofimovich [Sun, 6 Mar 2016 09:55:12 +0000 (09:55 +0000)] 
Fix minimum alignment for StgClosure (Trac #11395)

The bug is observed on m68k-linux target as crash
in RTS:

    -- a.hs:
    main = print 43

    $ inplace/bin/ghc-stage1 --make -debug a.hs

    $ ./a
    Program terminated with signal SIGSEGV, Segmentation fault.
    #0  0x80463b0a in LOOKS_LIKE_INFO_PTR_NOT_NULL (p=32858)
        at includes/rts/storage/ClosureMacros.h:248
    (gdb) bt
    #0  0x80463b0a in LOOKS_LIKE_INFO_PTR_NOT_NULL (p=32858)
        at includes/rts/storage/ClosureMacros.h:248
    #1  0x80463b46 in LOOKS_LIKE_INFO_PTR (p=32858)
        at includes/rts/storage/ClosureMacros.h:253
    #2  0x80463b6c in LOOKS_LIKE_CLOSURE_PTR (
            p=0x805aac6e <stg_dummy_ret_closure>)
        at includes/rts/storage/ClosureMacros.h:258
    #3  0x80463e4c in initStorage ()
        at rts/sm/Storage.c:121
    #4  0x8043ffb4 in hs_init_ghc (...)
        at rts/RtsStartup.c:181
    #5  0x80455982 in hs_main (...)
        at rts/RtsMain.c:51
    #6  0x80003c1c in main ()

GHC assumes last 2 pointer bits are tags on 32-bit targets.
But here 'stg_dummy_ret_closure' address violates the assumption:

    LOOKS_LIKE_CLOSURE_PTR (p=0x805aac6e <stg_dummy_ret_closure>)

I've added compiler hint for static StgClosure objects to
align closures at least by their natural alignment (what GHC assumes).
See Note [StgWord alignment].

Signed-off-by: Sergei Trofimovich <>
Test Plan: ran basic test on m68k qemu, it got past ASSERTs

Reviewers: simonmar, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11395

3 years agoDrop module qualifier from punned record fields (#11662)
Adam Gundry [Sat, 5 Mar 2016 19:02:32 +0000 (20:02 +0100)] 
Drop module qualifier from punned record fields (#11662)

A record pattern match, construction or update like
`Rec { Mod.f }` should expand to `Rec { Mod.f = f }` rather
than `Rec { Mod.f = Mod.f }`.

Test Plan: New test rename/should_compile/T11662

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: hesselink, thomie

Differential Revision:

GHC Trac Issues: #11662

3 years agoUsing unsafe foreign import for rtsSupportsBoundThreads (part of #9696)
Marcin Mrotek [Sat, 5 Mar 2016 19:02:18 +0000 (20:02 +0100)] 
Using unsafe foreign import for rtsSupportsBoundThreads (part of #9696)

A safe import is unnecessary considering rtsSupportsBoundThreads simply
returns a constant.

This commit doesn't fix the main issue of ticket #9696 that
"readRawBufferPtr and writeRawBufferPtr allocate memory".

Reviewers: bgamari, austin, hvr

Reviewed By: hvr

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #9696

3 years agoFix printing of an `IfacePatSyn`
Rik Steenkamp [Sat, 5 Mar 2016 19:01:06 +0000 (20:01 +0100)] 
Fix printing of an `IfacePatSyn`

Now the existentially quantified type variables are printed
at the correct location when printing a pattern synonym type
from an `IfacePatSyn`. The function `pprIfaceContextMaybe`
has been removed as it is no longer needed.

Fixes #11524.

Reviewers: austin, goldfire, thomie, bgamari, mpickering

Reviewed By: bgamari

Differential Revision:

GHC Trac Issues: #11524

3 years agoGHCi: Fix load/reload space leaks (#4029)
Jason Eisenberg [Sat, 5 Mar 2016 19:00:38 +0000 (20:00 +0100)] 
GHCi: Fix load/reload space leaks (#4029)

This patch addresses GHCi load/reload space leaks which could be
fixed without adversely affecting performance.

Test Plan: make test "TEST=T4029"

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: mpickering, thomie

Differential Revision:

GHC Trac Issues: #4029

3 years agorts/timer: use timerfd_* on Linux instead of alarm signals
Sylvain HENRY [Sat, 5 Mar 2016 19:00:06 +0000 (20:00 +0100)] 
rts/timer: use timerfd_* on Linux instead of alarm signals

Reviewers: erikd, simonmar, austin, bgamari

Reviewed By: simonmar, bgamari

Subscribers: hvr, thomie

Differential Revision:

GHC Trac Issues: #10840

3 years agousers-guide: Mention #11558 in release notes
Ben Gamari [Sat, 5 Mar 2016 15:26:33 +0000 (16:26 +0100)] 
users-guide: Mention #11558 in release notes

3 years agoSimplEnv: Add Haddock headings to export list
Ben Gamari [Fri, 4 Mar 2016 22:15:34 +0000 (23:15 +0100)] 
SimplEnv: Add Haddock headings to export list

3 years agoAdd Monoid instance for FastString
Ben Gamari [Fri, 4 Mar 2016 21:48:50 +0000 (22:48 +0100)] 
Add Monoid instance for FastString

3 years agoUse tyConArity rather than (length tvs)
Simon Peyton Jones [Wed, 2 Mar 2016 15:22:46 +0000 (15:22 +0000)] 
Use tyConArity rather than (length tvs)

A bit more efficient

3 years agoFix an outright bug in expandTypeSynonyms
Simon Peyton Jones [Wed, 2 Mar 2016 15:12:12 +0000 (15:12 +0000)] 
Fix an outright bug in expandTypeSynonyms

The bug was in this code:

    go subst (TyConApp tc tys)
      | Just (tenv, rhs, tys') <- expandSynTyCon_maybe tc tys
      = let subst' = unionTCvSubst subst (mkTvSubstPrs tenv) in
        go subst' (mkAppTys rhs tys')

This is wrong in two ways.
 * It is wrong to apply the expanded substitution to tys',
 * The unionTCvSubst is utterly wrong; after all, rhs is
   completely separate, and the union makes a non-idempotent

It was the non-idempotency that gave the Lint failure in Trac #11665,
when there was a type synonym whose RHS mentioned another type synonym,
something like

  type T a b = a -> b
  type S x y = T y x

It only affects SpecConstr because that's about the only place where
expandTypeSyonym is called.  I tried to trigger the failure with a
simple test case, but failed, so I have not added a regression test.

Fortunately the solution is very simple and solid.

FWIW, the culprit was 674654, "Add kind equalities to GHC".

3 years agoDon't complain about unused Rule binders
Simon Peyton Jones [Tue, 1 Mar 2016 17:07:26 +0000 (17:07 +0000)] 
Don't complain about unused Rule binders

This fixes Trac #11643.  It's a corner case, now documented in
Note [Linting rules] in CoreLint

3 years agoRemove unnecessary isTyVar tests in TcType
Simon Peyton Jones [Tue, 1 Mar 2016 17:05:56 +0000 (17:05 +0000)] 
Remove unnecessary isTyVar tests in TcType

These extra tests were added by Richard when he had CoVars floating
around in places where previously only TyVars had been.  But
fortunately those days are gone, so these tests are unnecessary,
and are slowing GHC down.

Let's remove them.

3 years agoA bit more tracing in TcHsType.tcTyVar
Simon Peyton Jones [Mon, 29 Feb 2016 14:17:30 +0000 (14:17 +0000)] 
A bit more tracing in TcHsType.tcTyVar

3 years agoComments only
Simon Peyton Jones [Mon, 29 Feb 2016 14:16:18 +0000 (14:16 +0000)] 
Comments only

3 years agoDo not check synonym RHS for ambiguity
Simon Peyton Jones [Mon, 29 Feb 2016 14:12:28 +0000 (14:12 +0000)] 
Do not check synonym RHS for ambiguity

With this patch we no longer check the RHS of a type synonym
declaration for ambiguity.  It only affects type synonyms with foralls
on the RHS (which are rare in the first place), and it's arguably
over-aggressive to check them for ambiguity.  See TcValidity
Note [When we don't check for ambiguity]

This fixes the ASSERT failures in
   th                        T3100
   typecheck/should_compile  T3692
   typecheck/should_fail     T3592

3 years agoSkip TEST=TcCoercibleFail when compiler_debugged
Thomas Miedema [Mon, 29 Feb 2016 12:59:48 +0000 (13:59 +0100)] 
Skip TEST=TcCoercibleFail when compiler_debugged

3 years agoOnly add -fshow-warning-groups for ghc >= 7.11 (#10752)
Thomas Miedema [Mon, 29 Feb 2016 12:49:05 +0000 (13:49 +0100)] 
Only add -fshow-warning-groups for ghc >= 7.11 (#10752)

3 years agoRemove some more Windows line endings [skip ci]
Thomas Miedema [Tue, 23 Feb 2016 03:43:58 +0000 (04:43 +0100)] 
Remove some more Windows line endings [skip ci]

3 years agoTestsuite: check actual_prof_file only when needed
Thomas Miedema [Fri, 26 Feb 2016 10:23:28 +0000 (11:23 +0100)] 
Testsuite: check actual_prof_file only when needed

Might be a little faster. Avoids testing for #6113 (.prof file not
written when process is killed with any signal but SIGINT) for tests
that don't have a .prof.sample file (which is almost all of them) when
running the profiling ways.
Tests that were failing because of #6113: T8089, overflow1, overflow2 and

3 years agoDynFlags: Add -Wredundant-constraints to -Wall
Ben Gamari [Mon, 29 Feb 2016 11:28:49 +0000 (12:28 +0100)] 
DynFlags: Add -Wredundant-constraints to -Wall

Test Plan: It works, I promise.

Reviewers: austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11370

3 years agoBuild system: Correctly pass `TARGETPLATFORM` as host
Nicolas Trangez [Mon, 29 Feb 2016 10:56:33 +0000 (11:56 +0100)] 
Build system: Correctly pass `TARGETPLATFORM` as host

When building the bundled GMP sources, the `HOSTPLATFORM` value was
passed to the `--host` flag of the `./configure` call. This is
incorrect: when building a cross-compiler, e.g. a compiler targeting
ARM but running on X86, the host on which GMP will run is ARM, i.e.
the target platform of the compiler, and the host platform (i.e. the
platform on which the compiler will run) is X86.

See e.g. [1] for more information about the meaning of and relation
between build, host and target.


Test Plan: Building ARM cross-compiler with `integer-gmp`

Reviewers: thomie, gracjan, austin, erikd, Phyx, hvr, bgamari

Reviewed By: erikd, bgamari

Subscribers: erikd, gracjan

Differential Revision:

3 years agoRefactor `warnMissingSignatures` in `RnNames.hs`
Rik Steenkamp [Mon, 29 Feb 2016 10:56:16 +0000 (11:56 +0100)] 
Refactor `warnMissingSignatures` in `RnNames.hs`

Reviewers: austin, thomie, bgamari

Reviewed By: thomie, bgamari

Differential Revision:

3 years agoFix bug where reexports of wired-in packages don't work.
Edward Z. Yang [Mon, 29 Feb 2016 10:53:34 +0000 (11:53 +0100)] 
Fix bug where reexports of wired-in packages don't work.

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

Reviewers: hvr, bgamari, austin

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11589

3 years agobase: Mark Data.Type.Equality as Trustworthy
Ben Gamari [Mon, 29 Feb 2016 11:29:25 +0000 (12:29 +0100)] 
base: Mark Data.Type.Equality as Trustworthy

Test Plan: Validate

Reviewers: austin, ekmett, hvr

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11625

3 years agoMissing Proxy instances, make U1 instance more Proxy-like
RyanGlScott [Mon, 29 Feb 2016 11:28:18 +0000 (12:28 +0100)] 
Missing Proxy instances, make U1 instance more Proxy-like

This accomplishes three things:

* Adds missing `Alternative`, `MonadPlus`, and `MonadZip` instances for
* Adds a missing `MonadPlus` instance for `U1`
* Changes several existing `U1` instances to use lazy pattern-matching,
  exactly how `Proxy` does it (in case we ever replace `U1` with
  `Proxy`). This is technically a breaking change (albeit an extremely
  minor one).

Test Plan: ./validate

Reviewers: austin, ekmett, hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11650

3 years agoDefault to -fno-show-warning-groups (re #10752)
Herbert Valerio Riedel [Sat, 27 Feb 2016 22:36:11 +0000 (23:36 +0100)] 
Default to -fno-show-warning-groups (re #10752)

As `-fno-show-warning-groups` shows associated warning groups regardless
of whether the respective warning group flag as been passed on the CLI,
the warning-group information may be confusing to users.

At this point, `-fshow-warning-groups` is useful mostly to GHC
developers and possibly GHC users who want to see which warning groups
an emitted warning is part of. (Btw, this is particularly interesting in
combination with `-Weverything` which enables *every* warning flag known
to GHC.)

Consequently, starting with this commit, one has to opt-in via
`-fshow-warning-groups` for GHC to show warning groups.

In order to reduce the testsuite delta in this commit, the
`-fshow-warning-groups` flag has been added to TEST_HC_OPTS.

3 years agoAnnotate `[-Wdeferred-type-errors]` in warnings (re #10752)
Herbert Valerio Riedel [Sat, 27 Feb 2016 18:45:11 +0000 (19:45 +0100)] 
Annotate `[-Wdeferred-type-errors]` in warnings (re #10752)

This was missed in bb5afd3c274011c5ea302210b4c290ec1f83209c

3 years agoPrint which flag controls emitted SafeHaskell warnings
Herbert Valerio Riedel [Sat, 27 Feb 2016 17:48:04 +0000 (18:48 +0100)] 
Print which flag controls emitted SafeHaskell warnings

This is extends bb5afd3c274011c5ea302210b4c290ec1f83209c to cover
SafeHaskell warnings.

This implements yet another part of #10752

3 years agoAnnotate `[-Wredundant-constraints]` in warnings (re #10752)
Herbert Valerio Riedel [Sat, 27 Feb 2016 17:26:32 +0000 (18:26 +0100)] 
Annotate `[-Wredundant-constraints]` in warnings (re #10752)

This was missed in bb5afd3c274011c5ea302210b4c290ec1f83209c

3 years agoPrint which flag controls emitted lexer warnings
Herbert Valerio Riedel [Sat, 27 Feb 2016 16:34:14 +0000 (17:34 +0100)] 
Print which flag controls emitted lexer warnings

This is extends bb5afd3c274011c5ea302210b4c290ec1f83209c to cover
warnings emitted during lexing.

This implements another part of #10752

3 years agoPrint which flag controls emitted desugaring warnings
Herbert Valerio Riedel [Sat, 27 Feb 2016 12:50:10 +0000 (13:50 +0100)] 
Print which flag controls emitted desugaring warnings

This is extends bb5afd3c274011c5ea302210b4c290ec1f83209c to cover
warnings emitted during the desugaring phase.

This implements another part of #10752

Reviewed-by: quchen, bgamari
Differential Revision:

3 years agorts: drop unused global 'blackhole_queue'
Sergei Trofimovich [Sat, 27 Feb 2016 14:44:45 +0000 (14:44 +0000)] 
rts: drop unused global 'blackhole_queue'

Commit 5d52d9b64c21dcf77849866584744722f8121389 removed
global 'blackhole_queue' in favour of new mechanism:
when TSO hits blackhole TSO blocks waiting for
'MessgaeBlackhole' delivery.

Patch removed unused global and updates stale comments.
Noticed by Yuras Shumovich.

Signed-off-by: Sergei Trofimovich <>
Test Plan: build test

Reviewers: simonmar, austin, Yuras, bgamari

Reviewed By: Yuras, bgamari

Subscribers: thomie

Differential Revision:

3 years agoGHC.Generics: Ensure some, many for U1 don't bottom
Ben Gamari [Fri, 26 Feb 2016 22:02:31 +0000 (23:02 +0100)] 
GHC.Generics: Ensure some, many for U1 don't bottom

Reviewers: austin, hvr, ekmett, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11650

3 years agoUpdate transformer submodule to v0.5.2.0 release
Herbert Valerio Riedel [Wed, 17 Feb 2016 17:23:08 +0000 (18:23 +0100)] 
Update transformer submodule to v0.5.2.0 release

Most notably, this update pulls in documentation improvements
and several INLINE pragmas for significant performance gains[1].


3 years agoTest Trac #11611
Simon Peyton Jones [Fri, 26 Feb 2016 17:45:18 +0000 (17:45 +0000)] 
Test Trac #11611

3 years agoFilter out BuiltinRules in occurrence analysis
Simon Peyton Jones [Fri, 26 Feb 2016 17:12:52 +0000 (17:12 +0000)] 
Filter out BuiltinRules in occurrence analysis

Fixes Trac #11651.  Merge to 8.0.

3 years agoFix kind generalisation for pattern synonyms
Simon Peyton Jones [Fri, 26 Feb 2016 09:20:12 +0000 (09:20 +0000)] 
Fix kind generalisation for pattern synonyms

We were failing to zonk, after quantifyTyVars, and that left
un-zonked type variables in the final PatSyn.

This fixes the patsyn/ problems in Trac #11648, but not
the polykinds/ ones.

3 years agoComments and white space only
Simon Peyton Jones [Fri, 26 Feb 2016 09:07:39 +0000 (09:07 +0000)] 
Comments and white space only

3 years agoExclude TyVars from the constraint solver
Simon Peyton Jones [Fri, 26 Feb 2016 09:02:07 +0000 (09:02 +0000)] 
Exclude TyVars from the constraint solver

There is a general invariant that the constraint solver doesn't see
TyVars, only TcTyVars.  But when checking the generic-default
signature of a class, we called checkValidType on the generic-default
type, which had the class TyVar free. That in turn meant that it wasn't
considered during flattening, which led to the error reported in
Trac #11608.

The fix is simple: call checkValidType on the /closed/ type. Easy.

While I was at it, I added a bunch of ASSERTs about the TcTyVar

3 years agoGet the right in-scope set in specUnfolding
Simon Peyton Jones [Thu, 25 Feb 2016 15:55:56 +0000 (15:55 +0000)] 
Get the right in-scope set in specUnfolding

This fixes Trac #11600

3 years agoSpecial case for desugaring AbsBinds
Simon Peyton Jones [Thu, 25 Feb 2016 15:53:59 +0000 (15:53 +0000)] 
Special case for desugaring AbsBinds

When AbsBinds has no tyvars and no dicts, a rather simpler
desugaring is possible.  This patch implements it.

I don't think the optimised code changes, but there is
less clutter generated.

3 years agoFix and refactor strict pattern bindings
Simon Peyton Jones [Thu, 25 Feb 2016 15:53:03 +0000 (15:53 +0000)] 
Fix and refactor strict pattern bindings

This patch was triggered by Trac #11601, where I discovered that
-XStrict was really not doing the right thing. In particular,

  f y = let !(Just x) = blah[y] in body[y,x]

This was evaluating 'blah' but not pattern matching it
against Just until x was demanded.  This is wrong.

The patch implements a new semantics which ensures that strict
patterns (i.e. ones with an explicit bang, or with -XStrict)
are evaluated fully when bound.

* There are extensive notes in DsUtils:
  Note [mkSelectorBinds]

* To do this I found I need one-tuples;
  see Note [One-tuples] in TysWiredIn

I updated the user manual to give the new semantics

3 years agoTypos in comments, etc.
Gabor Greif [Fri, 26 Feb 2016 14:48:10 +0000 (15:48 +0100)] 
Typos in comments, etc.

3 years agoUnconditionally handle TH known key names.
Edward Z. Yang [Thu, 25 Feb 2016 20:47:30 +0000 (21:47 +0100)] 
Unconditionally handle TH known key names.

Previously, we didn't add Template Haskell key names to the list
of known uniques when building a stage 1 compiler.  But with
f16ddcee0c64a92ab911a7841a8cf64e3ac671fd we may refer to TH
names even in stage 1, and this was causing uniques to not
be setup properly.

Signed-off-by: Edward Z. Yang <>
Test Plan: validate and run stage1 test suite

Reviewers: osa1, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10382

3 years agoPrint which warning-flag controls an emitted warning
Michael Walker [Thu, 25 Feb 2016 16:34:07 +0000 (17:34 +0100)] 
Print which warning-flag controls an emitted warning

Both gcc and clang tell which warning flag a reported warning can be
controlled with, this patch makes ghc do the same. More generally, this
allows for annotated compiler output, where an optional annotation is
displayed in brackets after the severity.

This also adds a new flag `-f(no-)show-warning-groups` to control
whether to show which warning-group (such as `-Wall` or `-Wcompat`)
a warning belongs to. This flag is on by default.

This implements #10752

Reviewed By: quchen, bgamari, hvr

Differential Revision:

3 years agoTestsuite: do not write empty files on 'make accept'
Thomas Miedema [Tue, 23 Feb 2016 20:29:59 +0000 (21:29 +0100)] 
Testsuite: do not write empty files on 'make accept'

Also prevent showing '\ No newline at end of file' in diff output.

3 years agoTestsuite: delete empty files [skip ci]
Thomas Miedema [Tue, 23 Feb 2016 20:37:22 +0000 (21:37 +0100)] 
Testsuite: delete empty files [skip ci]

3 years agoMark tests for #11643, #11644, #11645 and #9406 expect_broken
Thomas Miedema [Thu, 25 Feb 2016 13:15:41 +0000 (14:15 +0100)] 
Mark tests for #11643, #11644, #11645 and #9406 expect_broken

For opt_ways or prof_ways only.

indexed-types/should_compile/all.T called setTestOpts to not run
the tests with opt_ways. Since I'm finding regressions for opt_ways, I
removed it. This only makes a difference when running
`./validate --slow` or `make slowtest`.

Update submodule hpc.

3 years agoTestsuite: for tests that use TH, omit *all* prof_ways
Thomas Miedema [Mon, 22 Feb 2016 17:55:30 +0000 (18:55 +0100)] 
Testsuite: for tests that use TH, omit *all* prof_ways

Instead of just profasm and profthreaded. And at least until
-fexternal-interpreter is the default.

  * WAY=profc doesn't exist anymore.
  * Omit all threaded_ways for conc039, not just a few.

3 years agoTestsuite: Introduce config.plugin_way_flags.
Thomas Miedema [Thu, 25 Feb 2016 00:00:48 +0000 (01:00 +0100)] 
Testsuite: Introduce config.plugin_way_flags.

Refactoring only.

3 years agoImprove pattern synonym error messages (add `PatSynOrigin`)
Rik Steenkamp [Thu, 25 Feb 2016 18:27:54 +0000 (19:27 +0100)] 
Improve pattern synonym error messages (add `PatSynOrigin`)

Adds a new data constructor `PatSynOrigin Bool Name` to the `CtOrigin`
data type. This allows for better error messages when the origin of a
wanted constraint is a pattern synonym declaration.

Fixes T10873.

Reviewers: mpickering, simonpj, austin, thomie, bgamari

Reviewed By: simonpj, thomie, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10873

3 years agoNote new GHC.Generics instances in release notes
Ben Gamari [Thu, 25 Feb 2016 18:26:46 +0000 (19:26 +0100)] 
Note new GHC.Generics instances in release notes

3 years agoImprove accuracy of suggestion to use TypeApplications
Matthew Pickering [Thu, 25 Feb 2016 14:51:46 +0000 (15:51 +0100)] 
Improve accuracy of suggestion to use TypeApplications

The suggestion only makes sense when we try
to use an as pattern in an expression context.

It is misleading in the case of a lazy pattern and
view pattern.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

3 years agoHandle multiline named haddock comments properly
Thomas Miedema [Thu, 25 Feb 2016 14:51:38 +0000 (15:51 +0100)] 
Handle multiline named haddock comments properly

Fixes #10398 in a different way, thereby also fixing #11579.

I inverted the logic of the Bool argument to "worker", to hopefully make
it more self-explanatory.

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Differential Revision:

3 years ago(Alternative way to) address #8710
George Karachalias [Thu, 25 Feb 2016 14:50:35 +0000 (15:50 +0100)] 
(Alternative way to) address #8710

Issue a separate warning per redundant (or inaccessible) clause.
This way each warning can have more precice location information
(the location of the clause under consideration and not the whole

I thought that this could be too much but actually the number of
such warnings is bound by the number of cases matched against (in
contrast to the non-exhaustive warnings which may be exponentially

Test Plan: validate

Reviewers: simonpj, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #8710

3 years agocmpTypeX: Avoid kind comparison when possible
Ben Gamari [Thu, 25 Feb 2016 14:44:20 +0000 (15:44 +0100)] 
cmpTypeX: Avoid kind comparison when possible

This comparison is only necessary when the types being compared contain
casts. Otherwise the structural equality of the types implies that their
kinds are equal.

Test Plan: Validate

Reviewers: goldfire, austin, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11597

3 years agoBump haddock.base allocations
Ben Gamari [Thu, 25 Feb 2016 14:35:25 +0000 (15:35 +0100)] 
Bump haddock.base allocations

I believe this is probably due to the recent RuntimeRep change.

3 years agoReconstruct record expression in bidir pattern synonym
Matthew Pickering [Thu, 25 Feb 2016 13:52:39 +0000 (14:52 +0100)] 
Reconstruct record expression in bidir pattern synonym

Reviewers: austin, rdragon, bgamari

Reviewed By: bgamari

Subscribers: rdragon, thomie

Differential Revision:

3 years agoMake warning names more consistent
Manav Rathi [Thu, 25 Feb 2016 13:51:32 +0000 (14:51 +0100)] 
Make warning names more consistent

- Replace "Sigs" with "Signatures" in WarningFlag data constructors.
- Replace "PatSyn" with "PatternSynonym" in WarningFlag data
- Deprecate "missing-local-sigs" in favor of "missing-local-signatures".
- Deprecate "missing-exported-sigs" in favor of
- Deprecate "missing-pat-syn-signatures" in favor of
- Replace "ddump-strsigs" with "ddump-str-signatures"

These complete the tasks that were explicitly mentioned in #11583

Test Plan:
Executed `ghc --show-options` and verified that the flags were changed
as expected.

Reviewers: svenpanne, austin, bgamari

Reviewed By: austin, bgamari

Subscribers: mpickering, thomie

Differential Revision:

GHC Trac Issues: #11583

3 years agoAdd more type class instances for GHC.Generics
RyanGlScott [Thu, 25 Feb 2016 13:49:48 +0000 (14:49 +0100)] 
Add more type class instances for GHC.Generics

GHC.Generics provides several representation data types that have
obvious instances of various type classes in base, along with various
other types of meta-data (such as associativity and fixity).
Specifically, instances have been added for the following type classes
(where possible):

    - Applicative
    - Data
    - Functor
    - Monad
    - MonadFix
    - MonadPlus
    - MonadZip
    - Foldable
    - Traversable
    - Enum
    - Bounded
    - Ix
    - Generic1

Thanks to ocharles for starting this!

Test Plan: Validate

Reviewers: ekmett, austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: RyanGlScott, thomie

Differential Revision:

GHC Trac Issues: #9043

3 years agoHscMain: Delete some unused code
Ömer Sinan Ağacan [Thu, 25 Feb 2016 13:47:47 +0000 (14:47 +0100)] 
HscMain: Delete some unused code

Reviewers: bgamari, austin

Reviewed By: austin

Subscribers: thomie

Differential Revision:

3 years agoApplicativeDo: Handle terminal `pure` statements
Ben Gamari [Thu, 25 Feb 2016 13:47:34 +0000 (14:47 +0100)] 
ApplicativeDo: Handle terminal `pure` statements

ApplicativeDo handled terminal `return` statements properly, but not

Test Plan: Validate with included testcase

Reviewers: austin, simonmar

Reviewed By: austin, simonmar

Subscribers: simonpj, thomie

Differential Revision:

GHC Trac Issues: #11607

3 years agobase: A selection of fixes to the comments in GHC.Stats
David Turner [Thu, 25 Feb 2016 13:46:28 +0000 (14:46 +0100)] 
base: A selection of fixes to the comments in GHC.Stats

Use `-- |` comments throughout.
Note that numByteUsageSamples is also the number of major GCs
Note that numGcs counts GCs for all generations
Note that 'current' really means 'at the end of the last major GC'

Reviewers: ezyang, hvr, simonmar, austin, bgamari

Reviewed By: ezyang, simonmar, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11603

3 years agotestsuite: mark tests broken on powerpc64
Peter Trommler [Thu, 25 Feb 2016 13:46:13 +0000 (14:46 +0100)] 
testsuite: mark tests broken on powerpc64

The following tests fail on powerpc64 and have a ticket.
Mark those tests as expect_broken.

Here are the details:
The PowerPC native code generator does not support DWARF debug
information. This is tracked in ticket #11261. Mark the respective
tests broken on powerpc64.

testsuite: mark print022 broken on powerpc64
Ticket #11262 tracks difference in stdout for print022.

testsuite: mark recomp015 broken on powerpc64
testsuite: mark recomp011 broken on powerpc64
This is tracked as ticket #11323 and #11260.

testsuite: mark linker tests broken on powerpc64
Ticket #11259 tracks tests failing because there is no RTS
linker on powerpc64.

Test Plan: validate

Reviewers: erikd, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11259, #11260, #11261, #11262, #11323

3 years agoOverload the static form to reduce verbosity.
Facundo Domínguez [Thu, 25 Feb 2016 13:33:43 +0000 (14:33 +0100)] 
Overload the static form to reduce verbosity.

Static pointers are rarely used naked: most often they are defined at
the base of a Closure, as defined in e.g. the distributed-closure and
distributed-static packages. So a typical usage pattern is:

    distributeMap (closure (static (\x -> x * 2)))

which is more verbose than it needs to be. Ideally we'd just have to

    distributeMap (static (\x -> x * 2))

and let the static pointer be lifted to a Closure implicitly. i.e.
what we want is to overload static literals, just like we already
overload list literals and string literals.

This is achieved by introducing the IsStatic type class and changing
the typing rule for static forms slightly:

    static (e :: t) :: IsStatic p => p t

Test Plan: ./validate

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: simonpj, mboes, thomie

Differential Revision:

GHC Trac Issues: #11585

3 years agoTyCoRep: Add haddock sections
Ben Gamari [Wed, 24 Feb 2016 10:20:26 +0000 (11:20 +0100)] 
TyCoRep: Add haddock sections

3 years agoRemove "use mask" from StgAlt syntax
Ömer Sinan Ağacan [Wed, 24 Feb 2016 21:22:36 +0000 (16:22 -0500)] 
Remove "use mask" from StgAlt syntax

Reviewers: austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

3 years agoAddress #11471 by putting RuntimeRep in kinds.
Richard Eisenberg [Thu, 4 Feb 2016 15:42:56 +0000 (10:42 -0500)] 
Address #11471 by putting RuntimeRep in kinds.

See Note [TYPE] in TysPrim. There are still some outstanding
pieces in #11471 though, so this doesn't actually nail the bug.

This commit also contains a few performance improvements:

* Short-cut equality checking of nullary type syns

* Compare types before kinds in eqType

* INLINE coreViewOneStarKind

* Store tycon binders separately from kinds.

This resulted in a ~10% performance improvement in compiling
the Cabal package. No change in functionality other than
performance. (This affects the interface file format, though.)

This commit updates the haddock submodule.

3 years agoFollow-up to 32a9a7f514bdd33ff72a673ade
Herbert Valerio Riedel [Tue, 23 Feb 2016 22:55:23 +0000 (23:55 +0100)] 
Follow-up to 32a9a7f514bdd33ff72a673ade

...forgot to stage/add this alpha renaming to the previous commit

3 years agoExtend `-Wunrecognised-warning-flag` to cover `-f(no-)warn-*`
Herbert Valerio Riedel [Tue, 23 Feb 2016 22:13:33 +0000 (23:13 +0100)] 
Extend `-Wunrecognised-warning-flag` to cover `-f(no-)warn-*`

The original implementation for #11429 covers only `-W*` flags. However,
old packages will continue to use `-f(no-)warn-*` flags, so it seems
desirable to have `-Wunrecognised-warning-flag` apply to those legacy aliases
as well.

Reviewed By: bgamari

Differential Revision:

3 years agoTestsuite: MAKEFLAGS is magic, do not unexport it
Thomas Miedema [Tue, 23 Feb 2016 18:27:43 +0000 (19:27 +0100)] 
Testsuite: MAKEFLAGS is magic, do not unexport it

Call `+$(PYTHON) ...` to fix #11569 instead.

See Note [Communicating options and variables to a submake].

3 years agoAllow combining characters in identifiers (#7650)
Thomas Miedema [Sat, 20 Feb 2016 22:50:28 +0000 (23:50 +0100)] 
Allow combining characters in identifiers (#7650)

Reviewed by: austin, rwbarton

Differential Revision:

3 years agoTestsuite: failing profiling tests (#10037)
Thomas Miedema [Mon, 22 Feb 2016 16:57:43 +0000 (17:57 +0100)] 
Testsuite: failing profiling tests (#10037)

These tests fail not only for WAY=prof, but also for WAY=profllvm.

3 years agoFilter out -prof callstacks from test output (#11521)
Thomas Miedema [Mon, 22 Feb 2016 16:44:17 +0000 (17:44 +0100)] 
Filter out -prof callstacks from test output (#11521)

3 years agoTestsuite: cleanup profiling/should_run/all.T (#11521)
Thomas Miedema [Sun, 21 Feb 2016 12:40:56 +0000 (13:40 +0100)] 
Testsuite: cleanup profiling/should_run/all.T (#11521)

Refactoring only. I compared before and after with 'make slow', and it
still runs each test with the same 'ways' as before.

3 years agoTestsuite: delete Windows line endings [skip ci] (#11631)
Thomas Miedema [Mon, 22 Feb 2016 20:32:51 +0000 (21:32 +0100)] 
Testsuite: delete Windows line endings [skip ci] (#11631)

3 years agoTestsuite: delete Windows line endings [skip ci] (#11631)
Thomas Miedema [Mon, 22 Feb 2016 20:32:51 +0000 (21:32 +0100)] 
Testsuite: delete Windows line endings [skip ci] (#11631)

3 years agoTestsuite: accept output without Windows line endings (#11631)
Thomas Miedema [Tue, 23 Feb 2016 01:25:17 +0000 (02:25 +0100)] 
Testsuite: accept output without Windows line endings (#11631)

3 years agoTestsuite: accept output without Windows line endings (#11631)
Thomas Miedema [Tue, 23 Feb 2016 01:57:53 +0000 (02:57 +0100)] 
Testsuite: accept output without Windows line endings (#11631)

3 years agoTestsuite: delete Windows line endings [skip ci] (#11631)
Thomas Miedema [Mon, 22 Feb 2016 20:32:51 +0000 (21:32 +0100)] 
Testsuite: delete Windows line endings [skip ci] (#11631)

3 years agoTestsuite: delete Windows line endings [skip ci] (#11631)
Thomas Miedema [Mon, 22 Feb 2016 20:32:51 +0000 (21:32 +0100)] 
Testsuite: delete Windows line endings [skip ci] (#11631)

3 years agoTestsuite: delete Windows line endings [skip ci] (#11631)
Thomas Miedema [Mon, 22 Feb 2016 20:32:51 +0000 (21:32 +0100)] 
Testsuite: delete Windows line endings [skip ci] (#11631)

3 years agoTestsuite: delete Windows line endings [skip ci] (#11631)
Thomas Miedema [Mon, 22 Feb 2016 20:31:35 +0000 (21:31 +0100)] 
Testsuite: delete Windows line endings [skip ci] (#11631)

3 years agoTestsuite: delete Windows line endings [skip ci] (#11631)
Thomas Miedema [Mon, 22 Feb 2016 20:31:24 +0000 (21:31 +0100)] 
Testsuite: delete Windows line endings [skip ci] (#11631)

3 years agoAdd missing files
Simon Marlow [Tue, 23 Feb 2016 09:05:37 +0000 (09:05 +0000)] 
Add missing files

3 years agoDocs: -keep-llvm-file(s)/-ddump-llvm imply -fllvm
Thomas Miedema [Mon, 22 Feb 2016 13:31:40 +0000 (14:31 +0100)] 
Docs: -keep-llvm-file(s)/-ddump-llvm imply -fllvm

This fixes #9917.

3 years agoFix GHC.Stats documentation markup (#11619)
Thomas Miedema [Sun, 21 Feb 2016 17:31:00 +0000 (18:31 +0100)] 
Fix GHC.Stats documentation markup (#11619)

3 years agoBuild system: fix sed expression (#11537)
Thomas Miedema [Sun, 21 Feb 2016 11:23:25 +0000 (12:23 +0100)] 
Build system: fix sed expression (#11537)

This allows building ghc in '/ghc'.

3 years agoTestsuite: pass '-s --no-print-directory' to MAKE
Thomas Miedema [Sun, 21 Feb 2016 00:50:22 +0000 (01:50 +0100)] 
Testsuite: pass '-s --no-print-directory' to MAKE

This seems necessary after 9634e24 (#11569).