4 years agoComments only
Simon Peyton Jones [Thu, 23 Jul 2015 11:49:06 +0000 (12:49 +0100)] 
Comments only

4 years agoFix line number in T10018 testcase
Ben Gamari [Fri, 24 Jul 2015 07:25:27 +0000 (03:25 -0400)] 
Fix line number in T10018 testcase

4 years agoLibrary names, with Cabal submodule update
Edward Z. Yang [Tue, 23 Jun 2015 20:15:17 +0000 (13:15 -0700)] 
Library names, with Cabal submodule update

A library name is a package name, package version, and hash of the
version names of all textual dependencies (i.e. packages which were included.) A library
name is a coarse approximation of installed package IDs, which are suitable for
inclusion in package keys (you don't want to put an IPID in a package key, since
it means the key will change any time the source changes.)

    - We define ShPackageKey, which is the semantic object which
      is hashed into a PackageKey.  You can use 'newPackageKey'
      to hash a ShPackageKey to a PackageKey

    - Given a PackageKey, we can lookup its ShPackageKey with
      'lookupPackageKey'.  The way we can do this is by consulting
      the 'pkgKeyCache', which records a reverse mapping from
      every hash to the ShPackageKey.  This means that if you
      load in PackageKeys from external sources (e.g. interface
      files), you also need to load in a mapping of PackageKeys
      to their ShPackageKeys so we can populate the cache.

    - We define a 'LibraryName' which encapsulates the full
      depenency resolution that Cabal may have selected; this
      is opaque to GHC but can be used to distinguish different
      versions of a package.

    - Definite packages don't have an interesting PackageKey,
      so we rely on Cabal to pass them to us.

    - We can pretty-print package keys while displaying the
      instantiation, but it's not wired up to anything (e.g.
      the Outputable instance of PackageKey).

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

Reviewers: austin, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10566

4 years agoAdd a few comments from SPJ on fixity declarations
Ben Gamari [Tue, 21 Jul 2015 20:27:18 +0000 (22:27 +0200)] 
Add a few comments from SPJ on fixity declarations

4 years agoghci: fixity declarations for infix data constructors (#10018)
Thomas Miedema [Tue, 21 Jul 2015 20:01:49 +0000 (22:01 +0200)] 
ghci: fixity declarations for infix data constructors (#10018)

Declaring a custom fixity for an infix data constructor should work:

    Prelude> data Infix a b = a :@: b; infixl 4 :@:

This is a followup to #2947, which handled fixity declarations in ghci
statements (e.g. let add = (+); infixl 6 `add`).

Support for declarations (data, type, newtype, class, instance,
deriving, and foreign) was added to GHCi in #4929.

Reviewers: simonpj, austin, thomie

Subscribers: thomie, bgamari

Differential Revision:

GHC Trac Issues: #10018

4 years agoDocument type functions in the Paterson conditions
Simon Peyton Jones [Thu, 23 Jul 2015 11:24:14 +0000 (12:24 +0100)] 
Document type functions in the Paterson conditions

4 years agoSlight refactoring to the fix for #4012
Simon Peyton Jones [Thu, 23 Jul 2015 11:23:22 +0000 (12:23 +0100)] 
Slight refactoring to the fix for #4012

Add CoreSyn.chooseOrphanAnchor, and use it

4 years agorts/sm: Add missing argument names in function definitions
Ben Gamari [Thu, 23 Jul 2015 12:49:13 +0000 (08:49 -0400)] 
rts/sm: Add missing argument names in function definitions

C99 does not allow unnamed parameters in definition argument lists [1].


4 years agoDataCon: Fix redundant import
Ben Gamari [Thu, 23 Jul 2015 10:53:49 +0000 (12:53 +0200)] 
DataCon: Fix redundant import

4 years agoParenthesise TypeOperator in import hints
Thomas Winant [Thu, 23 Jul 2015 09:43:21 +0000 (11:43 +0200)] 
Parenthesise TypeOperator in import hints

When a constructor was mistakenly imported directly instead of as a
constructor of a data type, a hint will be shown on how to correctly
it. Just like the constructor, the data type should be surrounded in
parentheses if it is an operator (TypeOperator in this case).

Instead of:

        In module ‘Data.Type.Equality’:
          ‘Refl’ is a data constructor of ‘:~:’
        To import it use
          ‘import’ Data.Type.Equality( :~:( Refl ) )
          ‘import’ Data.Type.Equality( :~:(..) )


        In module ‘Data.Type.Equality’:
          ‘Refl’ is a data constructor of ‘(:~:)’
        To import it use
          ‘import’ Data.Type.Equality( (:~:)( Refl ) )
          ‘import’ Data.Type.Equality( (:~:)(..) )

Test Plan: pass new test

Reviewers: austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, thomie

Differential Revision:

GHC Trac Issues: #10668

4 years agoUpdate encoding001 to test the full range of non-surrogate code points
Reid Barton [Thu, 23 Jul 2015 09:43:07 +0000 (11:43 +0200)] 
Update encoding001 to test the full range of non-surrogate code points

GHC has used surrogate code points for roundtripping since 7.4.
See Note [Roundtripping].

Also, improve the wording of that Note slightly.

Test Plan: validate still passes

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

4 years agoAccept next-docstrings on GADT constructors.
Ben Gamari [Thu, 23 Jul 2015 09:42:07 +0000 (11:42 +0200)] 
Accept next-docstrings on GADT constructors.

Accept next docstrings (`-- | Docstring`) on GADT constructors.

I have confirmed that this adds no shift/reduce conflicts.

Test Plan: haddockA034

Reviewers: austin, simonpj, simonmar

Reviewed By: simonmar

Subscribers: Fuuzetsu, simonmar, thomie, mpickering, edsko

Differential Revision:

4 years agoGenerate .dyn_o files for .hsig files with -dynamic-too
Michael Smith [Thu, 23 Jul 2015 09:41:16 +0000 (11:41 +0200)] 
Generate .dyn_o files for .hsig files with -dynamic-too

With -dynamic-too, .dyn_o files were not being generated for .hsig
files.  Normally, this is handled in the pipeline; however, the branch
for .hsig files called compileEmptyStub directly instead of going
through runPipeline.  When compiling a Cabal package that included .hsig
files, this triggered a linker error later on, as it expected a .dyn_o
file to have been generated for each .hsig.

The fix is to use runPipeline for .hsig files, just as with .hs files.
Alternately, one could duplicate the logic for handling -dynamic-too in
the .hsig branch, but simply calling runPipeline ends up being much

Test Plan: validate

Reviewers: austin, ezyang, bgamari, thomie

Reviewed By: ezyang, thomie

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10660

4 years agoLexer: support consecutive references to Haddock chunks (#10398)
Thomas Miedema [Thu, 23 Jul 2015 09:40:37 +0000 (11:40 +0200)] 
Lexer: support consecutive references to Haddock chunks (#10398)

Reviewers: austin, bgamari, Fuuzetsu

Reviewed By: bgamari

Subscribers: thomie, bgamari

Differential Revision:

GHC Trac Issues: #10398

4 years agoComments only
Simon Peyton Jones [Thu, 23 Jul 2015 07:34:10 +0000 (08:34 +0100)] 
Comments only

4 years agoFix Trac #10670
Simon Peyton Jones [Thu, 23 Jul 2015 07:33:43 +0000 (08:33 +0100)] 
Fix Trac #10670

In dataConCannotMatch we were using a GADT data con without
properly instantiating the existential type variables.
The fix is easy, and the code is tighter.

4 years agoUse lookupIfaceTop for loading IfaceDecls.
Edward Z. Yang [Wed, 22 Jul 2015 00:16:52 +0000 (17:16 -0700)] 
Use lookupIfaceTop for loading IfaceDecls.

It's shorter!  And then when Backpack overrides lookupIfaceTop
everyone will see the right information.

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

Reviewers: simonpj, austin, bgamari

Subscribers: thomie

Differential Revision:

4 years agoSome utility functions for testing IfaceType equality.
Edward Z. Yang [Wed, 22 Jul 2015 00:04:38 +0000 (17:04 -0700)] 
Some utility functions for testing IfaceType equality.

These are going to be used by Backpack, but someone else
might find them useful.  They do the "obvious thing".

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

Reviewers: goldfire, bgamari, austin

Subscribers: thomie

Differential Revision:

4 years agoExport alwaysQualifyPackages and neverQualifyPackages.
Edward Z. Yang [Wed, 22 Jul 2015 00:09:38 +0000 (17:09 -0700)] 
Export alwaysQualifyPackages and neverQualifyPackages.

Signed-off-by: Edward Z. Yang <>
4 years agoGive more informative panic for checkFamInstConsistency.
Edward Z. Yang [Wed, 22 Jul 2015 00:06:39 +0000 (17:06 -0700)] 
Give more informative panic for checkFamInstConsistency.

Signed-off-by: Edward Z. Yang <>
4 years agoAdd ExceptionMonad instance for IOEnv.
Edward Z. Yang [Wed, 22 Jul 2015 00:05:16 +0000 (17:05 -0700)] 
Add ExceptionMonad instance for IOEnv.

Signed-off-by: Edward Z. Yang <>
4 years agoSwitch from recording IsBootInterface to recording full HscSource.
Edward Z. Yang [Tue, 21 Jul 2015 23:51:51 +0000 (16:51 -0700)] 
Switch from recording IsBootInterface to recording full HscSource.

Note: ModIface format change is BC, no need to recompile.

Signed-off-by: Edward Z. Yang <>
4 years agoTravis: do pass `--quiet` to validate
Thomas Miedema [Tue, 21 Jul 2015 23:54:40 +0000 (01:54 +0200)] 
Travis: do pass `--quiet` to validate

It's failing at the moment with "The log length has exceeded the limit
of 4 Megabytes".

We don't seem to have periods of >10 minutes without output after all,
which was the initial reason of not using `--quiet`.

4 years agoValidate: explain THREADS instead of CPUS in --help
Thomas Miedema [Tue, 21 Jul 2015 23:34:17 +0000 (01:34 +0200)] 
Validate: explain THREADS instead of CPUS in --help

4 years agoTwo step allocator for 64-bit systems
Giovanni Campagna [Fri, 17 Jul 2015 10:55:49 +0000 (11:55 +0100)] 
Two step allocator for 64-bit systems

The current OS memory allocator conflates the concepts of allocating
address space and allocating memory, which makes the HEAP_ALLOCED()
implementation excessively complicated (as the only thing it cares
about is address space layout) and slow. Instead, what we want
is to allocate a single insanely large contiguous block of address
space (to make HEAP_ALLOCED() checks fast), and then commit subportions
of that in 1MB blocks as we did before.
This is currently behind a flag, USE_LARGE_ADDRESS_SPACE, that is only enabled for
certain OSes.

Test Plan: validate

Reviewers: simonmar, ezyang, austin

Subscribers: thomie, carter

Differential Revision:

GHC Trac Issues: #9706

4 years agoEliminate zero_static_objects_list()
Simon Marlow [Thu, 16 Jul 2015 14:01:49 +0000 (15:01 +0100)] 
Eliminate zero_static_objects_list()

In a workload with a large amount of code, zero_static_objects_list()
takes a significant amount of time, and furthermore it is in the
single-threaded part of the GC.

This patch uses a slightly fiddly scheme for marking objects on the
static object lists, using a flag in the low 2 bits that flips between
two states to indicate whether an object has been visited during this
GC or not.  We also have to take into account objects that have not
been visited yet, which might appear at any time due to runtime linking.

Test Plan: validate

Reviewers: austin, bgamari, ezyang, rwbarton

Subscribers: thomie

Differential Revision:

4 years agoTestsuite: recenter haddock.base allocation numbers
Thomas Miedema [Wed, 22 Jul 2015 16:21:44 +0000 (18:21 +0200)] 
Testsuite: recenter haddock.base allocation numbers

4 years agoRevert "Trac #4945 is working again"
Thomas Miedema [Wed, 22 Jul 2015 16:10:42 +0000 (18:10 +0200)] 
Revert "Trac #4945 is working again"

This reverts commit 5d98b6828f65ce6eea45e93880928b7031955d38.

4 years agoAdd utility function isHoleName.
Edward Z. Yang [Tue, 21 Jul 2015 23:15:32 +0000 (16:15 -0700)] 
Add utility function isHoleName.

Signed-off-by: Edward Z. Yang <>
4 years agoValidate: document --quiet [skip ci]
Thomas Miedema [Tue, 21 Jul 2015 22:00:01 +0000 (00:00 +0200)] 
Validate: document --quiet [skip ci]

4 years agoValidate: by default do show commands
Thomas Miedema [Tue, 21 Jul 2015 20:45:07 +0000 (22:45 +0200)] 
Validate: by default do show commands

Show commands being run by default, so you can copy/paste and rerun them
on build failures/warnings.

See Note [Default build system verbosity].

4 years agoTravis: use ghc-7.8.4 as stage0 to fix the build
Thomas Miedema [Tue, 21 Jul 2015 12:05:32 +0000 (14:05 +0200)] 
Travis: use ghc-7.8.4 as stage0 to fix the build

4 years agoWhen iconv is unavailable, use an ASCII encoding to encode ASCII
Reid Barton [Tue, 21 Jul 2015 17:13:20 +0000 (19:13 +0200)] 
When iconv is unavailable, use an ASCII encoding to encode ASCII

D898 and D1059 implemented a fallback behavior to handle the case
that the end user's iconv installation is broken (typically due to
running inside a chroot in which the necessary locale files and/or
gconv modules have not been installed). In this case, if the
program requests an ASCII locale, GHC's char8 encoding is used
rather than the program failing.

However, silently mangling data like char8 does when the programmer
did not ask for it is poor behavior, for reasons described in D1059.

This commit implements an ASCII encoding and uses it in the fallback
case when iconv is unavailable and the user has requested ASCII.

Test Plan:
Added tests for the encodings defined in Latin1.
Also, manually ran a statically-linked executable of that test
in a chroot and the tests passed (up to the ones that call
mkTextEncoding "LATIN1", since there is no fallback from iconv
for that case yet).

Reviewers: austin, hvr, hsyl20, bgamari

Reviewed By: hsyl20, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #7695, #10623

4 years agoconfigure: Bump minimum bootstrap GHC version to 7.8
Ben Gamari [Tue, 21 Jul 2015 16:23:01 +0000 (18:23 +0200)] 
configure: Bump minimum bootstrap GHC version to 7.8

4 years agotestsuite: Show killed command line on timeout
Ben Gamari [Tue, 21 Jul 2015 15:37:03 +0000 (17:37 +0200)] 
testsuite: Show killed command line on timeout

4 years agoT4945 is working again
Simon Peyton Jones [Tue, 21 Jul 2015 16:39:49 +0000 (17:39 +0100)] 
T4945 is working again

This test keeps flipping between ok and not-ok.  In some ways
this isn't surprising, since it greps in the output of
-ddump-simpl, but I wish I knew exactly why.  Anyway,
it's currently working again.

4 years agoMake seq-of-cast rule generate a case
Simon Peyton Jones [Tue, 21 Jul 2015 14:05:42 +0000 (15:05 +0100)] 
Make seq-of-cast rule generate a case

Previously it generated another call to seq, which triggered
a lint failure (Trac #10659)

4 years agoDo occurrence analysis on result of BuiltInRule
Simon Peyton Jones [Tue, 21 Jul 2015 13:41:08 +0000 (14:41 +0100)] 
Do occurrence analysis on result of BuiltInRule

Previously we did occurrence analysis on the result of a
non-built-in RULE, but not of a built-in one.  It makes a
difference if the rule returns something with binders
(which admittedly it usually does not).  I'm about to
introduce just such a rule for 'seq'.

4 years agoFix test T2497 to avoid infinite loop in RULES
Simon Peyton Jones [Tue, 21 Jul 2015 13:39:17 +0000 (14:39 +0100)] 
Fix test T2497 to avoid infinite loop in RULES

4 years agoComments only
Simon Peyton Jones [Tue, 21 Jul 2015 13:34:31 +0000 (14:34 +0100)] 
Comments only

4 years agoAvoid out-of-scope top-level Ids
Simon Peyton Jones [Tue, 21 Jul 2015 13:34:05 +0000 (14:34 +0100)] 
Avoid out-of-scope top-level Ids

Pass the top-level SpecEnv to specImports/specImport, so
that top-level Ids are in scope.  Otherwise we get annoying
(but correct) WARNINGS.

4 years agoComments and white space only
Simon Peyton Jones [Thu, 9 Jul 2015 12:23:08 +0000 (13:23 +0100)] 
Comments and white space only

4 years agoImplement -dsuppress-unfoldings
Simon Peyton Jones [Thu, 9 Jul 2015 12:22:24 +0000 (13:22 +0100)] 
Implement -dsuppress-unfoldings

This extra "suppress" flag helps when there are a lot of Ids
with big unfoldings that clutter up the dump

Also slightly refactor printing of coercions in Core

4 years agoComments and layout only
Simon Peyton Jones [Thu, 9 Jul 2015 12:19:53 +0000 (13:19 +0100)] 
Comments and layout only

This patch adds a lot of visual structure to this key module

4 years agoDocuments -dsuppress-unfoldings
Simon Peyton Jones [Thu, 9 Jul 2015 12:19:03 +0000 (13:19 +0100)] 
Documents -dsuppress-unfoldings

4 years agoAdd NOINLINE for hs-boot functions
Simon Peyton Jones [Mon, 20 Jul 2015 15:18:05 +0000 (16:18 +0100)] 
Add NOINLINE for hs-boot functions

This fixes Trac #10083.

The key change is in TcBinds.tcValBinds, where we construct
the prag_fn.  With this patch we add a NOINLINE pragma for
any functions that were exported by the hs-boot file for this

See Note [Inlining and hs-boot files], and #10083, for details.

The commit touches several other files becuase I also changed the
representation of the "pragma function" from a function TcPragFun
to an environment, TcPragEnv. This makes it easer to extend
during construction.

4 years agoRefactor self-boot info
Simon Peyton Jones [Mon, 20 Jul 2015 14:38:12 +0000 (15:38 +0100)] 
Refactor self-boot info

This patch is a simple refactoring that prepares for a later one,
related to Trac #10083.

* Add a field tcg_self_boot :: SelfBootInfo to TcGblEnv,
  where SelfBootInfo is a new data type, describing the
  hi-boot file, if any, for the module being compiled.

* Make tcHiBootIface return SelfBootInfo, a new data type

* Make other functions get SelfBootInfo from the monad.

* Remove tcg_mod_name from TcGblEnv; it was barely used and
  simpler to pass around explicitly.

4 years agoComments and white space only
Simon Peyton Jones [Mon, 20 Jul 2015 13:40:20 +0000 (14:40 +0100)] 
Comments and white space only

4 years agoImprove strictness analysis for exceptions
Simon Peyton Jones [Tue, 21 Jul 2015 11:28:42 +0000 (12:28 +0100)] 
Improve strictness analysis for exceptions

Two things here:

* For exceptions-catching primops like catch#, we know
  that the main argument function will be called, so
  we can use strictApply1Dmd, rather than lazy

  Changes in primops.txt.pp

* When a 'case' scrutinises a I/O-performing primop,
  the Note [IO hack in the demand analyser] was
  throwing away all strictness from the code that

  I found that this was causing quite a bit of unnecessary
  reboxing in the (heavily used) function

  So this patch prevents the hack applying when the
  case scrutinises a primop.  See the revised
  Note [IO hack in the demand analyser]

Thse two things buy us quite a lot in programs that do a lot of IO.

        Program           Size    Allocs   Runtime   Elapsed  TotalMem
            hpg          -0.4%     -2.9%     -0.9%     -1.0%     +0.0%
reverse-complem          -0.4%    -10.9%    +10.7%    +10.9%     +0.0%
         simple          -0.3%     -0.0%    +26.2%    +26.2%     +3.7%
         sphere          -0.3%     -6.3%      0.09      0.09     +0.0%
            Min          -0.7%    -10.9%     -4.6%     -4.7%     -1.7%
            Max          -0.2%     +0.0%    +26.2%    +26.2%     +6.5%
 Geometric Mean          -0.4%     -0.3%     +2.1%     +2.1%     +0.1%

I think the increase in runtime for 'simple' is measurement error.

4 years agoRefactor newSCWorkFromFlavoured
Simon Peyton Jones [Mon, 20 Jul 2015 22:39:44 +0000 (23:39 +0100)] 
Refactor newSCWorkFromFlavoured

No change in behaviour is intended here

4 years agoComments only (superclasses and improvement)
Simon Peyton Jones [Mon, 20 Jul 2015 22:37:42 +0000 (23:37 +0100)] 
Comments only (superclasses and improvement)

4 years agoUse varToCoreExpr in mkWWcpr_help
Simon Peyton Jones [Mon, 20 Jul 2015 22:34:31 +0000 (23:34 +0100)] 
Use varToCoreExpr in mkWWcpr_help

Lacking this cuased Trac #10658.
The fix is easy; it was a simple omission.

4 years agoDelete __GLASGOW_HASKELL__ ifdefs for stage0 < 7.8
Thomas Miedema [Tue, 21 Jul 2015 11:02:29 +0000 (13:02 +0200)] 
Delete __GLASGOW_HASKELL__ ifdefs for stage0 < 7.8

Reviewers: austin, goldfire, bgamari

Reviewed By: bgamari

Subscribers: bgamari, thomie

Differential Revision:

4 years agoprimops: Fix spelling mistake
Ben Gamari [Tue, 21 Jul 2015 10:27:28 +0000 (12:27 +0200)] 
primops: Fix spelling mistake

4 years agoRevert "Revert "Support for multiple signature files in scope.""
Edward Z. Yang [Tue, 21 Jul 2015 03:16:40 +0000 (20:16 -0700)] 
Revert "Revert "Support for multiple signature files in scope.""

This reverts commit bac927b9770ff769128b66d13a3e72bf5a9bc514.

As it turns out, we need these commits for separate compilation
and accurate dependency tracking.  So back in they go!

4 years agoRevert "Revert "Change loadSrcInterface to return a list of ModIface""
Edward Z. Yang [Tue, 21 Jul 2015 03:16:35 +0000 (20:16 -0700)] 
Revert "Revert "Change loadSrcInterface to return a list of ModIface""

This reverts commit c60704fc405149407c155e297433f1cc299ae58a.

4 years agoUpdate submodule hpc with fix for #10529
Thomas Miedema [Thu, 16 Jul 2015 15:40:50 +0000 (17:40 +0200)] 
Update submodule hpc with fix for #10529

4 years agoTestsuite: simplify T8089 (#8089)
Thomas Miedema [Thu, 16 Jul 2015 18:16:17 +0000 (20:16 +0200)] 
Testsuite: simplify T8089 (#8089)

The previous implementation wasn't working for the `ghci` test way,
causing a fulltest failure.

Differential Revision:

4 years agoTestsuite: mark concprog002 expect_broken_for(#10661, ['threaded2_hT'])
Thomas Miedema [Sun, 19 Jul 2015 19:43:55 +0000 (21:43 +0200)] 
Testsuite: mark concprog002 expect_broken_for(#10661, ['threaded2_hT'])

4 years agoTestsuite: fix concprog002 (AMP)
Thomas Miedema [Sun, 19 Jul 2015 17:44:56 +0000 (19:44 +0200)] 
Testsuite: fix concprog002 (AMP)

Requires random to be installed.

4 years agoFix primops documentation syntax
Ben Gamari [Mon, 20 Jul 2015 16:39:54 +0000 (12:39 -0400)] 
Fix primops documentation syntax

4 years agoDo not treat prim and javascript imports as C imports in TH and QQ
Luite Stegeman [Mon, 20 Jul 2015 15:01:06 +0000 (17:01 +0200)] 
Do not treat prim and javascript imports as C imports in TH and QQ

Reviewers: austin, hvr, goldfire, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10638

4 years agoprimops: Add haddocks to BCO primops
Ben Gamari [Mon, 20 Jul 2015 14:45:01 +0000 (16:45 +0200)] 
primops: Add haddocks to BCO primops

Test Plan: none

Reviewers: simonmar, austin, hvr

Subscribers: hvr, thomie

Differential Revision:

GHC Trac Issues: #10640

4 years agoSupport wild cards in TH splices
Thomas Winant [Mon, 20 Jul 2015 13:43:53 +0000 (15:43 +0200)] 
Support wild cards in TH splices

- Declaration splices: partial type signatures are fully supported in TH
  declaration splices.

  For example, the wild cards in the example below will unify with `Eq
  and `a -> a -> Bool`, as expected:

[d| foo :: _ => _
    foo x y = x == y |]

- Expression splices: anonymous and named wild cards are supported in
  expression signatures, but extra-constraints wild cards aren't. Just
  as is the case for regular expression signatures.

[e | Just True :: _a _ |]

- Typed expression splices: the same wildcards as in (untyped)
  expression splices are supported.

- Pattern splices: TH doesn't support type signatures in pattern
  splices, consequently, partial type signatures aren't supported

- Type splices: partial type signatures are only partially supported in
  type splices, specifically: only anonymous wild cards are allowed.

  So `[t| _ |]`, `[t| _ -> Maybe _ |]` will work, but `[t| _ => _ |]` or
  `[| _a |]` won't (without `-XNamedWildCards`, the latter will work as
  the named wild card is treated as a type variable).

  Normally, named wild cards are collected before renaming a (partial)
  type signature. However, TH type splices are run during renaming, i.e.
  after the initial traversal, leading to out of scope errors for named
  wild cards. We can't just extend the initial traversal to collect the
  named wild cards in TH type splices, as we'd need to expand them,
  which is supposed to happen only once, during renaming.

  Similarly, the extra-constraints wild card is handled right before
  renaming too, and is therefore also not supported in a TH type splice.
  Another reason not to support extra-constraints wild cards in TH type
  splices is that a single signature can contain many TH type splices,
  whereas it mustn't contain more than one extra-constraints wild card.
  Enforcing would this be hard the way things are currently organised.

  Anonymous wild cards pose no problem, because they start without names
  and are given names during renaming. These names are collected right
  after renaming. The names generated for anonymous wild cards in TH
  type splices will thus be collected as well.

  With a more invasive refactoring of the renaming, partial type
  signatures could be fully supported in TH type splices. As only
  anonymous wild cards have been requested so far, these small changes
  satisfying this request will do for now. Also don't forget that a TH
  declaration splices support all kinds of wild cards.

- Extra-constraints wild cards were silently ignored in expression and
  pattern signatures, appropriate error messages are now generated.

Test Plan: run new tests

Reviewers: austin, goldfire, adamgundry, bgamari

Reviewed By: goldfire, adamgundry, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10094, #10548

4 years agoLlvmCodeGen: add support for MO_U_Mul2 CallishMachOp
Michal Terepeta [Mon, 20 Jul 2015 13:43:31 +0000 (15:43 +0200)] 
LlvmCodeGen: add support for MO_U_Mul2 CallishMachOp

This adds support MO_U_Mul2 to the LLVM backend by simply using 'mul'
instruction but operating at twice the bit width (e.g., for 64 bit
words we will generate mul that operates on 128 bits and then extract
the two 64 bit values for the result of the CallishMachOp).

Test Plan: validate

Reviewers: rwbarton, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #9430

4 years agoTestsuite: add regression test for missing class constraint
Thomas Miedema [Mon, 20 Jul 2015 13:40:59 +0000 (15:40 +0200)] 
Testsuite: add regression test for missing class constraint

The following program is accepted by ghc-7.0 to ghc-7.10, but rejected
by ghc-6.12.3 and HEAD (and rightfully so):

    class Class1 a
    class Class1 a => Class2 a
    class Class2 a => Class3 a
    instance Class3 a => Class2 a

The last line is missing a `Class1 a` constraint. Add a regression test
for this (typechecker/should_fail/tcfail223).

Add similar missing class constraints to T7126 and T5751. I verified
that the these changes don't interfer with the intention of the tests
(they still result in a loop with ghc-7.4.1).

Reviewers: austin, simonpj, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

Differential Revision:

4 years agoTestsuite: add -XUndecidableInstances to T3500a
Thomas Miedema [Mon, 20 Jul 2015 13:40:26 +0000 (15:40 +0200)] 
Testsuite: add -XUndecidableInstances to T3500a

This makes the test pass again with HEAD (7.11), instead of resulting

  T3500a.hs:11:10: error:
      The constraint ‘C (F a)’ is no smaller than the instance head
      (Use UndecidableInstances to permit this)
      In the instance declaration for ‘C (a, b)’

Test Plan: I verified that ghc-6.12.3's typechecker still loops on this

Reviewers: austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

4 years agoTestsuite: add ImpredicativeTypes to T7861 (#7861)
Thomas Miedema [Mon, 20 Jul 2015 13:39:52 +0000 (15:39 +0200)] 
Testsuite: add ImpredicativeTypes to T7861 (#7861)

The test was failing with:

    T7861: T7861.hs:15:13:
        Cannot instantiate unification variable ‘t0’
        with a type involving foralls: A a0 -> a0
          GHC doesn't yet support impredicative polymorphism
        In the first argument of ‘seq’, namely ‘f’
        In a stmt of a 'do' block: f `seq` print "Hello 2"

It requires ImpredicativeTypes, at least since 7.8, because we
instantiate seq's type (c->d->d) with f's type (c:= (forall b. a) -> a),
which is polymorphic (it has foralls).

I simplified the test a bit by removing the type synonym, and verified
that ghc-7.6.3 still panics on this test.

Reviewers: simonpj, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #7861

4 years agoAdd regression test for unused implicit parameter warning (#10632)
Reid Barton [Mon, 20 Jul 2015 02:36:08 +0000 (22:36 -0400)] 
Add regression test for unused implicit parameter warning (#10632)

4 years agoTestsuite: mark array001 and conc034 expect_broken_for(#10659, ['optasm',...])
Thomas Miedema [Sat, 18 Jul 2015 20:19:01 +0000 (22:19 +0200)] 
Testsuite: mark array001 and conc034 expect_broken_for(#10659, ['optasm',...])

Update submodule array.

4 years agoTestsuite: mark gadt/termination expect_broken_for(#10658, ['optasm','optllvm'])
Thomas Miedema [Sat, 18 Jul 2015 19:28:10 +0000 (21:28 +0200)] 
Testsuite: mark gadt/termination expect_broken_for(#10658, ['optasm','optllvm'])

4 years agoTestsuite: mark qq007 and qq008 expect_broken(#10047)
Thomas Miedema [Sat, 18 Jul 2015 18:55:24 +0000 (20:55 +0200)] 
Testsuite: mark qq007 and qq008 expect_broken(#10047)

This fixes the wrong ticket number in
16a87397295fa92bcbe7a2c6277f938622b93969 (#10181).

4 years agoTestsuite: mark qq007 and qq008 expect_broken(#10181)
Thomas Miedema [Sat, 18 Jul 2015 18:45:14 +0000 (20:45 +0200)] 
Testsuite: mark qq007 and qq008 expect_broken(#10181)

4 years agoTestsuite: mark 3 tests expect_broken_for(#10181, ['optasm', 'optllvm'])
Thomas Miedema [Sat, 18 Jul 2015 18:38:57 +0000 (20:38 +0200)] 
Testsuite: mark 3 tests expect_broken_for(#10181, ['optasm', 'optllvm'])

4 years agoTestsuite: mark T7919 expect_broken_for(#7919, ['optasm','dyn','optllvm'])
Thomas Miedema [Sat, 18 Jul 2015 17:25:37 +0000 (19:25 +0200)] 
Testsuite: mark T7919 expect_broken_for(#7919, ['optasm','dyn','optllvm'])

It fails with a segmentation fault. Occasionally also for WAY=threaded2.

4 years agoTestsuite: mark T2497 expect_broken_for(#10657, ['optasm', 'optllvm'])
Thomas Miedema [Sat, 18 Jul 2015 17:01:13 +0000 (19:01 +0200)] 
Testsuite: mark T2497 expect_broken_for(#10657, ['optasm', 'optllvm'])

4 years agoBuild system: fail when encountering an unknown package tag
Thomas Miedema [Wed, 15 Jul 2015 09:05:57 +0000 (11:05 +0200)] 
Build system: fail when encountering an unknown package tag

4 years agoTestsuite: accept new stderr for T9497{a,b,c}-run (#10224)
Thomas Miedema [Thu, 16 Jul 2015 08:42:22 +0000 (10:42 +0200)] 
Testsuite: accept new stderr for T9497{a,b,c}-run (#10224)

4 years agoTestsuite: small test cleanups
Thomas Miedema [Thu, 16 Jul 2015 15:41:56 +0000 (17:41 +0200)] 
Testsuite: small test cleanups

* don't print anything to stdout
* add missing Makefile
* also ignore mk/ghcconfig*.mk when using installed compiler
* prevent warning: -rtsopts and -with-rtsopts have no effect with -shared

4 years agoTravis: actually do debug builds
Thomas Miedema [Fri, 17 Jul 2015 09:34:46 +0000 (11:34 +0200)] 
Travis: actually do debug builds

4 years agoUpdate assert to fix retc001 and retc002 (#9243)
Thomas Miedema [Fri, 17 Jul 2015 09:42:24 +0000 (11:42 +0200)] 
Update assert to fix retc001 and retc002 (#9243)

Since 2223e196b2dc5340d70e58be011c279d381b4319, maybe_old_linkable can
be Nothing even with an up-to-date interface file. This happens when
compiling with --make -fno-code -fwrite-interface.

See also Note [Recompilation checking when typechecking only] in

This fixes retc001 and retc002 when ghc_debugged.

Differential Revision:

4 years agoReduce non-determinism in ABI hashes with RULES and instance decls
Bartosz Nitka [Fri, 17 Jul 2015 15:50:52 +0000 (16:50 +0100)] 
Reduce non-determinism in ABI hashes with RULES and instance decls

Before this change the `RULES` would be attached to one for the names from
the module that appear on the left hand side. The choice depended on the
`uniq` that was generated, which are known to be non-deterministic (a
separate, bigger problem). Now we use `OccName`s which should be stable.

Analogously for instance declarations, but they are attached to one of
the types involved.

Test Plan:
it made `Data.Text.Internal.Fusion.Common` interface stable, previously
stream fusion rule would be attached either to `streamList` or
`unstreamList` depending on if the module was compiled after `cabal
clean` or after `find | grep '\.o$' | xargs rm`.

Reviewers: simonpj, austin, bgamari, simonmar

Subscribers: puffnfresh, thomie

Differential Revision:

GHC Trac Issues: #4012

4 years agoFix off-by-one error in GHCi line reporting (Trac #10578)
Ömer Sinan Ağacan [Thu, 16 Jul 2015 22:06:28 +0000 (00:06 +0200)] 
Fix off-by-one error in GHCi line reporting (Trac #10578)

Test Plan: I couldn't add tests because apparently line number
reporting was already working correctly when loading script files. I
don't know how to test by running commands using stdin, is this

Reviewers: austin, thomie, bgamari

Reviewed By: thomie, bgamari

Subscribers: hvr, thomie

Differential Revision:

4 years agoHandle Char#, Addr# in TH quasiquoter (fixes #10620)
RyanGlScott [Thu, 16 Jul 2015 22:05:14 +0000 (00:05 +0200)] 
Handle Char#, Addr# in TH quasiquoter (fixes #10620)

DsMeta does not attempt to handle quasiquoted Char# or Addr# values,
which causes expressions like `$([| 'a'# |])` or `$([| "abc"# |])` to
with an `Exotic literal not (yet) handled by Template Haskell` error.

To fix this, the API of `template-haskell` had to be changed so that
now has an extra constructor `CharPrimL` (a `StringPrimL` constructor
existed, but it wasn't used). In addition, `DsMeta` has to manipulate
`CoreExpr`s directly that involve `Word8`s. In order to do this,
`Word8` had
to be added as a wired-in type to `TysWiredIn`.

Actually converting from `HsCharPrim` and `HsStringPrim` to `CharPrimL`
`StringPrimL`, respectively, is pretty straightforward after that, since
both `HsCharPrim` and `CharPrimL` use `Char` internally, and
uses a `ByteString` internally, which can easily be converted to
which is what `StringPrimL` uses.

Reviewers: goldfire, austin, simonpj, bgamari

Reviewed By: simonpj, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10620

4 years agoDeriveFoldable for data types with existential constraints (#10447)
RyanGlScott [Thu, 16 Jul 2015 22:04:24 +0000 (00:04 +0200)] 
DeriveFoldable for data types with existential constraints (#10447)

Reviewers: dolio, shachaf, ekmett, austin, #core_libraries_committee,
simonpj, bgamari

Reviewed By: simonpj, bgamari

Subscribers: thomie, bgamari

Differential Revision:

GHC Trac Issues: #10447

4 years agoPut Opt_Static into defaultFlags if not pc_DYNAMIC_BY_DEFAULT (#7478)
Bernhard Herzog [Thu, 16 Jul 2015 22:04:05 +0000 (00:04 +0200)] 
Put Opt_Static into defaultFlags if not pc_DYNAMIC_BY_DEFAULT (#7478)

The test for Trac issue #7478 fails on some systems due to
inconsistent default flags for dynamic vs. static linking.

Test Plan: validate

Reviewers: austin, thomie

Reviewed By: thomie

Subscribers: thomie, bgamari

Differential Revision:

GHC Trac Issues: #7478

4 years agoImplement -fprint-expanded-synonyms
Ömer Sinan Ağacan [Thu, 16 Jul 2015 22:02:09 +0000 (00:02 +0200)] 
Implement -fprint-expanded-synonyms

Add a flag to print type-synonyms-expanded versions of types in type
error messages (in addition to old error messages with synonyms)

 * Mailing list discussion:
 * Wiki page:
 * Trac:

Test Plan:
 * I'll find some examples and add tests.

Reviewers: austin, simonpj, goldfire, bgamari

Reviewed By: austin, simonpj, goldfire, bgamari

Subscribers: rodlogic, thomie, bgamari

Differential Revision:

GHC Trac Issues: #10547

4 years agoFix tests
Ben Gamari [Fri, 10 Jul 2015 11:48:24 +0000 (13:48 +0200)] 
Fix tests

4 years agoCoreLint: Use size-annotated ppr variant
Ben Gamari [Mon, 22 Jun 2015 10:48:07 +0000 (12:48 +0200)] 
CoreLint: Use size-annotated ppr variant

4 years agoPprCore: Add size annotations for top-level bindings
Ben Gamari [Mon, 22 Jun 2015 10:47:33 +0000 (12:47 +0200)] 
PprCore: Add size annotations for top-level bindings

4 years agoCoreUtils: Move size utilities to CoreStats
Ben Gamari [Mon, 22 Jun 2015 10:35:02 +0000 (12:35 +0200)] 
CoreUtils: Move size utilities to CoreStats

This allows PprCore to use these functions. It will soon do so to enable
CoreLint to output size annotations on top-level bindings.

4 years agoCoreUtils: Move seq* functions to CoreSeq
Ben Gamari [Tue, 7 Jul 2015 18:25:50 +0000 (20:25 +0200)] 
CoreUtils: Move seq* functions to CoreSeq

These seem to sit near the top of the import graph and have been causing
import cycles.

4 years agoFailing test case: idArity invariant check, #10181
Joachim Breitner [Thu, 16 Jul 2015 13:57:42 +0000 (15:57 +0200)] 
Failing test case: idArity invariant check, #10181

This was found Thomas Miedema.

4 years agoDocs: `sortOn = sortBy (comparing f)` [skip ci]
Thomas Miedema [Thu, 16 Jul 2015 08:10:18 +0000 (10:10 +0200)] 
Docs: `sortOn = sortBy (comparing f)` [skip ci]

4 years agoinitGroup: only initialize the first and last blocks of a group
Simon Marlow [Wed, 15 Jul 2015 11:57:18 +0000 (12:57 +0100)] 
initGroup: only initialize the first and last blocks of a group

Summary: Initialising the whole group is expensive and unnecessary.

Test Plan: validate

Reviewers: austin, bgamari, rwbarton

Subscribers: thomie

Differential Revision:

4 years agoFix #10642.
Richard Eisenberg [Wed, 15 Jul 2015 13:50:57 +0000 (09:50 -0400)] 
Fix #10642.

Representational equalities cannot discharge nominal ones.
Even if, somehow, this didn't cause a type error (as reported
in the ticket), it would surely cause a core lint error.

4 years agoDon't get a new nursery if we exceeded large_alloc_lim
Simon Marlow [Wed, 15 Jul 2015 12:07:35 +0000 (13:07 +0100)] 
Don't get a new nursery if we exceeded large_alloc_lim

When using nursery chunks, if we failed a heap check due to
large_alloc_lim, we would pointlessly keep grabbing new nursery
chunks when we should just GC immediately.

Test Plan: validate

Reviewers: austin, bgamari, niteria

Subscribers: thomie

Differential Revision:

4 years agoRemove all references to sync-all
Thomas Miedema [Tue, 14 Jul 2015 15:15:12 +0000 (17:15 +0200)] 
Remove all references to sync-all

4 years agoBuild system: delete [skip ci]
Thomas Miedema [Wed, 15 Jul 2015 08:18:37 +0000 (10:18 +0200)] 
Build system: delete [skip ci]

fingerprint makes no sense anymore w/ submodules.

4 years agoTestsuite: mark T10294 conditionally expect_broken on #10301
Thomas Miedema [Wed, 15 Jul 2015 11:27:59 +0000 (13:27 +0200)] 
Testsuite: mark T10294 conditionally expect_broken on #10301

Fix 8e6a50339a4a61d4f2cbec645c78abc85098a294.