8 months agoRevert "Fix typo in maybeToList documentation"
Steve Hart [Thu, 10 Jan 2019 13:29:29 +0000 (08:29 -0500)] 
Revert "Fix typo in maybeToList documentation"

This reverts commit af210f40ce7ad7b3351abc988b0351446e8b639e

8 months agoFix typo in maybeToList documentation
Steve Hart [Thu, 10 Jan 2019 03:21:38 +0000 (22:21 -0500)] 
Fix typo in maybeToList documentation

8 months agoHadrian: Use the Cabal build script on Windows by default
Andrey Mokhov [Thu, 10 Jan 2019 00:18:24 +0000 (00:18 +0000)] 
Hadrian: Use the Cabal build script on Windows by default

The Stack build script `build.stack.bat` currently fails on Windows
when invoked with the `--configure` flag, see:

The Cabal build script `build.cabal.bat` works reliably on my Windows
machine, so I am proposing to switch to it by default, that is, to run
it from the default `build.bat` script.

The Stack build script can still be run directly if need be.

8 months agoDisable Shake Lint by default.
Andrey Mokhov [Thu, 10 Jan 2019 22:35:22 +0000 (22:35 +0000)] 
Disable Shake Lint by default.

8 months agoSwitch to the untracked version of getDirectoryFiles when scanning for GMP objects
Andrey Mokhov [Wed, 9 Jan 2019 21:34:03 +0000 (21:34 +0000)] 
Switch to the untracked version of getDirectoryFiles when scanning for GMP objects


This is work in progress: this commit does the right thing, but does not
yet fix the ticket.

8 months agotypo
Alp Mestanogullari [Wed, 9 Jan 2019 21:40:25 +0000 (22:40 +0100)] 

8 months agocrosslink hadrian/ and hadrian/doc/
Alp Mestanogullari [Wed, 9 Jan 2019 11:51:50 +0000 (12:51 +0100)] 
crosslink hadrian/ and hadrian/doc/

8 months agodoc: behaviour of +RTS -h depends on profiling
Ben Price [Tue, 15 Jan 2019 12:38:44 +0000 (12:38 +0000)] 
doc: behaviour of +RTS -h depends on profiling

The rts option `-h` behaves as `-hT` when compiled without profiling,
and `-hc` when compiled with profiling. Add a note to the user's guide
highlighting this inconsistency.

8 months agodoc: reorder heap profiling information in +RTS -?
Ben Price [Mon, 14 Jan 2019 18:26:45 +0000 (18:26 +0000)] 
doc: reorder heap profiling information in +RTS -?

8 months agorts: Allow heap prof by closure type in prof way
Ben Price [Tue, 8 Jan 2019 22:16:10 +0000 (22:16 +0000)] 
rts: Allow heap prof by closure type in prof way

Complete b7b6617a90824303daf555c817f538cd9c792671 (see ticket #15086) to
actually enable profiling by closure type in the profiling rts. I.e.
+RTS -p -hT is now accepted.

8 months agotry to fix CI
Alec Theriault [Wed, 9 Jan 2019 00:29:32 +0000 (16:29 -0800)] 
try to fix CI

8 months agoFix tests for `integer-simple`
Alec Theriault [Tue, 8 Jan 2019 18:50:30 +0000 (10:50 -0800)] 
Fix tests for `integer-simple`

A bunch of tests for `integer-simple` were now broken for a foolish reason:
unlike the `integer-gmp` case, there is no CorePrep optimization for turning
small integers directly into applications of `S#`.

Rather than port this optimization to `integer-simple` (which would involve
moving a bunch of `integer-simple` names into `PrelNames`), I switched
as many tests as possible to use `Int`.

The printing of `Integer` is already tested in `print037`.

8 months agoRemove from `base` obsolete CPP for `integer-gmp`
Alec Theriault [Tue, 8 Jan 2019 18:41:50 +0000 (10:41 -0800)] 
Remove from `base` obsolete CPP for `integer-gmp`

  * `GHC.Natural` now exports the same functions (regardless of integer backend)
  * remove unnecessary CPP around instances
  * remove the 'OPTIMISE_INTEGER_GCD_LCM' flag - almost all of those optimizations
    now work regardless of which integer backend is used

Note that some CPP still remains for situations where there are backend-specific
optimization hacks (like a more efficient GMP-only `gcd` for `Int#` and `Word#`).

8 months agoMatch `integer-simple`'s API with `integer-gmp`
Alec Theriault [Tue, 8 Jan 2019 18:35:55 +0000 (10:35 -0800)] 
Match `integer-simple`'s API with `integer-gmp`

In `integer-simple`:

  * Added an efficient `popCountInteger` and `bitInteger`
  * Added an efficient `gcdInteger` and `lcmInteger`
  * Made `testBitInteger` more efficient

8 months agoSupport printing `integer-simple` Integers in GHCi
Alec Theriault [Tue, 8 Jan 2019 18:28:10 +0000 (10:28 -0800)] 
Support printing `integer-simple` Integers in GHCi

This means that `:p` no longer leaks the implementation details of
`Integer` with `integer-simple`. The `print037` test case should
exercise all possible code paths for GHCi's code around printing
`Integer`s (both in `integer-simple` and `integer-gmp`).

`ghc` the package now also has a Cabal `integer-simple` flag (like the
`integer-gmp` one).

8 months agoCreate folder if missing for .hie files
Alec Theriault [Tue, 8 Jan 2019 14:31:32 +0000 (06:31 -0800)] 
Create folder if missing for .hie files

This matches the existing behaviour for .hi files: if the user requests
the interface file be written in some location, we should create the
parent folder if it doesn't already exist.

Reviewers: bgamari, sjakobi

Reviewed By: sjakobi

Subscribers: sjakobi, rwbarton, carter

Differential Revision:

8 months agoHadrian: support extra libraries + OSX rpath
Alec Theriault [Mon, 7 Jan 2019 19:38:11 +0000 (11:38 -0800)] 
Hadrian: support extra libraries + OSX rpath

This fixes some of the issues that surfaced when trying to build
dynamic GHC on OSX. Unfortunately, due some other `libffi`
issues, this doesn't completely fix dynamic builds on OSX.

  - Use 'extra-libraries' from .cabal files instead of hardcoding
    which packages need which extra libs. Also add support for

  - Make sure Hadrian looks in the right places to support both
    plain '<pkg>.buildinfo' and '<pkg>' files.

  - Make the '-rpath' support more robust across OS's (it previously
    didn't work on OSX and possibly windows either).

Reviewers: angerman, alpmestan, adamse, DavidEichmann, bgamari, Phyx

Subscribers: rwbarton, carter

GHC Trac Issues: #15990

Differential Revision:

8 months agoIntroduce ghci command wrapper
Zejun Wu [Sat, 29 Dec 2018 20:28:47 +0000 (12:28 -0800)] 
Introduce ghci command wrapper

Introduce ghci command wrapper, which can be used to cutomize ghci:
* process additionals actions before/after the command
* handle particular exceptions in given ways
* logging stats

We also split the timing and printing part of `timeIt` into different

8 months agoFix filename in comment again
Peter Trommler [Sun, 30 Dec 2018 21:31:38 +0000 (22:31 +0100)] 
Fix filename in comment again

8 months agoFix reference to stack code in comment
Peter Trommler [Sun, 30 Dec 2018 21:28:45 +0000 (22:28 +0100)] 
Fix reference to stack code in comment

8 months agoPPC NCG: Refactor stack allocation code
Peter Trommler [Mon, 17 Dec 2018 12:27:49 +0000 (13:27 +0100)] 
PPC NCG: Refactor stack allocation code

There is only one place where UPDATE_SP was used. Instead of the
UPDATE_SP pseudo instruction build the list of instructions directly.

8 months agoHadrian: configure packages with right 'htmldir'
Alec Theriault [Thu, 27 Dec 2018 21:07:51 +0000 (13:07 -0800)] 
Hadrian: configure packages with right 'htmldir'

This means that we can query the package DB for haddock interfaces.
Haddock uses this in its testsuite. 'cabal {v1-,v2,}-haddock' also
uses this.

Also thread through to Haddock package-specific overrides of GHC

8 months agoChange comments as requested by code review. #10857
Roland Senn [Thu, 27 Dec 2018 14:14:31 +0000 (15:14 +0100)] 
Change comments as requested by code review. #10857

8 months agoGHCi ignores cmd line flags XMonomorphismRestr.. XNoExtendedDef..#10857
Roland Senn [Mon, 24 Dec 2018 13:14:25 +0000 (14:14 +0100)] 
GHCi ignores cmd line flags XMonomorphismRestr.. XNoExtendedDef..#10857

8 months agohWaitForInput-accurate-socket test
Tom Sydney Kerckhove [Fri, 21 Dec 2018 10:41:13 +0000 (12:41 +0200)] 
hWaitForInput-accurate-socket test

8 months ago@simonpj's suggested refactor
Ryan Scott [Tue, 15 Jan 2019 01:28:59 +0000 (20:28 -0500)] 
@simonpj's suggested refactor

8 months agoBump Cabal submodule
Ryan Scott [Mon, 14 Jan 2019 15:41:26 +0000 (10:41 -0500)] 
Bump Cabal submodule

8 months agoControl validity-checking of type synonym applications more carefully
Ryan Scott [Thu, 10 Jan 2019 21:55:51 +0000 (16:55 -0500)] 
Control validity-checking of type synonym applications more carefully

Trac #16059 shows that when validity checking applications of type
synonyms, GHC sometimes wasn't checking the expanded type enough.
We must be careful, however, since checking both the expanded type as
well as the arguments to the type synonym can lead to exponential
blowup (see
Nor can we omit checking either the expanded type or the argument for
correctness reasons.

The solution here is to introduce a new `ExpandMode` data type that
is plumbed through all of the type-validity-checking functions in
`TcValidity`. `ExpandMode` dictates whether we only check the
expanded type (`Expand`), only check the arguments (`NoExpand), or
both (`Both`). Importantly, if we check `Both` in the function for
validity checking type synonym applications, then we switch to
`NoExpand` when checking the arguments so as to avoid exponential
blowup. See `Note [Correctness and performance of type synonym validity
checking]` for the full story.

8 months agoFix #16116 by removing badAssocRhs
Ryan Scott [Tue, 15 Jan 2019 21:02:07 +0000 (16:02 -0500)] 
Fix #16116 by removing badAssocRhs

8 months agoFix #16114 by adding a validity check to rnClsInstDecl
Ryan Scott [Tue, 15 Jan 2019 13:08:43 +0000 (08:08 -0500)] 
Fix #16114 by adding a validity check to rnClsInstDecl

8 months agogitlab-ci: Cleanup Windows builds
Ben Gamari [Sun, 6 Jan 2019 04:28:49 +0000 (23:28 -0500)] 
gitlab-ci: Cleanup Windows builds

See Note [Cleanup on Windows].

8 months agoDocument the Shake Lint feature.
Andrey Mokhov [Thu, 10 Jan 2019 23:27:07 +0000 (23:27 +0000)] 
Document the Shake Lint feature.

8 months agoClarify when to follow the instructions in doc/
Andrey Mokhov [Thu, 10 Jan 2019 23:18:47 +0000 (23:18 +0000)] 
Clarify when to follow the instructions in doc/


8 months agoHadrian: Update
Andrey Mokhov [Thu, 10 Jan 2019 02:13:46 +0000 (02:13 +0000)] 
Hadrian: Update

* Update or remove a few outdated paragraphs
* Use consistent naming (e.g. "Stage1" instead of occasionally "stage1")
* Rewrite acknowledgements
* Some more minor revisions

8 months agotestsuite: Show both test name and way in JUnit output
Ben Gamari [Thu, 10 Jan 2019 16:45:32 +0000 (11:45 -0500)] 
testsuite: Show both test name and way in JUnit output

8 months agoUpdate `Cabal` submodule
Herbert Valerio Riedel [Sun, 6 Jan 2019 23:59:23 +0000 (00:59 +0100)] 
Update `Cabal` submodule

This also requires adapting `ghc-pkg` to use the new Cabal parsing API
as the old ReadP-based one has finally been evicted for good.

Hadrian bit finished by: Ben Gamari <>

8 months agorts: Use always-available locking operations in pthread Itimer implementation
Ben Gamari [Wed, 9 Jan 2019 14:17:05 +0000 (09:17 -0500)] 
rts: Use always-available locking operations in pthread Itimer implementation

Previously we ACQUIRE_LOCK and RELEASE_LOCK but these compile to a noop in the
non-threaded RTS, as noted in #16150. Use OS_ACQUIRE_LOCK and OS_RELEASE_LOCK

8 months agoitimer: Don't free condvar until we know ticker is stopped
Ben Gamari [Wed, 9 Jan 2019 05:20:19 +0000 (00:20 -0500)] 
itimer: Don't free condvar until we know ticker is stopped

When we are shutting down the pthread ticker we signal the start_cond condition
variable to ensure that the ticker thread wakes up and exits in a reasonable
amount of time. Previously, when the ticker thread would shut down it was
responsible for freeing the start_cond condition variable. However, this would
lead to a race wherein the ticker would free start_cond, then the main thread
would try to signal it in an effort to wake the ticker (#16150).

Avoid this by moving the mutex destruction to the main thread.

8 months agoPPC NCG: Reduce memory consumption emitting string literals
Peter Trommler [Sun, 13 Jan 2019 21:36:07 +0000 (16:36 -0500)] 
PPC NCG: Reduce memory consumption emitting string literals

8 months agoRefactor GHCi UI to fix #11606, #12091, #15721, #16096
Ömer Sinan Ağacan [Wed, 9 Jan 2019 15:44:48 +0000 (18:44 +0300)] 
Refactor GHCi UI to fix #11606, #12091, #15721, #16096

Instead of parsing and executing a statement or declaration directly we
now parse them first and then execute in a separate step. This gives us
the flexibility to inspect the parsed declaration before execution.
Using this we now inspect parsed declarations, and if it's a single
declaration of form `x = y` we execute it as `let x = y` instead, fixing
a ton of problems caused by poor declaration support in GHCi.

To avoid any users of the modules I left `execStmt` and `runDecls`
unchanged and added `execStmt'` and `runDecls'` which work on parsed

8 months agoFix checkPtrInArena
Ömer Sinan Ağacan [Sat, 12 Jan 2019 13:08:24 +0000 (16:08 +0300)] 
Fix checkPtrInArena

(See comments)

8 months agoDon't invoke dataConSrcToImplBang on newtypes
Ryan Scott [Sun, 13 Jan 2019 00:05:46 +0000 (19:05 -0500)] 
Don't invoke dataConSrcToImplBang on newtypes

8 months agoFix negative mutator time in GC stats in prof builds
Ömer Sinan Ağacan [Fri, 28 Dec 2018 10:51:28 +0000 (13:51 +0300)] 
Fix negative mutator time in GC stats in prof builds

Because garbage collector calls `retainerProfile()` and `heapCensus()`,
GC times normally include some of PROF times too. To fix this we have
these lines:

    // heapCensus() is called by the GC, so RP and HC time are
    // included in the GC stats.  We therefore subtract them to
    // obtain the actual GC cpu time.
    stats.gc_cpu_ns      -=  prof_cpu;
    stats.gc_elapsed_ns  -=  prof_elapsed;

These variables are later used for calculating GC time excluding the
final GC (which should be attributed to EXIT).

    exit_gc_elapsed      = stats.gc_elapsed_ns - start_exit_gc_elapsed;

The problem is if we subtract PROF times from `gc_elapsed_ns` and then
subtract `start_exit_gc_elapsed` from the result, we end up subtracting
PROF times twice, because `start_exit_gc_elapsed` also includes PROF

We now subtract PROF times from GC after the calculations for EXIT and
MUT times. The existing assertion that checks


now holds. When we subtract PROF numbers from GC, and a new assertion


also holds.

Fixes #15897. New assertions added in this commit also revealed #16102,
which is also fixed by this commit.

8 months agoFix raiseAsync() UNDERFLOW_FRAME handling in profiling runtime
Ömer Sinan Ağacan [Thu, 10 Jan 2019 08:55:25 +0000 (11:55 +0300)] 
Fix raiseAsync() UNDERFLOW_FRAME handling in profiling runtime

UNDERFLOW_FRAMEs don't have profiling headers so we have to use the
AP_STACK's function's CCS as the new frame's CCS.

Fixes one of the many bugs caught by concprog001 (#15508).

8 months agoDocumentation and refactoring in CCS related code
Ömer Sinan Ağacan [Thu, 10 Jan 2019 11:39:16 +0000 (14:39 +0300)] 
Documentation and refactoring in CCS related code

- Remove REGISTER_CC and REGISTER_CCS macros, add functions registerCC
  and registerCCS to Profiling.c.

- Reduce scope of symbols: CC_LIST, CCS_LIST, CC_ID, CCS_ID

- Document CC_LIST and CCS_LIST

8 months agoMore minor comment improvements
Richard Eisenberg [Fri, 11 Jan 2019 21:42:06 +0000 (16:42 -0500)] 
More minor comment improvements

[skip ci]

8 months agoRun typed splices in the zonker
Matthew Pickering [Wed, 9 Jan 2019 14:52:30 +0000 (14:52 +0000)] 
Run typed splices in the zonker

This fixes #15471

In the typechecker we check that the splice has the right type but we
crucially don't zonk the generated expression. This is because we might
end up unifying type variables from outer scopes later on.

Reviewers: simonpj, goldfire, bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: #15471

Differential Revision:

8 months agoImplement a sanity check for CCS fields in profiling builds
Ömer Sinan Ağacan [Thu, 10 Jan 2019 09:42:04 +0000 (12:42 +0300)] 
Implement a sanity check for CCS fields in profiling builds

This helped me debug one of the bugs in #15508. I'm not sure if this is
a good idea, but it worked for me, so wanted to submit this as a MR.

8 months agoHadrian: Add support for building stage3
Matthew Pickering [Sun, 16 Dec 2018 08:58:41 +0000 (08:58 +0000)] 
Hadrian: Add support for building stage3

This ticket enables the building of a `stage3` compiler by making the
build logic more consistent and predictable in Hadrian.

Two of the main changes are:

1. In order to build anything at stageN we use the package database
present at stageN. Fixing #16069
2. `haddock` and `ghc-tags` are built
as stage1 executables (with the stage1 compiler) rather than as
stage2 compiler. Fixing

In order to build a stage3 compiler, you have to set the new `finalStage` hadrian option to `Stage3`.

8 months agoBe pickier about unsaturated synonyms in :kind
Ryan Scott [Tue, 8 Jan 2019 12:37:18 +0000 (07:37 -0500)] 
Be pickier about unsaturated synonyms in :kind

We currently permit any and all uses of unsaturated type
synonyms and type families in GHCi's `:kind` command, which allows
strange interactions like this one:

> :set -XTypeFamilies -XPolyKinds
> type family Id (a :: k)
> type instance Id a = a
> type Foo x = Maybe
> :kind! Id Foo

This is probably a stretch too far, so this patch moves to disallow
unsaturated synonyms that aren't at the top level (we still want to
allow `:kind Id`, for instance). We do this by augmenting `GhciCtxt`
with an additional `Bool` field to indicate if we are at the
outermost level of the type being passed to `:kind` or not. See
`Note [Unsaturated type synonyms in GHCi]` in `TcValidity` for the
full story.

Test Plan: make test TEST=T16013

Reviewers: goldfire, bgamari

Reviewed By: goldfire

Subscribers: simonpj, goldfire, rwbarton, carter

GHC Trac Issues: #16013

Differential Revision:

8 months agoCheck that libs found by GCC aren't folders
Alec Theriault [Mon, 7 Jan 2019 20:59:36 +0000 (12:59 -0800)] 
Check that libs found by GCC aren't folders

We use 'gcc -B<base-location> --print-file-name mylib.a' as a way of
checking if 'gcc' can discover 'mylib.a' at the given location. However,
this can break down if there is a folder caller 'mylib.a' that 'gcc' can
discover. We can guard against this by explicitly checking that the path
returned by 'gcc' is a file.

This may seem like a far-fetched scenario, but since
3d17f1f10fc00540ac052f2fd03182906aa47e35, we look for libraries without
any prefix or suffix (ie. 'extra-libraries: softfloat', we look for just
'softfloat' as well as 'softloat.a', 'softfloat.dll.a', etc.) which means
that there might actusally be a folder of that name in one of the base

Reviewers: Phyx, bgamari, hvr, angerman

Reviewed By: Phyx, angerman

Subscribers: angerman, rwbarton, carter

GHC Trac Issues: #16063

Differential Revision:

8 months agofix-submodules: Rip out typing
Ben Gamari [Sun, 6 Jan 2019 04:34:12 +0000 (23:34 -0500)] 
fix-submodules: Rip out typing

Debian Jessie only runs Python 3.4, whereas typing was introduced in Python 3.5.

8 months agogitlab-ci: Clone haddock from its upstream repository
Ben Gamari [Sat, 5 Jan 2019 19:16:56 +0000 (14:16 -0500)] 
gitlab-ci: Clone haddock from its upstream repository

This ensures that changes requiring haddock changes can be built under CI.

8 months agoHadrian: merge sections in profiling _p.a to .p_o for ghci
Zejun Wu [Sun, 6 Jan 2019 12:40:05 +0000 (07:40 -0500)] 
Hadrian: merge sections in profiling _p.a to .p_o for ghci

This is the hadrain version of {D5169}

* We build squashed .o and .p_o for ghci when `dynamicGhcPrograms` is
* We no longer build them for rts as ghci never loads it

we need for cabal to copy
the built `.p_o` file.

Test Plan:
$ grep dynamicGhc hadrian/UserSettings.hs
  , dynamicGhcPrograms = return False
$ touch ...
$ hadrian/ --flavour=user -j --digest-or
$ find _build/stage1/libraries/ -name 'HS*-*.*o' | wc
     62      62    3664

$ grep -C3 dynamicGhc hadrian/UserSettings.hs
userFlavour :: Flavour
userFlavour = performanceFlavour
  { name = "user"
  , dynamicGhcPrograms = return False
$ hadrian/ -j --flavour=user test --verbose
Unexpected results from:
TEST="T3807 T9208 T9293 annth_make ghci057 haddock.Cabal haddock.base

SUMMARY for test run started at Wed Dec  5 17:45:39 2018 PST
 0:03:16 spent to go through
    6708 total tests, which gave rise to
   26015 test cases, of which
   19290 were skipped

      29 had missing libraries
    6600 expected passes
      88 expected failures

       3 caused framework failures
       0 caused framework warnings
       1 unexpected passes
       7 unexpected failures
       0 unexpected stat failures
$ find _build -name 'HSbase*.*o'

Reviewers: bgamari, simonmar, snowleopard

Reviewed By: snowleopard

Subscribers: alpmestan, rwbarton, carter

GHC Trac Issues: #15779

Differential Revision:

8 months agoFix #16133 by checking for TypeApplications in rnExpr
Ryan Scott [Sat, 5 Jan 2019 17:40:39 +0000 (12:40 -0500)] 
Fix #16133 by checking for TypeApplications in rnExpr

8 months agoFix bindist for ghci library
Zejun Wu [Wed, 2 Jan 2019 02:59:23 +0000 (18:59 -0800)] 
Fix bindist for ghci library

Summary: built libghci for both vanilla way
and profiling way. We need to include both in the bindist list so they
will be installed.

Test Plan:
$ grep '^BuildFlavour' mk/
$ make test_bindist
$ grep HSghc-prim bindist-list.uniq

8 months agomake: Silence some xelatex output
Ben Gamari [Sun, 30 Dec 2018 21:36:21 +0000 (16:36 -0500)] 
make: Silence some xelatex output

Currently build logs from GitLab CI around around 7 megabytes each. Of this,
around 2 megabytes is latex output. This is quite silly as essentially all of
this output is unresolved references in the early latex iterations.
Here we silence this output.

However, to make sure that we don't silence errors we allow each xelatex
invocation besides the last to fail.

8 months agoRemove OPTIONS_HADDOCK hide in favour for not-home
Adam Sandberg Eriksson [Sun, 30 Dec 2018 19:04:15 +0000 (20:04 +0100)] 
Remove OPTIONS_HADDOCK hide in favour for not-home

GHC Trac Issues: #15447

8 months agogitlab-ci: Try reenabling PDF documentation on Darwin
Ben Gamari [Sun, 30 Dec 2018 18:49:47 +0000 (13:49 -0500)] 
gitlab-ci: Try reenabling PDF documentation on Darwin

Carter says that the builder issues have now been sorted.

8 months agoAdd entry for #16031 to base/
Sven Tennie [Thu, 27 Dec 2018 16:21:41 +0000 (17:21 +0100)] 
Add entry for #16031 to base/

8 months agoFix precedence handling for Data.Fixed's Show instance (#16031)
Sven Tennie [Wed, 26 Dec 2018 11:04:36 +0000 (12:04 +0100)] 
Fix precedence handling for Data.Fixed's Show instance (#16031)

Use `showsPrec` instead of `show` to respect the precedence of the surrounding

8 months agoAdd -Wmissing-deriving-strategies
chessai [Wed, 26 Dec 2018 17:12:37 +0000 (12:12 -0500)] 
Add -Wmissing-deriving-strategies

Warn users when -XDerivingStrategies is enabled but not used, at each
potential use site.

add -Wmissing-deriving-strategies

Reviewers: bgamari, RyanGlScott

Subscribers: andrewthad, rwbarton, carter

GHC Trac Issues: #15798

Differential Revision:

8 months agoRespect prompt in GhciSettings
Zejun Wu [Wed, 19 Dec 2018 02:29:44 +0000 (18:29 -0800)] 
Respect prompt in GhciSettings

This was broken when PromptFunction was introduced that the settings are
ignored and default values are always used.

Test Plan: ./validate

8 months agoFix broken links (#16125)
Sven Tennie [Fri, 4 Jan 2019 19:17:07 +0000 (20:17 +0100)] 
Fix broken links (#16125)

8 months agoDump Cmm with -ddump-cmm when building .cmm files
Ömer Sinan Ağacan [Sat, 5 Jan 2019 05:40:19 +0000 (08:40 +0300)] 
Dump Cmm with -ddump-cmm when building .cmm files

Fixes #16131

8 months agoMark GHC.Maybe as not-home for haddock
Simon Jakobi [Fri, 4 Jan 2019 02:56:51 +0000 (03:56 +0100)] 
Mark GHC.Maybe as not-home for haddock

Previously haddock would link 'Maybe' to GHC.Maybe.
Now it links to Data.Maybe.

8 months agoFix some typos, etc., in comments.
Richard Eisenberg [Fri, 4 Jan 2019 00:02:10 +0000 (19:02 -0500)] 
Fix some typos, etc., in comments.

[ci skip]

8 months agoVisible kind application
mynguyen [Tue, 18 Dec 2018 16:52:26 +0000 (11:52 -0500)] 
Visible kind application

This patch implements visible kind application (GHC Proposal 15/#12045), as well as #15360 and #15362.
It also refactors unnamed wildcard handling, and requires that type equations in type families in Template Haskell be
written with full type on lhs. PartialTypeSignatures are on and warnings are off automatically with visible kind
application, just like in term-level.

There are a few remaining issues with this patch, as documented in
ticket #16082.

Includes a submodule update for Haddock.

Test Plan: Tests T12045a/b/c/TH1/TH2, T15362, T15592a

Reviewers: simonpj, goldfire, bgamari, alanz, RyanGlScott, Iceland_jack

Subscribers: ningning, Iceland_jack, RyanGlScott, int-index, rwbarton, mpickering, carter

GHC Trac Issues: `#12045`, `#15362`, `#15592`, `#15788`, `#15793`, `#15795`, `#15797`, `#15799`, `#15801`, `#15807`, `#15816`

Differential Revision:

8 months agoMinor refactoring and documentation in profiling RTS code
Ömer Sinan Ağacan [Wed, 2 Jan 2019 10:13:59 +0000 (13:13 +0300)] 
Minor refactoring and documentation in profiling RTS code

8 months agostg-spec: Modify `.lhs` to `.hs`
Takenobu Tani [Thu, 3 Jan 2019 01:09:29 +0000 (10:09 +0900)] 
stg-spec: Modify `.lhs` to `.hs`

Modify old filename `.lhs` to `.hs` in the following file:

  * docs/stg-spec/

Since PDF has not been registered in the past, I have not committed generated PDF(`stg-spec.pdf`).

[ci skip]

8 months agocore-spec: Modify `.lhs` to `.hs` (generated PDF)
Takenobu Tani [Wed, 2 Jan 2019 03:03:03 +0000 (12:03 +0900)] 
core-spec: Modify `.lhs` to `.hs` (generated PDF)

Modify old filename `.lhs` to `.hs` in following file:

  * docs/core-spec/core-spec.pdf (generated PDF)

[ci skip]

8 months agocore-spec: Modify `.lhs` to `.hs` (source files)
Takenobu Tani [Wed, 2 Jan 2019 03:01:47 +0000 (12:01 +0900)] 
core-spec: Modify `.lhs` to `.hs` (source files)

Modify old filename `.lhs` to `.hs` in following files:

  * docs/core-spec/README
  * docs/core-spec/
  * docs/core-spec/
  * docs/core-spec/core-spec.mng

[ci skip]

8 months agoconfigure: introduce HAPPY and ALEX vars and deprecate --with-ghc in favour of the...
Adam Sandberg Eriksson [Sun, 30 Dec 2018 23:42:35 +0000 (00:42 +0100)] 
configure: introduce HAPPY and ALEX vars and deprecate --with-ghc in favour of the GHC var

Also updates the windows gitlab ci to use the new configure variables.

8 months agoPPC NCG: Remove Darwin support
Peter Trommler [Sun, 30 Dec 2018 21:23:53 +0000 (22:23 +0100)] 
PPC NCG: Remove Darwin support

Support for Mac OS X on PowerPC has been dropped by Apple years ago. We
follow suit and remove PowerPC support for Darwin.

Fixes #16106.

8 months agoIntroduce NCG config flag and add helper
Gabor Greif [Sun, 30 Dec 2018 09:57:46 +0000 (10:57 +0100)] 
Introduce NCG config flag and add helper

... for testing presence of NCG

This commit adds a criterion for checking whether we can expect sensible
output from --ddump-asm.

8 months agoPPC NCG: Simple 64-bit condition code on 32-bit
Peter Trommler [Sun, 30 Dec 2018 07:39:23 +0000 (02:39 -0500)] 
PPC NCG: Simple 64-bit condition code on 32-bit

8 months agorts: fix build failure on OpenBSD (_DYNAMIC symbol collision)
Sergei Trofimovich [Tue, 18 Dec 2018 23:17:45 +0000 (23:17 +0000)] 
rts: fix build failure on OpenBSD (_DYNAMIC symbol collision)

Build failure on OpenBSD-6.4 the the following:
rts/RtsSymbols.c:994:1: error:
     error: redefinition of '_DYNAMIC' as different kind of symbol
    | ^

On OpenBSD `_DYNAMIC` was always defined in `<elf.h>` headers
but used not to be included.

The change explicitly includes `<elf.h>` as a source of symbol definition.

Signed-off-by: Sergei Trofimovich <>
Test Plan: build-tested on OpenBSD-6.4

Reviewers: bgamari, erikd, simonmar

Subscribers: rwbarton, carter

GHC Trac Issues: #15945

Differential Revision:

8 months agotestsuite: Disable more tests in unregisterised build
Ben Gamari [Sat, 29 Dec 2018 00:19:48 +0000 (19:19 -0500)] 
testsuite: Disable more tests in unregisterised build

This disables `ghcilink005`, `foreignInterruptable`, and `T7040_ghci` in
the unregisterised build as they tend to fail non-deterministically. See
ticket #16085.

8 months agorebindable-clash-warning-fix : correct warning logic
Shayne Fletcher [Sat, 29 Dec 2018 00:13:51 +0000 (19:13 -0500)] 
rebindable-clash-warning-fix : correct warning logic

8 months agoSkip test when external interpreter missing
Peter Trommler [Sat, 15 Dec 2018 21:22:47 +0000 (22:22 +0100)] 
Skip test when external interpreter missing

8 months agoarith011 is no longer broken with integer-simple
Alec Theriault [Wed, 26 Dec 2018 15:05:47 +0000 (10:05 -0500)] 
arith011 is no longer broken with integer-simple

8 months agoDivision fails fast for `divMod` \w integer-simple
Alec Theriault [Mon, 24 Dec 2018 18:35:18 +0000 (13:35 -0500)] 
Division fails fast for `divMod` \w integer-simple

We want to match the behaviour of `Integer` as well as
`Integer`/`Natural` from `integer-gmp`, namely to have

     divMod x 0 = _|_


     divMod x 0 = (_|_, _|_)

See #16091 for an example of where this matters.

8 months agoaclocal.m4: drop obsolete -fno-stack-protector
Sergei Trofimovich [Wed, 19 Dec 2018 23:21:28 +0000 (23:21 +0000)] 
aclocal.m4: drop obsolete -fno-stack-protector

Initially -fno-stack-protector was added for openbsd specifically for ghc-6.5:
    changeset:f638fdfe1d9de1307355c8074fbff9c28342c0ef (2006)
and later it was extended to cover osx:
    changeset:c2cd83e7d85c11e6a33e1cde263eb2312566d535 (2009)

None of the reports hint at exact breakage. I guess both happened
in -fvia-C mode where GHC's Evil Mangler had a chance to mangle
stack canaries generated by fstack-protector.

ghc has no evil mangler anymore and the change is not needed
at least for C codegen.

validated the patch on OpenBSD-6.4. No new failures compared to
clean master branch.

Signed-off-by: Sergei Trofimovich <>
Test Plan: validated on OpenBSD

Reviewers: bgamari

Subscribers: rwbarton, erikd, carter

GHC Trac Issues: #16046

Differential Revision:

8 months agogitlab-ci: Try only building Windows in the quick flavour
Ben Gamari [Tue, 25 Dec 2018 10:12:40 +0000 (05:12 -0500)] 
gitlab-ci: Try only building Windows in the quick flavour

It seems no matter how many machines I throw at Windows it's constantly behind.
Perhaps the quick build flavour will be fast enough to allow us to keep until
while we sort out our toolchain issues (#16084).

8 months agogitlab-ci: Allow Windows to fail for now
Ben Gamari [Tue, 25 Dec 2018 21:54:25 +0000 (16:54 -0500)] 
gitlab-ci: Allow Windows to fail for now

While we sort out #16084.

8 months agogitlab-ci: Require that integer-simple configuration passes
Ben Gamari [Tue, 25 Dec 2018 21:52:59 +0000 (16:52 -0500)] 
gitlab-ci: Require that integer-simple configuration passes

The last step of #15915.

8 months agorts: Turn ASSERT in LDV_recordDead into a normal if
Ben Gamari [Sun, 23 Dec 2018 00:43:41 +0000 (19:43 -0500)] 
rts: Turn ASSERT in LDV_recordDead into a normal if

As reported in #15382 the `ASSERT(ctr != NULL)` is currently getting routinely
hit during testsuite runs. While this is certainly a bug I would far prefer
getting a proper error message than a segmentation fault. Consequently I'm
turning the `ASSERT` into a proper `if` so we get a proper error in non-debug

8 months agotestsuite: Skip ffi018_ghci when unregisterised
Ben Gamari [Tue, 25 Dec 2018 10:03:21 +0000 (05:03 -0500)] 
testsuite: Skip ffi018_ghci when unregisterised

As noted in #16085 this test is fragile in unregisterised compilers.

8 months agogitlab-ci: Clean tree on Windows after job
Ben Gamari [Mon, 24 Dec 2018 20:34:00 +0000 (15:34 -0500)] 
gitlab-ci: Clean tree on Windows after job

It seems like currently the runner doesn't delete the working tree after
finishing a job. At least we can delete the binary artifacts for now.

8 months agogitlab-ci: Use robocopy instead of bash to copy cabal cache
Ben Gamari [Sun, 23 Dec 2018 18:12:46 +0000 (13:12 -0500)] 
gitlab-ci: Use robocopy instead of bash to copy cabal cache

8 months agogitlab-ci: Use per-build temporary directory on Windows
Ben Gamari [Sun, 23 Dec 2018 06:19:36 +0000 (01:19 -0500)] 
gitlab-ci: Use per-build temporary directory on Windows

I have seen several instances of inexplicable "Access denied" errors on Windows.
Using per-build temporary directories avoids any chance of interference between
builds and eliminates the possibility of temporary files leaking beyond the life
of the build.

8 months agoRevert "hadrian: Pass integer_backend to testsuite driver"
Ben Gamari [Sun, 23 Dec 2018 22:57:12 +0000 (17:57 -0500)] 
Revert "hadrian: Pass integer_backend to testsuite driver"

This reverts commit 442be690e1ca162e22d632df695c29f90625f33e.

8 months agotestsuite: Fix a variety of issues when building with integer-simple
Ben Gamari [Sun, 23 Dec 2018 06:34:00 +0000 (06:34 +0000)] 
testsuite: Fix a variety of issues when building with integer-simple

 * Mark arith011 as broken with integer-simple

   As noted in #16091, arith011 fails when run against integer-simple with a
   "divide by zero" exception. This suggests that integer-gmp and integer-simple
   are handling division by zero differently.

 * This also fixes broken_without_gmp; the lack of types made the previous
   failure silent, sadly. Improves situation of #16043.

 * Mark several tests implicitly depending upon integer-gmp as broken
   with integer-simple. These expect to see Core coming from integer-gmp,
   which breaks with integer-simple.

 * Increase runtime timeout multiplier of T11627a with integer-simple

   I previously saw that T11627a timed out in all profiling ways when run against
   integer-simple. I suspect this is due to integer-simple's rather verbose heap
   representation. Let's see whether increasing the runtime timeout helps.

   Fixes test for #11627.

This is all in service of fixing #16043.

8 months agotestsuite: Enable T11627a on Darwin
Ben Gamari [Sun, 23 Dec 2018 17:36:50 +0000 (12:36 -0500)] 
testsuite: Enable T11627a on Darwin

The retainer profiler no longer uses the C stack for its mark stack (#14758).
Consequently even the small C stack provided on Darwin should be sufficient to
run this test. See #11627

8 months agoghc-compact: Use Char instead of Integer in compact_share test
Ben Gamari [Sun, 23 Dec 2018 17:33:12 +0000 (12:33 -0500)] 
ghc-compact: Use Char instead of Integer in compact_share test

The representation of Integer depends upon the choice of integer backend whereas
Char should be consistent.

8 months agoSimplify Core output with -dsuppress-type-signatures
Ömer Sinan Ağacan [Mon, 24 Dec 2018 12:02:27 +0000 (15:02 +0300)] 
Simplify Core output with -dsuppress-type-signatures

Currently we duplicate top-level binder ids for no reason:

      = \ @ id_a27U $dEq_a27V eta_B2 eta1_B1 ->
          case $fEqHsExpr_$c== $dEq_a27V eta_B2 eta1_B1 of {
            False -> True;
            True -> False

with this patch we drop the first line when type signatures are not
printed (-dsuppress-type-signatures, which is implied by -dsuppress-all)

Reviewers: simonpj, bgamari

Reviewed By: simonpj

Subscribers: rwbarton, carter

Differential Revision:

8 months agotestsuite: Mark th tests as broken in ext-interp way in LLVM build flavours
Ben Gamari [Sun, 23 Dec 2018 07:24:17 +0000 (02:24 -0500)] 
testsuite: Mark th tests as broken in ext-interp way in LLVM build flavours

This is due to the failures documented in #16087. The condition here could be
improved as it matches on `BUILD_FLAVOUR` instead of looking at the compiler
flags. However, it's better than nothing and I hope we will be able to fix these
issues before long.

8 months agogitlab-ci: Disable CircleCI Darwin builds
Ben Gamari [Sun, 23 Dec 2018 21:52:27 +0000 (16:52 -0500)] 
gitlab-ci: Disable CircleCI Darwin builds

They aren't finishing correctly anyways.

8 months agoRevert "testsuite: Fix broken_without_gmp"
Ben Gamari [Sun, 23 Dec 2018 18:45:24 +0000 (13:45 -0500)] 
Revert "testsuite: Fix broken_without_gmp"

This reverts commit e59439af3222d151918ad1ad2a03942ce9e6a1ff.

This is causing unexpected failures in some test ways. Further proof
that no change is too trivial for CI.

8 months agotestsuite: Fix broken_without_gmp
Ben Gamari [Sun, 23 Dec 2018 06:34:00 +0000 (06:34 +0000)] 
testsuite: Fix broken_without_gmp

The lack of types made the previous failure silent, sadly. Improves
situation of #16043.