5 years agoReplace obsolete `defaultUserHooks` by `autoconfUserHooks`
Herbert Valerio Riedel [Sat, 27 Sep 2014 07:57:24 +0000 (09:57 +0200)] 
Replace obsolete `defaultUserHooks` by `autoconfUserHooks`

This also updates a few submodules

5 years agoUpdate Cabal submodule to latest master branch tip
Herbert Valerio Riedel [Fri, 26 Sep 2014 19:42:55 +0000 (21:42 +0200)] 
Update Cabal submodule to latest master branch tip

5 years agoDon't re-export `Alternative(..)` from Control.Monad (re #9586)
Herbert Valerio Riedel [Fri, 26 Sep 2014 19:09:56 +0000 (21:09 +0200)] 
Don't re-export `Alternative(..)` from Control.Monad (re #9586)

This was done in d94de87252d0fe2ae97341d186b03a2fbe136b04 to avoid orphans
but since a94dc4c3067c6a0925e2e39f35ef0930771535f1 moved `Alternative`
into GHC.Base, this isn't needed anymore.

This is important, as otherwise this would require a non-neglectable amount
of `Control.Monad hiding ((<|>), empty)` imports in user code.

The Haddock submodule is updated as well

Test Plan: partial local ./validate --fast, let Harbormaster doublecheck it

Reviewed By: ekmett, austin

Differential Revision:

5 years agoUpdate `unix` submodule to disable getlogin tests
Herbert Valerio Riedel [Fri, 26 Sep 2014 17:36:28 +0000 (19:36 +0200)] 
Update `unix` submodule to disable getlogin tests

5 years agoComments
Simon Peyton Jones [Fri, 26 Sep 2014 13:42:40 +0000 (14:42 +0100)] 

5 years agoThis test should have -XDataKinds
Simon Peyton Jones [Fri, 26 Sep 2014 13:42:26 +0000 (14:42 +0100)] 
This test should have -XDataKinds

5 years agoDe-tabify and remove trailing whitespace
Simon Peyton Jones [Fri, 26 Sep 2014 11:58:41 +0000 (12:58 +0100)] 
De-tabify and remove trailing whitespace

5 years agoComplain about illegal type literals in renamer, not parser
Simon Peyton Jones [Fri, 26 Sep 2014 11:34:13 +0000 (12:34 +0100)] 
Complain about illegal type literals in renamer, not parser

A premature complaint was causing Trac #9634.  Acutally this
change also simplifies the lexer and eliminates duplication.
(The renamer was already making the check, as it happens.)

5 years agoTwo improved error messages
Simon Peyton Jones [Fri, 26 Sep 2014 09:54:23 +0000 (10:54 +0100)] 
Two improved error messages

I'm not quite sure why these have improved following the previous
four commits, but I'm quite happy about it

5 years agoImprove error messages from functional dependencies
Simon Peyton Jones [Fri, 26 Sep 2014 09:53:32 +0000 (10:53 +0100)] 
Improve error messages from functional dependencies

Reponding to Trac #9612:

 * Track the CtOrigin of a Derived equality, arising from a
   functional dependency

 * And report it clearly in the error stream

This relies on a previous commit, in which I stop dropping Derived
insolubles on the floor.

5 years agoWibble to implicit-parameter error message
Simon Peyton Jones [Fri, 26 Sep 2014 09:48:25 +0000 (10:48 +0100)] 
Wibble to implicit-parameter error message

5 years agoDo not discard insoluble Derived constraints
Simon Peyton Jones [Fri, 26 Sep 2014 09:44:46 +0000 (10:44 +0100)] 
Do not discard insoluble Derived constraints

This is preparing for a fix to Trac #9612. The idea is that insoluble
constraints are nice solid errors that we should not discard before
we have a chance to report them.  So TcRnTypes.dropDerivedWC now
keeps insoluble Derived constrains, and instead TcSimplify.solve_wanteds
filters them out

We get somewhat better error message for kind-equality failures too.

A slight downside is that to avoid *duplicate* kind-equality failures
when we float a kind-incompatible equality (e.g.  alpha:* ~ Int#),
I've disabled constraint-floating when there are insolubles.  But that
in turn makes a handful of error messages a little less informative;
good examples are mc21, mc22, mc25.  But I am re-jigging the
constraint floating machinery in another branch, which will make this
go back to the way it was before.

5 years agoDefer errors in derived instances
Simon Peyton Jones [Wed, 24 Sep 2014 10:22:52 +0000 (11:22 +0100)] 
Defer errors in derived instances

Fixes Trac #9576.  Turned out to be pretty easy.

5 years agoFixes cyclic import on OS X(#9635)
Dave Laing [Fri, 26 Sep 2014 04:11:01 +0000 (23:11 -0500)] 
Fixes cyclic import on OS X(#9635)

Summary: Signed-off-by: Dave Laing <>

Test Plan: Locally tested

Reviewers: thomie, austin

Reviewed By: thomie, austin

Subscribers: simonmar, ezyang, carter, thomie

Differential Revision:

GHC Trac Issues: #9635

5 years agoUser's Guide: various unfolding-related fixes
Reid Barton [Fri, 26 Sep 2014 04:10:50 +0000 (23:10 -0500)] 
User's Guide: various unfolding-related fixes

Test Plan: harbormaster

Reviewers: austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter, thomie

Differential Revision:

5 years agoDelete hack that was once needed to fix the build
Thomas Miedema [Fri, 26 Sep 2014 04:10:33 +0000 (23:10 -0500)] 
Delete hack that was once needed to fix the build

Introduced in 6c7b41cc2b24f533697a62bf1843507ae043fc97.

I checked the rest of that commit, and this is all that was left to revert.

Test Plan: x

Reviewers: ezyang, austin

Reviewed By: ezyang, austin

Subscribers: simonmar, ezyang, carter, thomie

Differential Revision:

5 years agoRefer to 'mask' instead of 'block' in Control.Exception
Thomas Miedema [Fri, 26 Sep 2014 04:10:18 +0000 (23:10 -0500)] 
Refer to 'mask' instead of 'block' in Control.Exception

Summary: More thorough version of a75383cdd46f7bb593639bc6d1628b068b78262a

Test Plan:
change of comments only

[skip ci]

Reviewers: austin, simonmar, ekmett

Reviewed By: austin, ekmett

Subscribers: simonmar, ezyang, carter

Differential Revision:

5 years agotypes: detabify/dewhitespace Unify
Austin Seipp [Fri, 26 Sep 2014 04:07:07 +0000 (23:07 -0500)] 
types: detabify/dewhitespace Unify

Signed-off-by: Austin Seipp <>
5 years ago[ci skip] typecheck: detabify/dewhitespace TcUnify
Austin Seipp [Fri, 26 Sep 2014 04:06:19 +0000 (23:06 -0500)] 
[ci skip] typecheck: detabify/dewhitespace TcUnify

Signed-off-by: Austin Seipp <>
5 years ago[ci skip] typecheck: detabify/dewhitespace TcTyDecls
Austin Seipp [Fri, 26 Sep 2014 04:05:54 +0000 (23:05 -0500)] 
[ci skip] typecheck: detabify/dewhitespace TcTyDecls

Signed-off-by: Austin Seipp <>
5 years ago[ci skip] typecheck: detabify/dewhitespace TcPat
Austin Seipp [Fri, 26 Sep 2014 04:05:34 +0000 (23:05 -0500)] 
[ci skip] typecheck: detabify/dewhitespace TcPat

Signed-off-by: Austin Seipp <>
5 years ago[ci skip] typecheck: detabify/dewhitespace TcInstDecls
Austin Seipp [Fri, 26 Sep 2014 04:05:20 +0000 (23:05 -0500)] 
[ci skip] typecheck: detabify/dewhitespace TcInstDecls

Signed-off-by: Austin Seipp <>
5 years ago[ci skip] simplCore: detabify/dewhitespace CoreMonad
Austin Seipp [Fri, 26 Sep 2014 04:04:38 +0000 (23:04 -0500)] 
[ci skip] simplCore: detabify/dewhitespace CoreMonad

Signed-off-by: Austin Seipp <>
5 years ago[ci skip] iface: detabify/dewhitespace IfaceSyn
Austin Seipp [Fri, 26 Sep 2014 04:03:53 +0000 (23:03 -0500)] 
[ci skip] iface: detabify/dewhitespace IfaceSyn

Signed-off-by: Austin Seipp <>
5 years agoUpdate `binary` submodule in an attempt to address #9630
Herbert Valerio Riedel [Thu, 25 Sep 2014 20:19:32 +0000 (22:19 +0200)] 
Update `binary` submodule in an attempt to address #9630

This removes a couple of `INLINE` pragmas from the generics helper
classes. With this change the compile times and memory usage should
go back to the previous GHC 7.8.3 situation.

This has been submitted upstream as

5 years agoDetab DataCon
Edward Z. Yang [Thu, 25 Sep 2014 09:39:12 +0000 (02:39 -0700)] 
Detab DataCon

Signed-off-by: Edward Z. Yang <>
5 years agoRemove a few redundant `-fno-warn-tabs`s
Herbert Valerio Riedel [Thu, 25 Sep 2014 06:49:02 +0000 (08:49 +0200)] 
Remove a few redundant `-fno-warn-tabs`s

5 years agoLink from to in the user guide.
Jan Stolarek [Thu, 25 Sep 2014 08:18:15 +0000 (10:18 +0200)] 
Link from to in the user guide.

This point the user that there is a relation between the
UndecibadleInstances flag and the type families, not just type

5 years agoUpdate time submodule to 1.5.0 release
Herbert Valerio Riedel [Wed, 24 Sep 2014 22:38:28 +0000 (00:38 +0200)] 
Update time submodule to 1.5.0 release

5 years ago`M-x delete-trailing-whitespace` & `M-x untabify`
Herbert Valerio Riedel [Wed, 24 Sep 2014 21:47:00 +0000 (23:47 +0200)] 
`M-x delete-trailing-whitespace` & `M-x untabify`

5 years ago`M-x delete-trailing-whitespace` & `M-x untabify`
Herbert Valerio Riedel [Wed, 24 Sep 2014 21:42:55 +0000 (23:42 +0200)] 
`M-x delete-trailing-whitespace` & `M-x untabify`

...several modules in `base` recently touched by me

5 years agoUpdate Cabal submodule & ghc-pkg to use new module re-export types
Edward Z. Yang [Tue, 23 Sep 2014 14:05:25 +0000 (16:05 +0200)] 
Update Cabal submodule & ghc-pkg to use new module re-export types

The main change is that Cabal changed the representation of module
re-exports to distinguish reexports in source .cabal files versus
re-exports in installed package registraion files.

Cabal now also does the resolution of re-exports to specific installed
packages itself, so ghc-pkg no longer has to do this. This is a cleaner
design overall because re-export resolution can fail so it is better to
do it during package configuration rather than package registration.
It also simplifies the re-export representation that ghc-pkg has to use.

Add extra ghc-pkg sanity check for module re-exports and duplicates

For re-exports, check that the defining package exists and that it
exposes the defining module (or for self-rexport exposed or hidden
modules). Also check that the defining package is actually a direct
or indirect dependency of the package doing the re-exporting.

Also add a check for duplicate modules in a package, including
re-exported modules.

Test Plan:
So far the sanity checks are totally untested. Should add some test
case to make sure the sanity checks do catch things correctly, and
don't ban legal things.

Reviewers: austin, duncan

Subscribers: angerman, simonmar, ezyang, carter

Differential Revision:

GHC Trac Issues:

5 years agoAdapt nofib submodule to #9586 changes
Herbert Valerio Riedel [Tue, 23 Sep 2014 21:46:11 +0000 (23:46 +0200)] 
Adapt nofib submodule to #9586 changes

5 years agoChange all hashbangs to /usr/bin/env (#9057)
Thomas Miedema [Tue, 23 Sep 2014 13:45:31 +0000 (08:45 -0500)] 
Change all hashbangs to /usr/bin/env (#9057)

git grep -l '#!' | xargs sed -i 's|#!.*/bin/\([^ ]*\)$|#!/usr/bin/env \1|'
and some manual tweaking

Test Plan: harbormaster

Reviewers: austin

Subscribers: hvr, simonmar, ezyang, carter

Differential Revision:

GHC Trac Issues: #9057

5 years agoDelete all /* ! __GLASGOW_HASKELL__ */ code
Thomas Miedema [Tue, 23 Sep 2014 13:44:45 +0000 (08:44 -0500)] 
Delete all /* ! __GLASGOW_HASKELL__ */ code

git grep -l '\(#ifdef \|#if defined\)(\?__GLASGOW_HASKELL__)\?'

Test Plan: validate

Reviewers: rwbarton, hvr, austin

Reviewed By: rwbarton, hvr, austin

Subscribers: rwbarton, simonmar, ezyang, carter

Differential Revision:

5 years agoDelete hack when takeDirectory returns ""
Thomas Miedema [Tue, 23 Sep 2014 13:44:02 +0000 (08:44 -0500)] 
Delete hack when takeDirectory returns ""

Since commits 8fe1f8 and bb6731 in the filepath packages (ticket #2034, closed
in 2010), takeDirectory "foo" returns ".", and not "", so this check is no
longer needed.

Other commits:
* Remove trailing whitespace
* Update comments for #2278

Test Plan: harbormaster

Reviewers: austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

GHC Trac Issues: #2034

5 years agoTest Trac #9565 and #9583
Simon Peyton Jones [Tue, 23 Sep 2014 11:09:07 +0000 (12:09 +0100)] 
Test Trac #9565 and #9583

5 years agoEnsure that loop breakers are computed when glomming
Simon Peyton Jones [Fri, 19 Sep 2014 13:51:54 +0000 (14:51 +0100)] 
Ensure that loop breakers are computed when glomming

This patch fixes Trac #9583, a loop in the simplifier.

I thought this was going to be very complicated but it turned out to
be very simple!  The occurrence analyser does something called
"glomming" if the application of imported RULES means that something
that didn't look recursive becomes recursive.  See `Note [Glomming]`
in `OccurAnal`.  Under these circumstances we group all the top-level
bindings into a single massive `Rec`.

But, crucially, I failed to repeat the occurrence analysis on this
glommed set of bindings.  That means that we weren't establishing the
right loop breakers (indeed there were no loop breakers whatsoever),
and that led immediately to the loop. The only surprising this is that
it didn't happen before.

5 years agoUpdate haskeline submodule to avoid -Werror failure
Herbert Valerio Riedel [Tue, 23 Sep 2014 06:42:55 +0000 (08:42 +0200)] 
Update haskeline submodule to avoid -Werror failure

This would occur only on Windows during `./validate`

5 years agoFix windows breakage from 5ed12810e0972b1e due to import cycles
Herbert Valerio Riedel [Mon, 22 Sep 2014 08:42:09 +0000 (10:42 +0200)] 
Fix windows breakage from 5ed12810e0972b1e due to import cycles

Refs #9586

5 years agoExport `Monoid(..)`/`Foldable(..)`/`Traversable(..)` from Prelude
Herbert Valerio Riedel [Sun, 21 Sep 2014 21:22:19 +0000 (23:22 +0200)] 
Export `Monoid(..)`/`Foldable(..)`/`Traversable(..)` from Prelude

This finally exposes also the methods of these 3 classes in the Prelude
in order to allow to define basic class instances w/o needing imports.

This almost completes the primary goal of #9586

NOTE: `fold`, `foldl'`, `foldr'`, and `toList` are not exposed yet,
      as they require upstream fixes for at least `containers` and
      `bytestring`, and are not required for defining basic instances.

Reviewed By: ekmett, austin

Differential Revision:

5 years agoGeneralise Data.List/Control.Monad to Foldable/Traversable
Herbert Valerio Riedel [Sun, 21 Sep 2014 17:15:46 +0000 (19:15 +0200)] 
Generalise Data.List/Control.Monad to Foldable/Traversable

This flips the switch and replaces the entities in
`Data.List`/`Control.Monad` conflicting with
`Data.{Foldable,Traversable}` with re-exports of the more general

As of this commit, the code below (which is also added as a test-case)
compiles w/o error.

    module XPrelude (module X) where

    import Control.Monad     as X
    import Data.Foldable     as X
    import Data.List         as X
    import Data.Monoid       as X
    import Data.Traversable  as X
    import Prelude           as X

This addresses #9568

Reviewed By: ekmett, austin

Differential Revision:

5 years agoMove `mapM` and `sequence` to GHC.Base and break import-cycles
Herbert Valerio Riedel [Sun, 21 Sep 2014 17:14:04 +0000 (19:14 +0200)] 
Move `mapM` and `sequence` to GHC.Base and break import-cycles

This simplifies the import graph and more importantly removes import
cycles that arise due to `Control.Monad` & `Data.List` importing
`Data.Traversable` (preparation for #9586)

Reviewed By: ekmett, austin

Differential Revision:

5 years agoMake libffi install into a predictable directory (#9620)
Reid Barton [Sun, 21 Sep 2014 12:53:37 +0000 (08:53 -0400)] 
Make libffi install into a predictable directory (#9620)

On some systems (depending on gcc multilib configuration) libffi
would install into libffi/build/inst/lib64 even though we configure
it with --libdir=libffi/build/inst/lib. There appears to be no way
to get libffi to install to a predictable directory "out of the box",
so we apply a small patch to This is the same fix used
in Gentoo's ebuild (

5 years agoUpdate haskell2010, haskell98, and array submodules
Herbert Valerio Riedel [Sun, 21 Sep 2014 09:27:08 +0000 (11:27 +0200)] 
Update haskell2010, haskell98, and array submodules

The changes are purely cleanups to improve forward compatibility
to help with the Foldable/Traversal changes ahead.

5 years agoSimplify import-graph a bit more
Herbert Valerio Riedel [Sun, 21 Sep 2014 08:46:19 +0000 (10:46 +0200)] 
Simplify import-graph a bit more

This is preparatory refactoring for avoiding import cycles
when `Data.Traversable` will be imported by `Control.Monad` and
`Data.List` for implementing #9586

5 years agoAdd missing changelog entries for current state of #9586
Herbert Valerio Riedel [Sat, 20 Sep 2014 21:58:12 +0000 (23:58 +0200)] 
Add missing changelog entries for current state of #9586

5 years agoGeneralise (some of) Data.List to Foldables (re #9568)
Herbert Valerio Riedel [Sat, 20 Sep 2014 21:50:06 +0000 (23:50 +0200)] 
Generalise (some of) Data.List to Foldables (re #9568)

This replaces the entities in Data.List conflicting with Data.Foldable
with re-exports of the generalised version from Data.Foldable.

As of this commit, the following compiles w/o error

    module XPrelude (module X) where

    import Control.Monad as X
    import Data.Foldable as X
    import Data.List as X
    import Prelude as X

Reviewed By: austin, dfeuer, ekmett

Differential Revision:

5 years agoTurn a few existing folds into `Foldable`-methods (#9621)
Herbert Valerio Riedel [Sat, 20 Sep 2014 21:43:23 +0000 (23:43 +0200)] 
Turn a few existing folds into `Foldable`-methods (#9621)

Turn `toList`, `elem`, `sum`, `product`, `maximum`, and `minimum` into
`Foldable` methods. This helps avoiding regressions (and semantic
differences) while implementing #9586

Reviewed By: austin, dfeuer, ekmett

Differential Revision:

5 years agoSet up framework for generalising Data.List to Foldables
Herbert Valerio Riedel [Sat, 20 Sep 2014 21:32:06 +0000 (23:32 +0200)] 
Set up framework for generalising Data.List to Foldables

This renames the Data.List module to Data.OldList, and puts a new
Data.List module into its place re-exporting all list functions.

The plan is to leave the monomorphic versions of the list functions in
Data.OldList to help smooth the transition.

The new Data.List module then will simply re-export entities from
Data.OldList and Data.Foldable.

This refactoring has been placed in a separate commit to be able to
better isolate any regressions caused by the actual list function
generalisations when implementing #9586

This also updates the haskell2010, haskell98, and array submodules

Reviewed By: austin, ekmett

Differential Revision:

5 years agoChange linker message verbosity to `-v2` (re #7863)
Herbert Valerio Riedel [Sat, 20 Sep 2014 19:23:28 +0000 (21:23 +0200)] 
Change linker message verbosity to `-v2` (re #7863)

With this change, the linker status logging output such as

    Loading package ghc-prim ... linking ... done.
    Loading package integer-gmp ... linking ... done.
    Loading package base ... linking ... done.

is suppressed unless verbosity level is `-v2` or higher. This is done
to reduce the compiler message noise when TH is involved, which can
reduce the visibiliy of compile warnings.

Reviewed By: ekmett, austin

Differential Revision:

5 years agoDeactive T4801 `max_bytes_used`-check & bump T3064 numbers
Herbert Valerio Riedel [Sat, 20 Sep 2014 19:19:28 +0000 (21:19 +0200)] 
Deactive T4801 `max_bytes_used`-check & bump T3064 numbers

T4801 is deactived for now because it's currently too volatile
and causes too much noise in Phabricator's CI

Reviewed By: austin

Differential Revision:

5 years agoFix potential `mingw32_HOST_OS` -Werror failure
Herbert Valerio Riedel [Sat, 20 Sep 2014 17:11:48 +0000 (19:11 +0200)] 
Fix potential `mingw32_HOST_OS` -Werror failure

5 years agoFix potential `mingw32_HOST_OS` breakage from eae19112462fe77
Herbert Valerio Riedel [Sat, 20 Sep 2014 15:37:24 +0000 (17:37 +0200)] 
Fix potential `mingw32_HOST_OS` breakage from eae19112462fe77

5 years agoTypos
Krzysztof Gogolewski [Fri, 19 Sep 2014 17:27:34 +0000 (19:27 +0200)] 

5 years agoDefine fixity for `Data.Foldable.{elem,notElem}`
Herbert Valerio Riedel [Fri, 19 Sep 2014 15:53:33 +0000 (17:53 +0200)] 
Define fixity for `Data.Foldable.{elem,notElem}`

This was probably just an oversight. With this change the fixity matches
that from `Data.List.{elem,notElem`}`.

Addresses #9610

Reviewed By: austin, ekmett

Differential Revision:

5 years agoFixup overlooked `unless` occurence
Herbert Valerio Riedel [Fri, 19 Sep 2014 14:49:20 +0000 (16:49 +0200)] 
Fixup overlooked `unless` occurence

This was broken in eae19112462fe77a3f1298bff12b409b205a581d

5 years agoClean up Coercible handling, and interaction of data families with newtypes
Simon Peyton Jones [Thu, 18 Sep 2014 15:19:55 +0000 (16:19 +0100)] 
Clean up Coercible handling, and interaction of data families with newtypes

This patch fixes Trac #9580, in which the Coercible machinery succeeded
even though the relevant data constructor was not in scope.

As usual I got dragged into a raft of refactoring changes,
all for the better.

* Delete TcEvidence.coercionToTcCoercion (now unused)

* Move instNewTyConTF_maybe, instNewTyCon_maybe to FamInst,
  and rename them to tcInstNewTyConTF_maybe, tcInstNewTyCon
  (They both return TcCoercions.)

* tcInstNewTyConTF_maybe also gets more convenient type,
  which improves TcInteract.getCoercibleInst

* Define FamInst.tcLookupDataFamInst, and use it in TcDeriv,
  (as well as in tcInstNewTyConTF_maybe)

* Improve error report for Coercible errors, when data familes
  are involved  Another use of tcLookupDataFamInst

* In TcExpr.tcTagToEnum, use tcLookupDataFamInst to replace
  local hacky code

* Fix Coercion.instNewTyCon_maybe and Type.newTyConInstRhs to deal
  with eta-reduced newtypes, using
  (new) Type.unwrapNewTyConEtad_maybe and (new) Type.applyTysX

Some small refactoring of TcSMonad.matchFam.

5 years agoWhite space only
Simon Peyton Jones [Thu, 18 Sep 2014 15:05:14 +0000 (16:05 +0100)] 
White space only

5 years agoDefine Util.leLength :: [a] -> [b] -> Bool
Simon Peyton Jones [Thu, 18 Sep 2014 15:04:41 +0000 (16:04 +0100)] 
Define Util.leLength :: [a] -> [b] -> Bool

5 years agoFix garbled comment wording
Simon Peyton Jones [Tue, 9 Sep 2014 12:00:18 +0000 (13:00 +0100)] 
Fix garbled comment wording

Thanks to Gabor for pointing this out

5 years agoTypo in comment in GHC.Generics
Simon Peyton Jones [Tue, 9 Sep 2014 11:58:25 +0000 (12:58 +0100)] 
Typo in comment in GHC.Generics

Fixes Trac #9523

5 years agoUse mapAccumL (refactoring only)
Simon Peyton Jones [Tue, 9 Sep 2014 11:57:04 +0000 (12:57 +0100)] 
Use mapAccumL (refactoring only)

Fixes Trac #9529

5 years agoSpelling error in flags.xml
Simon Peyton Jones [Tue, 9 Sep 2014 11:56:31 +0000 (12:56 +0100)] 
Spelling error in flags.xml

Fixes Trac #9528

5 years agoIncrease -fcontext-stack=N default to 100
Simon Peyton Jones [Tue, 9 Sep 2014 11:52:18 +0000 (12:52 +0100)] 
Increase -fcontext-stack=N default to 100

This addresses Trac #5395

5 years agoAuto-derive a few manually coded Show instances
Herbert Valerio Riedel [Fri, 19 Sep 2014 08:25:34 +0000 (10:25 +0200)] 
Auto-derive a few manually coded Show instances

In `base`, the instances

  instance Show ()
  instance Show Bool
  instance Show Ordering
  instance Show a => Show (Maybe a)

where defined manually, even though we can leverage GHC's auto-deriver
which is perfectly capable by standalone derivation to avoid boiler-plate
code such as this.

Reviewed By: austin

Differential Revision:

5 years agoRevert accidental wip/generics-propeq-conservative merge
Herbert Valerio Riedel [Fri, 19 Sep 2014 08:13:16 +0000 (10:13 +0200)] 
Revert accidental wip/generics-propeq-conservative merge

This commit reverts the commits

   e12a6a8 Propositional equality for Datatype meta-information
   0a8e6fc Make constructor metadata parametrized (with intended parameter <- datatype)
   f097b77 Implement sameConstructor
   cc618e6 get roles right and fix a FIXME
   79c7125 Actually parametrize the Constructor with the Datatype
   7bd4bab Supply a reasonable name (should be derived from d_name tho)
   09fcd70 Use 'd_name' as the name (should be derived from d_name tho)
   4d90e44 Add default case (fixes -Werror)

and effectively resets ghc.git to the state it was at commit

5 years agoAdd default case (fixes -Werror)
Gabor Greif [Fri, 19 Sep 2014 04:23:58 +0000 (06:23 +0200)] 
Add default case (fixes -Werror)

5 years agoUse 'd_name' as the name (should be derived from d_name tho)
Gabor Greif [Wed, 17 Sep 2014 08:56:20 +0000 (10:56 +0200)] 
Use 'd_name' as the name (should be derived from d_name tho)

5 years agoSupply a reasonable name (should be derived from d_name tho)
Gabor Greif [Wed, 17 Sep 2014 05:46:39 +0000 (07:46 +0200)] 
Supply a reasonable name (should be derived from d_name tho)

5 years agoActually parametrize the Constructor with the Datatype
Gabor Greif [Wed, 17 Sep 2014 04:43:21 +0000 (06:43 +0200)] 
Actually parametrize the Constructor with the Datatype

5 years agoget roles right and fix a FIXME
Gabor Greif [Tue, 16 Sep 2014 05:22:52 +0000 (07:22 +0200)] 
get roles right and fix a FIXME

5 years agoImplement sameConstructor
Gabor Greif [Tue, 2 Sep 2014 10:44:09 +0000 (12:44 +0200)] 
Implement sameConstructor

5 years agoMake constructor metadata parametrized (with intended parameter <- datatype)
Gabor Greif [Mon, 1 Sep 2014 21:52:01 +0000 (23:52 +0200)] 
Make constructor metadata parametrized (with intended parameter <- datatype)

5 years agoPropositional equality for Datatype meta-information
Gabor Greif [Fri, 29 Aug 2014 13:57:45 +0000 (15:57 +0200)] 
Propositional equality for Datatype meta-information

5 years agoUpdate haddock submodule (miscellaneous fixes)
Edward Z. Yang [Thu, 18 Sep 2014 22:49:50 +0000 (15:49 -0700)] 
Update haddock submodule (miscellaneous fixes)

Signed-off-by: Edward Z. Yang <>
5 years agoAdd -fwarn-context-quantification (#4426)
Krzysztof Gogolewski [Thu, 18 Sep 2014 21:52:50 +0000 (14:52 -0700)] 
Add -fwarn-context-quantification (#4426)

This warning (enabled by default) reports places where a context
implicitly binds a type variable, for example

type T a = {-forall m.-} Monad m => a -> m a

Also update Haddock submodule.

Test Plan: validate

Reviewers: hvr, goldfire, simonpj, austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

GHC Trac Issues: #4426

5 years agoRevert "Update haddock submodule for package key fix."
Edward Z. Yang [Thu, 18 Sep 2014 21:17:08 +0000 (14:17 -0700)] 
Revert "Update haddock submodule for package key fix."

This reverts commit a8d7f81d1f6a9ea658c6f1a965bb3e7717b11e40.

5 years agoGeneralise Control.Monad.{sequence_,msum,mapM_,forM_}
Herbert Valerio Riedel [Thu, 18 Sep 2014 21:05:57 +0000 (23:05 +0200)] 
Generalise Control.Monad.{sequence_,msum,mapM_,forM_}

This finally takes the gloves off, and performs the first actual
generalization in order to implement #9586. This re-exports the
respective definitions for the 4 combinators defined in Data.Foldable.

This way, importing Data.Foldable and Control.Monad unqualified won't bring
conflicting definitions of those 4 entities into scope anymore.

This change seems to have some minor effect on rule-firing, which
causes some wibble in the test-case T4007

Reviewed By: ekmett, austin

Differential Revision:

5 years agoInvert module-dep between Control.Monad and Data.Foldable
Herbert Valerio Riedel [Thu, 18 Sep 2014 21:05:47 +0000 (23:05 +0200)] 
Invert module-dep between Control.Monad and Data.Foldable

This is the last preparation needed before generalizing entities in
Control.Monad conflicting with those from Data.Foldable (re #9586)

Reviewed By: ekmett, austin

Differential Revision:

5 years agoMove Control.Monad.void into Data.Functor
Herbert Valerio Riedel [Thu, 18 Sep 2014 21:05:43 +0000 (23:05 +0200)] 
Move Control.Monad.void into Data.Functor

Both modules still export `void`, but `void`'s implementation now lives in
Data.Functor where it actually belongs in (as it doesn't need a Monad context)

The desired side-effect of this is to invert the import-dep
between Control.Monad and Data.Functor.

Reviewed By: ekmett, austin

Differential Revision:

5 years agoMove Applicative/MonadPlus into GHC.Base
Herbert Valerio Riedel [Thu, 18 Sep 2014 21:05:40 +0000 (23:05 +0200)] 
Move Applicative/MonadPlus into GHC.Base

This is necessary in order to invert the import-dependency between
Data.Foldable and Control.Monad (for addressing #9586)

This also updates the `binary` submodule to qualify a GHC.Base import

Reviewed By: austin

Differential Revision:

5 years agoMove `when` to GHC.Base
Herbert Valerio Riedel [Thu, 18 Sep 2014 21:05:35 +0000 (23:05 +0200)] 
Move `when` to GHC.Base

This allows several modules to avoid importing Control.Monad and thus break
import cycles that manifest themselves when implementing #9586

Reviewed By: austin, ekmett

Differential Revision:

5 years agoMove (=<<) to GHC.Base
Herbert Valerio Riedel [Thu, 18 Sep 2014 21:05:31 +0000 (23:05 +0200)] 
Move (=<<) to GHC.Base

This allows GHC.Stack to avoid importing Control.Monad, and
is preparatory work for implementing #9586

Reviewed By: austin

Differential Revision:

5 years agoFix formatting bug in core-spec.
Richard Eisenberg [Thu, 18 Sep 2014 21:00:37 +0000 (17:00 -0400)] 
Fix formatting bug in core-spec.

5 years agoUpdate haddock submodule for package key fix.
Edward Z. Yang [Thu, 18 Sep 2014 20:47:49 +0000 (13:47 -0700)] 
Update haddock submodule for package key fix.

Signed-off-by: Edward Z. Yang <>
5 years agoComments only: explain checkAxInstCo in OptCoercion
Richard Eisenberg [Thu, 18 Sep 2014 17:40:47 +0000 (13:40 -0400)] 
Comments only: explain checkAxInstCo in OptCoercion

5 years agoRemove unnecessary imports in GHC.Event.KQueue to fix compiler warnings.
Andreas Voellmy [Wed, 17 Sep 2014 12:26:41 +0000 (08:26 -0400)] 
Remove unnecessary imports in GHC.Event.KQueue to fix compiler warnings.

Summary: The imports of Data.Monoid and Data.Maybe in GHC.Event.KQueue are unnecessary and cause validate to fail.

Test Plan: Validate successfully (though I get some unrelated failures).

Reviewers: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

5 years agoImplement `decodeDouble_Int64#` primop
Herbert Valerio Riedel [Wed, 17 Sep 2014 15:54:20 +0000 (17:54 +0200)] 
Implement `decodeDouble_Int64#` primop

The existing `decodeDouble_2Int#` primop is rather inconvenient to use
(and in fact is not even used by `integer-gmp`) as the mantissa is split
into 3 components which would actually fit in an `Int64#` value.

However, `decodeDouble_Int64#` is to be used by the new `integer-gmp2`
re-implementation (see #9281).

Moreover, `decodeDouble_2Int#` performs direct bit-wise operations on the
IEEE representation which can be replaced by a combination of the
portable standard C99 `scalbn(3)` and `frexp(3)` functions.

Differential Revision:

5 years agoTypo in comment
Gabor Greif [Wed, 17 Sep 2014 05:48:42 +0000 (07:48 +0200)] 
Typo in comment

5 years agoSimplify
Gabor Greif [Wed, 17 Sep 2014 04:40:32 +0000 (06:40 +0200)] 

5 years agoTypo
Gabor Greif [Tue, 16 Sep 2014 04:56:31 +0000 (06:56 +0200)] 

5 years agoRe-add SPECIALISE liftM* pragmas dropped in d94de87252d0fe
Herbert Valerio Riedel [Tue, 16 Sep 2014 17:33:54 +0000 (19:33 +0200)] 
Re-add SPECIALISE liftM* pragmas dropped in d94de87252d0fe

They were dropped because `Maybe` wasn't available in GHC.Base, but now
it is thanks to b47521991a7574f4f3554f7c5444a8c60cfe9efd.

Differential Revision:

5 years agoMove `Maybe`-typedef into GHC.Base
Herbert Valerio Riedel [Tue, 16 Sep 2014 17:19:25 +0000 (19:19 +0200)] 
Move `Maybe`-typedef into GHC.Base

This is preparatory work for reintroducing SPECIALISEs that were lost
in d94de87252d0fe2ae97341d186b03a2fbe136b04

Differential Revision:

5 years agoFix typo "Rrestriction" in user's guide (lspitzner, #9528)
Reid Barton [Tue, 16 Sep 2014 16:57:50 +0000 (12:57 -0400)] 
Fix typo "Rrestriction" in user's guide (lspitzner, #9528)

5 years agoRevert "Revert "rts/base: Fix #9423"" and resolve issue that caused the revert.
Andreas Voellmy [Tue, 16 Sep 2014 12:56:54 +0000 (07:56 -0500)] 
Revert "Revert "rts/base: Fix #9423"" and resolve issue that caused the revert.

This reverts commit 4748f5936fe72d96edfa17b153dbfd84f2c4c053. The fix for #9423
was reverted because this commit introduced a C function setIOManagerControlFd()
(defined in Schedule.c) defined for all OS types, while the prototype
(in includes/rts/IOManager.h) was only included when mingw32_HOST_OS is
not defined. This broke Windows builds.

This commit reverts the original commit and resolves the problem by only defining
setIOManagerControlFd() when mingw32_HOST_OS is defined. Hence the missing prototype
error should not occur on Windows.

In addition, since the io_manager_control_wr_fd field of the Capability struct is only
usd by the setIOManagerControlFd, this commit includes the io_manager_control_wr_fd
field in the Capability struct only when mingw32_HOST_OS is not defined.

Test Plan: Try to compile successfully on all platforms.

Reviewers: austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

5 years agoReturn nBytes instead of nextAddr from utf8DecodeChar
Thomas Miedema [Tue, 16 Sep 2014 12:56:35 +0000 (07:56 -0500)] 
Return nBytes instead of nextAddr from utf8DecodeChar

While researching D176, I came across the following simplification

Not all functions that call utf8DecodeChar actually need the address
of the next char. And some need the 'number of bytes' read. So returning
nBytes instead of nextAddr should save a few addition and subtraction
operations, and makes the code a bit simpler.

Test Plan: it validates

Reviewers: simonmar, ezyang, austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

5 years agoAdd the ability to :set -l{foo} in ghci, fix #1407.
archblob [Tue, 16 Sep 2014 12:56:09 +0000 (07:56 -0500)] 
Add the ability to :set -l{foo} in ghci, fix #1407.

The dynamic linking code was already there but it was not called
on flag changes in ghci.

Test Plan: validate

Reviewers: hvr, simonmar, austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision:

GHC Trac Issues: #1407

5 years agoRemove special casing of singleton strings, split all strings.
Thijs Alkemade [Tue, 16 Sep 2014 12:55:34 +0000 (07:55 -0500)] 
Remove special casing of singleton strings, split all strings.

exprIsConApp_maybe now detects string literals and correctly
splits them. This means case-statemnts on string literals can
now push the literal into the cases.

fix trac issue #9400

Test Plan: validate

Reviewers: austin, simonpj

Reviewed By: austin, simonpj

Subscribers: simonmar, ezyang, carter

Differential Revision:

GHC Trac Issues: #9400

5 years agoFix cppcheck warnings
Boris Egorov [Tue, 16 Sep 2014 12:55:06 +0000 (07:55 -0500)] 
Fix cppcheck warnings

Cppcheck found a few defects in win32 IOManager and a typo in rts
testsuite. This commit fixes them.

Cppcheck 1.54 founds three possible null pointer dereferences of ioMan
pointer. It is dereferenced and checked for NULL after that.

testheapalloced.c contains typo in printf statement, which should print
percent sign but treated as parameter placement by compiler. To properly
print percent sign one need to use "%%" string.

FYI: Cppcheck 1.66 cannot find possible null pointer dereferences in
mentioned places, mistakenly thinking that some memory leaking instead.
I probably fill a regression bug to Cppcheck.

Test Plan:
Build project, run 'make fulltest'. It finished with 28 unexpected
failures. I don't know if they are related to my fix.

    Unexpected results from:
    TEST="T3500b T7891 tc124 T7653 T5321FD T5030 T4801 T6048 T5631 T5837 T5642 T9020 T3064 parsing001 T1969 T5321Fun T783 T3294"

    OVERALL SUMMARY for test run started at Tue Sep  9 16:46:27 2014 NOVT
     4:23:24 spent to go through
        4101 total tests, which gave rise to
       16075 test cases, of which
        3430 were skipped

         315 had missing libraries
       12154 expected passes
         145 expected failures

           3 caused framework failures
           0 unexpected passes
          28 unexpected failures

    Unexpected failures:
       ../../libraries/base/tests  T7653 [bad exit code] (ghci,threaded1,threaded2)
       perf/compiler               T1969 [stat not good enough] (normal)
       perf/compiler               T3064 [stat not good enough] (normal)
       perf/compiler               T3294 [stat not good enough] (normal)
       perf/compiler               T4801 [stat not good enough] (normal)
       perf/compiler               T5030 [stat not good enough] (normal)
       perf/compiler               T5321FD [stat not good enough] (normal)
       perf/compiler               T5321Fun [stat not good enough] (normal)
       perf/compiler               T5631 [stat not good enough] (normal)
       perf/compiler               T5642 [stat not good enough] (normal)
       perf/compiler               T5837 [stat not good enough] (normal)
       perf/compiler               T6048 [stat not good enough] (optasm)
       perf/compiler               T783 [stat not good enough] (normal)
       perf/compiler               T9020 [stat not good enough] (optasm)
       perf/compiler               parsing001 [stat not good enough] (normal)
       typecheck/should_compile    T7891 [exit code non-0] (hpc,optasm,optllvm)
       typecheck/should_compile    tc124 [exit code non-0] (hpc,optasm,optllvm)
       typecheck/should_run        T3500b [exit code non-0] (hpc,optasm,threaded2,dyn,optllvm)

Reviewers: austin

Reviewed By: austin

Subscribers: simonmar, ezyang, carter

Differential Revision: