4 years agoAllow -dead_strip linking on platforms with .subsections_via_symbols
Moritz Angermann [Wed, 19 Nov 2014 22:38:22 +0000 (16:38 -0600)] 
Allow -dead_strip linking on platforms with .subsections_via_symbols

This allows to link objects produced with the llvm code generator to be linked with -dead_strip. This applies to at least the iOS cross compiler and OS X compiler.

Signed-off-by: Moritz Angermann <>
Test Plan: Create a ffi library and link it with -dead_strip. If the resulting binary does not crash, the patch works as advertised.

Reviewers: rwbarton, simonmar, hvr, dterei, mzero, ezyang, austin

Reviewed By: dterei, ezyang, austin

Subscribers: thomie, mzero, simonmar, ezyang, carter

Differential Revision:

4 years agoOnly test for bug #9439 when llvm is installed
Thomas Miedema [Wed, 19 Nov 2014 04:23:27 +0000 (22:23 -0600)] 
Only test for bug #9439 when llvm is installed

Reviewers: bgamari, austin

Reviewed By: austin

Subscribers: thomie, carter

Differential Revision:

GHC Trac Issues: #9807

4 years agoadd missing instances for Loc and a few missing Eq instances
Luite Stegeman [Wed, 19 Nov 2014 04:21:44 +0000 (22:21 -0600)] 
add missing instances for Loc and a few missing Eq instances

Summary: This adds a few missing instances that can be automatically derived

Reviewers: hvr, goldfire, austin

Reviewed By: goldfire, austin

Subscribers: thomie, carter

Differential Revision:

4 years agotemplate-haskell: Missing instances for Rational and ().
Mathieu Boespflug [Wed, 19 Nov 2014 04:21:15 +0000 (22:21 -0600)] 
template-haskell: Missing instances for Rational and ().

Test Plan: ./validate

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, carter

Differential Revision:

4 years agoFilter input to abiHash early
Mateusz Kowalczyk [Wed, 19 Nov 2014 04:21:03 +0000 (22:21 -0600)] 
Filter input to abiHash early

This is already done near the only call site so why not. It is ugly to
see it at 'abiHash' itself.

Test Plan: validate

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, carter

Differential Revision:

4 years agoAdd remaining <unknown>s and comments to .mailmap
Thomas Miedema [Wed, 19 Nov 2014 04:20:14 +0000 (22:20 -0600)] 
Add remaining <unknown>s and comments to .mailmap

All done, except for these 2 empty commits:

$ git log --author=unknown --use-mailmap --oneline
7e5c2b2 [project @ 2001-12-06 10:17:35 by mbs] Established under cvs.
6456598 [project @ 2000-12-01 10:33:41 by cryder] Initial revision

Reviewers: hvr, austin

Reviewed By: austin

Subscribers: thomie, carter

Differential Revision:

4 years agoTurn CoreWriter into a newtype; fix comment
David Feuer [Wed, 19 Nov 2014 04:19:46 +0000 (22:19 -0600)] 
Turn CoreWriter into a newtype; fix comment

Turn CoreWriter into a newtype. A comment claimed something is forced
before returning, but it's actually not. Change comment to match

Reviewers: xich, simonpj, ezyang, austin

Reviewed By: ezyang, austin

Subscribers: thomie, carter

Differential Revision:

4 years agoImplement new Foldable methods for HsPatSynDetails
David Feuer [Wed, 19 Nov 2014 04:18:57 +0000 (22:18 -0600)] 
Implement new Foldable methods for HsPatSynDetails

Summary: Also explicitly define foldl1 and foldr1, which should generally work better with list-specific versions.

Reviewers: austin

Reviewed By: austin

Subscribers: rwbarton, thomie, carter

Differential Revision:

4 years agoUpdate documentation for "Batch compiler mode"
Thomas Miedema [Wed, 19 Nov 2014 04:18:43 +0000 (22:18 -0600)] 
Update documentation for "Batch compiler mode"

Since commit 7828bf3ea2ea34e7a3a8662f5f621ef706ffee5c
* --make is the default
* -c is a mode flag, except when used in combination with --make

* -C (generate C code) is only available in unregisterised mode.

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, carter

Differential Revision:

4 years agoRefactor: use System.FilePath.splitSearchPath
Thomas Miedema [Wed, 19 Nov 2014 04:17:47 +0000 (22:17 -0600)] 
Refactor: use System.FilePath.splitSearchPath

To address #2521 ("Trailing colon on GHC_PACKAGE_PATH doesn't work with
ghc-pkg"), we were using a custom version of splitSearchPath (e4f46f5de). This
solution however caused issue #9698 ("GHC_PACKAGE_PATH should be more lenient
for empty paths").

This patch reverts back to System.FilePath.splitSearchPath (fixes #9698) and
adresses (#2521) by testing for a trailing search path separators explicitly
(instead of implicitly using empty search path elements).

Empty paths are now allowed (ignored on Windows, interpreted as current
directory on Posix systems), and trailing path separator still tack on the
user and system package databases.

Also update submodule filepath, which has a version of splitSearchPath which
handles quotes in the same way as our custom version did.

Test Plan:
$ GHC_PACKAGE_PATH=/::/home: ./ghc-pkg list
db stack: ["/",".","/home","<userdb>","<systemdb>"]

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, carter, simonmar

Differential Revision:

GHC Trac Issues: #2521, #9698

4 years agoThe test runner now also works under the msys-native Python.
Gintautas Miliauskas [Mon, 22 Sep 2014 21:10:56 +0000 (23:10 +0200)] 
The test runner now also works under the msys-native Python.

Msys binaries apply heuristics to escape paths in arguments intended for
non-msys binaries, which breaks timeout invocations, see #9626.

Signed-off-by: Austin Seipp <>
4 years agorts: remove old-style field designator extension (#9396)
Austin Seipp [Wed, 19 Nov 2014 03:21:47 +0000 (21:21 -0600)] 
rts: remove old-style field designator extension (#9396)

Authored-by: jrp
Signed-off-by: Austin Seipp <>
4 years agoOptimise `Identity` instances with `coerce`
Herbert Valerio Riedel [Wed, 19 Nov 2014 10:44:37 +0000 (11:44 +0100)] 
Optimise `Identity` instances with `coerce`

This also overrides all optional `Foldable` methods
(which would otherwise be default-implemented in terms of `foldMap`)
with supposedly optimally minimal implementations.

While at it, this also removes the redundant `{-# LANGUAGE CPP #-}`.

Reviewed By: austin, dfeuer

Differential Revision:

4 years agoRestore exact old semantics of `decodeFloat`
Herbert Valerio Riedel [Wed, 19 Nov 2014 10:09:33 +0000 (11:09 +0100)] 
Restore exact old semantics of `decodeFloat`

`integer-gmp2` uses the new 64bit-based IEEE deconstructing primop
introduced in b62bd5ecf3be421778e4835010b6b334e95c5a56.

However, the returned values differ for exceptional IEEE values:

Previous (expected) semantics:

  > decodeFloat (-1/0)

  > decodeFloat (1/0)

  > decodeFloat (0/0)

Currently (broken) semantics:

  > decodeFloat (-1/0 :: Double)

  > decodeFloat (1/0 :: Double)

  > decodeFloat (0/0 :: Double)

This patch reverts to the old expected semantics.

I plan to revisit the implementation during GHC 7.11 development.

This should address #9810

Reviewed By: austin, ekmett, luite

Differential Revision:

4 years agoReimplement im/export primitives for integer-gmp2
Herbert Valerio Riedel [Tue, 18 Nov 2014 15:52:02 +0000 (16:52 +0100)] 
Reimplement im/export primitives for integer-gmp2

The import/export operations were available in `integer-gmp-0.5.1`
already, but need to be reimplemented from scratch for the
`integer-gmp-1.0.0` rewrite.

This also adds a few more operations than were previously available for
use w/ the `BigNat` type (which will be useful for implementing
serialisation for the upcoming `Natural` type)

Specifically, the following operations are (re)added (albeit with
slightly different type-signatures):

 - `sizeInBaseBigNat`
 - `sizeInBaseInteger`
 - `sizeInBaseWord#`

 - `exportBigNatToAddr`
 - `exportIntegerToAddr`
 - `exportWordToAddr`
 - `exportBigNatToMutableByteArray`
 - `exportIntegerToMutableByteArray`
 - `exportWordToMutableByteArray`

 - `importBigNatFromAddr`
 - `importIntegerFromAddr`
 - `importBigNatFromByteArray`
 - `importIntegerFromByteArray`

NOTE: The `integerGmpInternals` test-case is updated but not yet
      re-enabled as it contains tests for other primitives which aren't
      yet reimplemented.

This addresses #9281

Reviewed By: austin, duncan

Differential Revision:

4 years agoSupport for "with" renaming syntax, and output a feature flag.
Edward Z. Yang [Mon, 11 Aug 2014 17:40:13 +0000 (18:40 +0100)] 
Support for "with" renaming syntax, and output a feature flag.

- Feature flag indicates to Cabal that we support thinning and renaming as
  it needs.

- Support -package "base with (Foo as Bar)" which brings the ordinary
  modules into scope, as well as adding the renamings to scope.

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

Reviewers: simonpj, austin

Subscribers: thomie, carter

Differential Revision:

4 years agoWhen outputting list of available instances, sort it.
Edward Z. Yang [Tue, 11 Nov 2014 00:25:58 +0000 (16:25 -0800)] 
When outputting list of available instances, sort it.

The intent of this commit is to make test suite cases more stable, so that
it doesn't matter what order we load interface files in, the test output
doesn't change.

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

Reviewers: simonpj, austin

Subscribers: thomie, carter

Differential Revision:

4 years agoComments only
Simon Peyton Jones [Tue, 18 Nov 2014 22:27:01 +0000 (22:27 +0000)] 
Comments only

4 years agoRevert "base: Fix (**) instance for Data.Complex (#8539)"
Austin Seipp [Tue, 18 Nov 2014 19:12:12 +0000 (13:12 -0600)] 
Revert "base: Fix (**) instance for Data.Complex (#8539)"

This broke validate due to name shadowing warnings.

This reverts commit 1f6b1ab4b6d7203481bfaf374b014972f7756fb2.

4 years agoFix detection of GNU gold linker if invoked via gcc with parameters
Sebastian Dröge [Tue, 18 Nov 2014 18:40:20 +0000 (12:40 -0600)] 
Fix detection of GNU gold linker if invoked via gcc with parameters

Previously the linker was called without any commandline parameters to
detect whether bfd or gold is used. However the -fuse-ld parameter can
be used to switch between gold and bfd and should be taken into account

Trac #9336

Signed-off-by: Austin Seipp <>
4 years agoDisable AVX for LLVM 3.2 by default (#9391)
Peter Wortmann [Tue, 18 Nov 2014 18:33:05 +0000 (12:33 -0600)] 
Disable AVX for LLVM 3.2 by default (#9391)

Due to a bug LLVM generates a C-like frame pointer prelude for functions
that use AVX instructions. This causes programs using the GHC calling
convention to crash, therefore we simply disable them. People that want
to use AVX should consider upgrading to a more current LLVM version.

Signed-off-by: Austin Seipp <>
4 years agomapMaybe: Typo in the comment (#9644)
Wieland Hoffmann [Sun, 28 Sep 2014 17:22:37 +0000 (19:22 +0200)] 
mapMaybe: Typo in the comment (#9644)

Signed-off-by: Austin Seipp <>
4 years agoFix usage of `find -perm` in aclocal.m4 (#9697)
Nicholas Hart [Tue, 18 Nov 2014 18:21:03 +0000 (12:21 -0600)] 
Fix usage of `find -perm` in aclocal.m4 (#9697)

Signed-off-by: Austin Seipp <>
4 years agoUpdate comment about C helper for foreign exports (#9713)
Bertram Felgenhauer [Tue, 18 Nov 2014 18:15:33 +0000 (12:15 -0600)] 
Update comment about C helper for foreign exports (#9713)

Signed-off-by: Austin Seipp <>
4 years agobase: Fix (**) instance for Data.Complex (#8539)
Austin Seipp [Tue, 18 Nov 2014 18:10:34 +0000 (12:10 -0600)] 
base: Fix (**) instance for Data.Complex (#8539)

Reviewed-by: Edward Kmett <>
Authored-by: Yalas, Scott Turner
Signed-off-by: Austin Seipp <>
4 years agoAdd missing semicolon in Schedule.c
Simon Peyton Jones [Tue, 18 Nov 2014 17:07:41 +0000 (17:07 +0000)] 
Add missing semicolon in Schedule.c

I think this went wrong in 2a6f193b

4 years agoOutputable instance for IfaceVectInfo
Mateusz Kowalczyk [Tue, 18 Nov 2014 16:58:56 +0000 (16:58 +0000)] 
Outputable instance for IfaceVectInfo

4 years agoWhitespace only
Mateusz Kowalczyk [Tue, 18 Nov 2014 16:58:45 +0000 (16:58 +0000)] 
Whitespace only

4 years agoFix ffi023
Simon Marlow [Tue, 18 Nov 2014 15:40:45 +0000 (15:40 +0000)] 
Fix ffi023

4 years agoBuild xhtml and haddock only when `HADDOCK_DOCS=YES`
Joachim Breitner [Tue, 18 Nov 2014 09:44:23 +0000 (10:44 +0100)] 
Build xhtml and haddock only when `HADDOCK_DOCS=YES`

This fixes #8558

4 years agoAdd a note why tcGetInstEnvs is duplicated.
Edward Z. Yang [Thu, 6 Nov 2014 04:57:03 +0000 (20:57 -0800)] 
Add a note why tcGetInstEnvs is duplicated.

Signed-off-by: Edward Z. Yang <>
4 years agoRemove optimized package lookup, simplifying code.
Edward Z. Yang [Sat, 15 Nov 2014 09:43:42 +0000 (01:43 -0800)] 
Remove optimized package lookup, simplifying code.

A while back when I was refactoring the package code, I tried to solve
a performance problem by introducing a fastpath for module lookups.  Well,
it turned out the performance problem was unrelated, but I kept the optimization
because it seemed vaguely useful.

In this commit, I remove the optimization because I don't really think it's
buying us much and it increased code complexity.

ToDo: Inline mkModuleToPkgConfGeneric into mkModuleToPkgConfAll

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

Reviewers: simonpj, austin

Reviewed By: austin

Subscribers: thomie, carter

Differential Revision:

4 years agoChange a comment referring falsely to seq
David Feuer [Tue, 18 Nov 2014 01:19:18 +0000 (19:19 -0600)] 
Change a comment referring falsely to seq

Summary: Instead, describe what it actually does.

Reviewers: austin, ekmett, simonpj, hvr

Reviewed By: austin, ekmett

Subscribers: simonpj, thomie, carter

Projects: #ghc

Differential Revision:

4 years agoAdding dedicated Show instances for SrcSpan/SrcLoc
Alan Zimmerman [Tue, 18 Nov 2014 01:19:10 +0000 (19:19 -0600)] 
Adding dedicated Show instances for SrcSpan/SrcLoc

The derived Show instances for SrcSpan and SrcLoc are very verbose.

This patch replaces them with hand-made ones which use positional
syntax for the record constructors, rather than exhaustively listing
each one.

Test Plan: sh ./validate

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, carter

Differential Revision:

4 years agoDocs only
Edward Z. Yang [Tue, 18 Nov 2014 01:19:00 +0000 (19:19 -0600)] 
Docs only

Summary: Signed-off-by: Edward Z. Yang <>

Test Plan: n/a

Reviewers: austin, Mikolaj

Reviewed By: austin, Mikolaj

Subscribers: thomie, carter

Differential Revision:

4 years agoMake listArray fuse
David Feuer [Tue, 18 Nov 2014 01:16:16 +0000 (19:16 -0600)] 
Make listArray fuse

Summary: Make listArray fuse with a list producer. Note: if code size increases too much, we can fix that with some `RULES`.

Reviewers: nomeata, hvr, austin, ekmett, simonmar, bgamari

Reviewed By: bgamari

Subscribers: bgamari, thomie, carter

Differential Revision:

GHC Trac Issues: #9801

4 years agoRemove outdated TODO in TimeManager
Yuras Shumovich [Tue, 18 Nov 2014 01:16:08 +0000 (19:16 -0600)] 
Remove outdated TODO in TimeManager

It describes a work around Trac #3838, but it is already fixed and the
workaround removed, Trac #7653

Test Plan: not needed

Reviewers: hvr, Mikolaj, austin

Reviewed By: austin

Subscribers: thomie, carter

Differential Revision:

4 years agoDon't use absolute paths for perl in validate
Mateusz Kowalczyk [Tue, 18 Nov 2014 01:15:59 +0000 (19:15 -0600)] 
Don't use absolute paths for perl in validate

Summary: This will *not* work on NixOS for example.

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, carter

Differential Revision:

GHC Trac Issues: #9057

4 years agodocument addDependentFile uses contents, not mtime
Greg Weber [Tue, 18 Nov 2014 01:15:51 +0000 (19:15 -0600)] 
document addDependentFile uses contents, not mtime

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, carter

Differential Revision:

GHC Trac Issues: #4900

4 years agoFix a bug introduced with allocation counters
Simon Marlow [Mon, 17 Nov 2014 13:03:56 +0000 (13:03 +0000)] 
Fix a bug introduced with allocation counters

4 years agoUpdate validate settings now that containers and process have been
David Terei [Mon, 17 Nov 2014 02:29:58 +0000 (18:29 -0800)] 
Update validate settings now that containers and process have been
updated to handle `-fwarn-trustworthy-safe`.

4 years agoFix compilation of `integer-gmp2` with `-O0`
Herbert Valerio Riedel [Sat, 15 Nov 2014 17:05:58 +0000 (18:05 +0100)] 
Fix compilation of `integer-gmp2` with `-O0`

At optimization level `-O0` `wordToInteger` wasn't inlined, and this caused a
`__integer` literal to turn up in final Core, which would trigger the GHC panic

  ghc-stage1: panic! (the 'impossible' happened)
    (GHC version 7.9.20141114 for x86_64-unknown-linux):
Can't use Integer in integer-*

By forcing inlining via `inline` this is avoided.
This should hopefully address #9800.

4 years agoUpdate to (unreleased) `deepseq-`
Herbert Valerio Riedel [Sat, 15 Nov 2014 11:16:38 +0000 (12:16 +0100)] 
Update to (unreleased) `deepseq-`

This pulls in the new `Generic`-based `-XDefaultSignature`-based default
implementation for `rnf`[1], and will be interesting to use in combination
with the soon to be merged `-XDeriveAnyClass` extension.

This requires updating several other submodules as well in order
to relax the upper bound on `deepseq` and/or in a few cases to
avoid relying on the default method implementation of `rnf`:

 - `Cabal`
 - `bytestring`
 - `containers`
 - `parallel`
 - `process`
 - `time`


4 years agoWorkaround 452d6aa95b7 breaking TrustworthySafe03
Herbert Valerio Riedel [Sat, 15 Nov 2014 10:18:12 +0000 (11:18 +0100)] 
Workaround 452d6aa95b7 breaking TrustworthySafe03

This is only a temporary kludge until the issue workarounded by 452d6aa95b7
gets properly fixed

4 years agoGeneralize exposed-modules field in installed package database
Edward Z. Yang [Sat, 15 Nov 2014 08:08:53 +0000 (00:08 -0800)] 
Generalize exposed-modules field in installed package database

Instead of recording exposed-modules and reexported-modules as seperate
fields in the installed package database, this commit merges them into
a single field (exposed-modules).  The motivation for this change is
in preparation for the inclusion of *signatures* into the installed
package database, which may also be reexported.  Merging the representation
means that we can treat reexports uniformly, no matter if they're a normal
module or a signature.

This commit adds a stub for signatures, but that code isn't wired up to
anything yet.

Contains Cabal submodule update to accommodate these changes.

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

Reviewers: simonpj, duncan, austin

Subscribers: thomie, carter, simonmar

Differential Revision:

4 years agoPartially revert 475dd93efa
Austin Seipp [Fri, 14 Nov 2014 17:51:31 +0000 (11:51 -0600)] 
Partially revert 475dd93efa

This introduces ./validate failures for Windows right now, so in the
mean time let's just back this flag out as a default -Wall flag.

Signed-off-by: Austin Seipp <>
4 years agoUpdate .mailmap
Thomas Miedema [Sat, 8 Nov 2014 12:44:57 +0000 (13:44 +0100)] 
Update .mailmap

[skip ci]

4 years agoImplement amap/coerce for Array (re #9796)
David Feuer [Thu, 13 Nov 2014 20:12:05 +0000 (21:12 +0100)] 
Implement amap/coerce for Array (re #9796)

Implement an `amap`/`coerce` rule in `GHC.Arr` to match the
`map`/`coerce` rule in GHC.Base.

In order to do so, delay inlining `amap` until phase 1.

To prevent the inlining delay from causing major inefficiencies due to
missed list fusion, rewrite `amap` to avoid relying on list fusion. This
has the extra benefit of reducing the size of the compiled amap code by
skipping the impossible case of an array with a negative size.

Reviewed By: nomeata

Differential Revision:

4 years agoWhen calling the success continuation of a matcher, pass existential tyvars
Dr. ERDI Gergo [Thu, 13 Nov 2014 09:47:18 +0000 (17:47 +0800)] 
When calling the success continuation of a matcher, pass existential tyvars
as type arguments, not value arguments

4 years agonlHsTyApps: for applying a function both on type- and term-level arguments
Dr. ERDI Gergo [Fri, 7 Nov 2014 14:49:52 +0000 (22:49 +0800)] 
nlHsTyApps: for applying a function both on type- and term-level arguments

4 years agoApply compulsory unfoldings during desugaring, except for `seq` which is special.
Dr. ERDI Gergo [Wed, 12 Nov 2014 10:18:09 +0000 (18:18 +0800)] 
Apply compulsory unfoldings during desugaring, except for `seq` which is special.
See Note [Unfolding while desugaring] for the rationale.

4 years agoIf pattern synonym is bidirectional and its type is some unboxed type T#,
Dr. ERDI Gergo [Sat, 8 Nov 2014 10:38:12 +0000 (18:38 +0800)] 
If pattern synonym is bidirectional and its type is some unboxed type T#,
generate a worker function of type Void# -> T#, and redirect the wrapper
(via a compulsory unfolding) to the worker. Fixes #9732.

4 years agoBinding things matched by an unboxed pattern synonym should require a bang
Dr. ERDI Gergo [Sat, 8 Nov 2014 08:59:47 +0000 (16:59 +0800)] 
Binding things matched by an unboxed pattern synonym should require a bang

4 years agoFix typo in panic message
Dr. ERDI Gergo [Thu, 6 Nov 2014 11:38:40 +0000 (19:38 +0800)] 
Fix typo in panic message

4 years agoFix `integer-gmp2` compilation with GMP 4.x (#9281)
Herbert Valerio Riedel [Thu, 13 Nov 2014 09:49:43 +0000 (10:49 +0100)] 
Fix `integer-gmp2` compilation with GMP 4.x (#9281)

GMP 4.x didn't provide the `mp_bitcnt_t` typedef yet, so we locally
define one if GMP 4.x is detected.

4 years agoImprove `Foldable` instance for `Array`
David Feuer [Thu, 13 Nov 2014 08:10:57 +0000 (09:10 +0100)] 
Improve `Foldable` instance for `Array`

Previously, `Array`s were simply converted to lists, and the list
methods used. That works acceptably well for `foldr` and `foldr1`, but
not so sensibly for most other things. Left folds ended up "twisted" the
way they are for lists, leading to surprising performance

Moreover, this implements `length` and `null` so they check the array
size directly.

Finally, a test is added to the testsuite ensuring the overridden
`Foldable` methods agree with their expected default semantics.

Addresses #9763

Reviewed By: hvr, austin

Differential Revision:

4 years agobase: define `sequence = mapM id`
David Feuer [Thu, 13 Nov 2014 08:05:22 +0000 (09:05 +0100)] 
base: define `sequence = mapM id`

This avoids duplication in `GHC.Base`; originally, we had

  mapM f = sequence . map f

This led to excessive allocation in `cryptarithm2`. Defining

  sequence = mapM id

does not appear to cause any `nofib` problems.

Reviewed By: hvr

Differential Revision:

4 years agoMake unwords and words fuse somewhat
David Feuer [Thu, 13 Nov 2014 07:59:14 +0000 (08:59 +0100)] 
Make unwords and words fuse somewhat

Make `words` a good producer and `unwords` a good consumer for list
fusion. Thus `unwords . words` will avoid producing an intermediate list
of words, although it will produce each individual word.

Make `unwords` slightly lazier, so that
`unwords (s : undefined) = s ++ undefined` instead of `= undefined`.

Reviewed By: austin

Differential Revision:

4 years agobase: Fix map/coerce comment
David Feuer [Thu, 13 Nov 2014 07:43:33 +0000 (08:43 +0100)] 
base: Fix map/coerce comment

Make the comment on the map/coerce rule refer to the right section in
the paper; give the full name of the papers, and name its authors.

[skip ci]

Differential Revision:

4 years agoUpdate userguide for new `-fwarn-trustworthy-safe` flag.
David Terei [Thu, 13 Nov 2014 02:39:01 +0000 (18:39 -0800)] 
Update userguide for new `-fwarn-trustworthy-safe` flag.

4 years agoAdd `--fwarn-trustworthy-safe` to `-Wall`
David Terei [Thu, 13 Nov 2014 00:11:39 +0000 (16:11 -0800)] 
Add `--fwarn-trustworthy-safe` to `-Wall`

Update submodule haskell2010, haskell98, hoop, hpc and stm to fix new

4 years agoAdd in `-fwarn-trustworthy-safe` flag.
David Terei [Fri, 7 Nov 2014 22:11:19 +0000 (14:11 -0800)] 
Add in `-fwarn-trustworthy-safe` flag.

This warns when a module marked as `-XTrustworthy` could have been
inferred as safe instead.

4 years agoRemove a stray Trustworthy flag in ghc.
David Terei [Wed, 12 Nov 2014 21:54:55 +0000 (13:54 -0800)] 
Remove a stray Trustworthy flag in ghc.

4 years agoincludes/Stg.h: define _DEFAULT_SOURCE for glibc-2.20
Sergei Trofimovich [Wed, 12 Nov 2014 23:18:38 +0000 (23:18 +0000)] 
includes/Stg.h: define _DEFAULT_SOURCE for glibc-2.20

_BSD_SOURCE we are using for 'gamma()' and friends
was deprecated in glibc-2.20 in favour of '_DEFAULT_SOURCE'.

gcc says:

    In file included from /usr/include/math.h:26:0:
                         from includes/Stg.h:69,
                         from /tmp/ghc19488_0/ghc19488_2.hc:3:

         warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
         # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"

Patch fixes testsuite failures on UNREG
(stderr are not cluttered by warnings anymore).

Signed-off-by: Sergei Trofimovich <>
4 years agoFix #9404 by removing tcInfExpr.
Richard Eisenberg [Tue, 11 Nov 2014 02:27:58 +0000 (21:27 -0500)] 
Fix #9404 by removing tcInfExpr.

See the ticket for more info about the new algorithm. This is a small
simplification, unifying the treatment of type checking in a few
similar situations.

4 years agoTestsuite wibble due to #9404
Richard Eisenberg [Tue, 11 Nov 2014 12:58:03 +0000 (07:58 -0500)] 
Testsuite wibble due to #9404

[skip ci]

4 years agoTest #9404 (typecheck/should_compile/T9404 and T9404b)
Richard Eisenberg [Thu, 7 Aug 2014 13:20:41 +0000 (09:20 -0400)] 
Test #9404 (typecheck/should_compile/T9404 and T9404b)

4 years agoFix #9788 by giving `coerce` the right type.
Richard Eisenberg [Tue, 11 Nov 2014 01:41:38 +0000 (20:41 -0500)] 
Fix #9788 by giving `coerce` the right type.

No test case added, as the original mistake is just one level
up from a typo.

4 years agoTestsuite wibbles due to #9204
Richard Eisenberg [Fri, 7 Nov 2014 21:32:39 +0000 (16:32 -0500)] 
Testsuite wibbles due to #9204

4 years agoFix #9204 by outputting extra info on boot file mismatch.
Richard Eisenberg [Wed, 5 Nov 2014 15:52:57 +0000 (10:52 -0500)] 
Fix #9204 by outputting extra info on boot file mismatch.

[skip ci] -- testsuite wibbles are in next commit

4 years agoTest #9204 in roles/should_fail/T9204
Richard Eisenberg [Tue, 4 Nov 2014 22:40:06 +0000 (17:40 -0500)] 
Test #9204 in roles/should_fail/T9204

4 years agoFix #9064 by adding support for generic default signatures to TH.
Richard Eisenberg [Tue, 4 Nov 2014 21:38:22 +0000 (16:38 -0500)] 
Fix #9064 by adding support for generic default signatures to TH.

4 years agoTest #9064 in th/T9064
Richard Eisenberg [Tue, 4 Nov 2014 20:28:40 +0000 (15:28 -0500)] 
Test #9064 in th/T9064

4 years agoFix #8100, by adding StandaloneDerivD to TH's Dec type.
Richard Eisenberg [Tue, 4 Nov 2014 20:24:33 +0000 (15:24 -0500)] 
Fix #8100, by adding StandaloneDerivD to TH's Dec type.

4 years agoTest #8100 in th/T8100
Richard Eisenberg [Tue, 4 Nov 2014 20:15:56 +0000 (15:15 -0500)] 
Test #8100 in th/T8100

4 years agoDerive Generic for TH types (#9527)
Richard Eisenberg [Tue, 4 Nov 2014 18:21:57 +0000 (13:21 -0500)] 
Derive Generic for TH types (#9527)

4 years agoRemove unboxed Int# fields from NameFlavour (#9527)
Richard Eisenberg [Tue, 4 Nov 2014 18:03:48 +0000 (13:03 -0500)] 
Remove unboxed Int# fields from NameFlavour (#9527)

4 years agoUntabify template-haskell.
Richard Eisenberg [Tue, 4 Nov 2014 18:43:17 +0000 (13:43 -0500)] 
Untabify template-haskell.

4 years agoFix #9066.
Richard Eisenberg [Mon, 3 Nov 2014 16:15:35 +0000 (11:15 -0500)] 
Fix #9066.

When splicing in a fixity declaration, look for both term-level things
and type-level things. This requires some changes elsewhere in the
code to allow for more flexibility when looking up Exact names, which
can be assigned the wrong namespace during fixity declaration

See the ticket for more info.

4 years agoTest #9066 in th/T9066
Richard Eisenberg [Sun, 2 Nov 2014 18:44:27 +0000 (13:44 -0500)] 
Test #9066 in th/T9066

4 years agofix allocLimit3 on Windows
Simon Marlow [Thu, 6 Nov 2014 16:42:49 +0000 (16:42 +0000)] 
fix allocLimit3 on Windows

4 years agoFix build errors on Windows (these tests still don't work though)
Simon Marlow [Wed, 5 Nov 2014 18:05:10 +0000 (18:05 +0000)] 
Fix build errors on Windows (these tests still don't work though)

4 years agoPer-thread allocation counters and limits
Simon Marlow [Tue, 14 Oct 2014 23:03:15 +0000 (00:03 +0100)] 
Per-thread allocation counters and limits

This reverts commit f0fcc41d755876a1b02d1c7c79f57515059f6417.

New changes: now works on 32-bit platforms too.  I added some basic
support for 64-bit subtraction and comparison operations to the x86

4 years agoImplement new integer-gmp2 from scratch (re #9281)
Herbert Valerio Riedel [Sun, 19 Oct 2014 18:37:40 +0000 (20:37 +0200)] 
Implement new integer-gmp2 from scratch (re #9281)

This is done as a separate `integer-gmp2` backend library because it
turned out to become a complete rewrite from scratch.

Due to the different (over)allocation scheme and potentially different
accounting (via the new `{shrink,resize}MutableByteArray#` primitives),
some of the nofib benchmarks actually results in increased allocation
numbers (but not necessarily an increase in runtime!).  I believe the
allocation numbers could improve if `{resize,shrink}MutableByteArray#`
could be optimised to reallocate in-place more efficiently.

Here are the more apparent changes in the latest nofib comparision
between `integer-gmp` and `integer-gmp2`:

          Program     Size    Allocs   Runtime   Elapsed  TotalMem
       bernouilli    +1.6%    +15.3%     0.132     0.132      0.0%
     cryptarithm1    -2.2%      0.0%     -9.7%     -9.7%      0.0%
            fasta    -0.7%     -0.0%    +10.9%    +10.9%      0.0%
            kahan    +0.6%    +38.9%     0.169     0.169      0.0%
             lcss    -0.7%     -0.0%     -6.4%     -6.4%      0.0%
           mandel    +1.6%    +33.6%     0.049     0.049      0.0%
         pidigits    +0.8%     +8.5%     +3.9%     +3.9%      0.0%
            power    +1.4%    -23.8%    -18.6%    -18.6%    -16.7%
        primetest    +1.3%    +50.1%     0.085     0.085      0.0%
              rsa    +1.6%    +53.4%     0.026     0.026      0.0%
              scs    +1.2%     +6.6%     +6.5%     +6.6%    +14.3%
           symalg    +1.0%     +9.5%     0.010     0.010      0.0%
        transform    -0.6%     -0.0%     -5.9%     -5.9%      0.0%
              Min    -2.3%    -23.8%    -18.6%    -18.6%    -16.7%
              Max    +1.6%    +53.4%    +10.9%    +10.9%    +14.3%
   Geometric Mean    -0.3%     +1.9%     -0.8%     -0.8%     +0.0%

(see P35 / for full report)

By default, `INTEGER_LIBRARY=integer-gmp2` is active now, which results
in the package `integer-gmp-` being registered in the package db.
The previous `integer-gmp-` can be restored by setting
`INTEGER_LIBRARY=integer-gmp` (but will probably be removed altogether
for GHC 7.12). In-tree GMP support has been stolen from the old
`integer-gmp` (while unpatching the custom memory-allocators, as well as
forcing `-fPIC`)

A minor hack to `ghc-cabal` was necessary in order to support two different
`integer-gmp` packages (in different folders) with the same package key.

There will be a couple of follow-up commits re-implementing some features
that were dropped to keep D82 minimal, as well as further

More information can be found via #9281 and

Reviewed By: austin, rwbarton, simonmar

Differential Revision:

4 years agoDisable T4801/peak_megabytes_allocated
Herbert Valerio Riedel [Sun, 9 Nov 2014 20:54:43 +0000 (21:54 +0100)] 
Disable T4801/peak_megabytes_allocated

This test seems too close to a tipping point (and thus too sensitive to the
build-env used) and T4801's `max_bytes_used` was disabled as well some time
ago for a similiar reason.

4 years agoAdd stderr for T9662
Simon Peyton Jones [Tue, 11 Nov 2014 15:14:20 +0000 (15:14 +0000)] 
Add stderr for T9662

4 years agoTest Trac #7862
Simon Peyton Jones [Tue, 11 Nov 2014 13:06:21 +0000 (13:06 +0000)] 
Test Trac #7862

4 years agoTest Trac #9077
Simon Peyton Jones [Tue, 11 Nov 2014 11:46:52 +0000 (11:46 +0000)] 
Test Trac #9077

4 years agoImprove documentation of -ticky a little
Simon Peyton Jones [Tue, 11 Nov 2014 11:36:57 +0000 (11:36 +0000)] 
Improve documentation of -ticky a little

4 years agoComments only
Simon Peyton Jones [Tue, 11 Nov 2014 11:36:16 +0000 (11:36 +0000)] 
Comments only

4 years agoTest Trac #9662
Simon Peyton Jones [Tue, 11 Nov 2014 11:35:48 +0000 (11:35 +0000)] 
Test Trac #9662

4 years agoComments only (on recursive dictionaries)
Simon Peyton Jones [Tue, 11 Nov 2014 10:27:51 +0000 (10:27 +0000)] 
Comments only (on recursive dictionaries)

4 years agoDe-bias Data.Foldable and improve docstrings
David Feuer [Tue, 11 Nov 2014 07:35:37 +0000 (08:35 +0100)] 
De-bias Data.Foldable and improve docstrings

Use fewer left/right-biased folds for defaults and
functions in `Data.Foldable`, to better support things
that don't look like cons lists.

This also extends the Haddock docstrings in `Data.Foldable`.

Reviewed By: hvr, ekmett

Differential Revision:

4 years agoDefine list monad operations using comprehensions
David Feuer [Tue, 11 Nov 2014 06:59:34 +0000 (07:59 +0100)] 
Define list monad operations using comprehensions

Define list monad operations using list comprehensions. Code using monad
operations with lists did not fuse fully. Writing list code with `do`
notation or `(>>=)` and `(>>)` operations could allocate more than
equivalent code using list comprehensions.

Define `mapM` directly, instead of using `sequence` and `map`. This
leads to substantially less allocation in `cryptarithm2`.

Addresses #9781

Reviewed By: ekmett, nomeata

Differential Revision:

4 years agoTypo fix; Trac #9787
Austin Seipp [Mon, 10 Nov 2014 21:13:26 +0000 (15:13 -0600)] 
Typo fix; Trac #9787

Also, reword :print description.

Signed-off-by: Austin Seipp <>
4 years agoMove Data.Functor.Identity from transformers to base
Herbert Valerio Riedel [Sun, 5 Oct 2014 13:18:49 +0000 (15:18 +0200)] 
Move Data.Functor.Identity from transformers to base

This also updates the `transformers` submodule to the just
released `transformers-` package version.

See #9664 for more details

Reviewed By: austin, ekmett

Differential Revision:

4 years agoUse (.) and id from Base in Control.Applicative
David Feuer [Sat, 8 Nov 2014 20:43:27 +0000 (21:43 +0100)] 
Use (.) and id from Base in Control.Applicative

Control.Applicative previously imported `(.)` and `id` from `Control.Arrow`,
but then only applied them to functions.

Reviewed By: ekmett, hvr

Differential Revision:

4 years agoUnlit overlooked GHC/Conc/Sync.lhs
Herbert Valerio Riedel [Sat, 8 Nov 2014 14:13:59 +0000 (15:13 +0100)] 
Unlit overlooked GHC/Conc/Sync.lhs

This is a follow-up commit to df3b1d43cc862fe03f0724a9c0ac9e7cecdf4605

4 years agoGroup PatSyn req/prov arguments together so that they're not all over the place
Dr. ERDI Gergo [Thu, 6 Nov 2014 11:01:38 +0000 (19:01 +0800)] 
Group PatSyn req/prov arguments together so that they're not all over the place

4 years agoIn pattern synonym matchers, support unboxed continuation results (fixes #9783).
Dr. ERDI Gergo [Sat, 8 Nov 2014 04:24:55 +0000 (12:24 +0800)] 
In pattern synonym matchers, support unboxed continuation results (fixes #9783).

This requires ensuring the continuations have arguments by adding a dummy
Void# argument when needed. This is so that matching on a pattern synonym
is lazy even when the result is unboxed, e.g.

    pattern P = ()
    f P = 0#

In this case, without dummy arguments, the generated matcher's type would be

   $mP :: forall (r :: ?). () -> r -> r -> r

which is called in `f` at type `() -> Int# -> Int# -> Int#`,
so it would be strict, in particular, in the failure continuation
of `patError`.

We work around this by making sure both continuations have arguments:

  $mP :: forall (r :: ?). () -> (Void# -> r) -> (Void# -> r) -> r

Of course, if `P` (and thus, the success continuation) has any arguments,
we are only adding the extra dummy argument to the failure continuation.