5 years agoRefactoring around TyCon.isSynTyCon
Simon Peyton Jones [Thu, 15 May 2014 15:07:04 +0000 (16:07 +0100)] 
Refactoring around TyCon.isSynTyCon

* Document isSynTyCon better
* Add isTypeSyonymTyCon for regular H98 type synonyms
* Use isTypeSynonymTyCon rather than isSynTyCon where
  the former is really intended

All arose as part of a bug I introduced when fixing Trac #9102,
thinking that isSynTyCon meant H98 type syononyms.

5 years agoExpress OPTIONS_GHC as LANGUAGE pragmas
Herbert Valerio Riedel [Thu, 15 May 2014 11:52:14 +0000 (13:52 +0200)] 
Express OPTIONS_GHC as LANGUAGE pragmas

These two instances were missed previously for some unknown reason

Signed-off-by: Herbert Valerio Riedel <>
5 years agoAdd LANGUAGE pragmas to compiler/ source files
Herbert Valerio Riedel [Wed, 14 May 2014 17:46:28 +0000 (19:46 +0200)] 
Add LANGUAGE pragmas to compiler/ source files

In some cases, the layout of the LANGUAGE/OPTIONS_GHC lines has been
reorganized, while following the convention, to

- place `{-# LANGUAGE #-}` pragmas at the top of the source file, before
  any `{-# OPTIONS_GHC #-}`-lines.

- Moreover, if the list of language extensions fit into a single
  `{-# LANGUAGE ... -#}`-line (shorter than 80 characters), keep it on one
  line. Otherwise split into `{-# LANGUAGE ... -#}`-lines for each
  individual language extension. In both cases, try to keep the
  enumeration alphabetically ordered.
  (The latter layout is preferable as it's more diff-friendly)

While at it, this also replaces obsolete `{-# OPTIONS ... #-}` pragma
occurences by `{-# OPTIONS_GHC ... #-}` pragmas.

5 years agoAvoid trivial cases of NondecreasingIndentation
Herbert Valerio Riedel [Thu, 15 May 2014 07:51:51 +0000 (09:51 +0200)] 
Avoid trivial cases of NondecreasingIndentation

This cleanup allows the following refactoring commit to avoid adding a
few `{-# LANGUAGE NondecreasingIndentation #-}` pragmas.

Signed-off-by: Herbert Valerio Riedel <>
5 years agoConvert `ghc-bin.cabal` to use others-extensions
Herbert Valerio Riedel [Wed, 14 May 2014 10:41:21 +0000 (12:41 +0200)] 
Convert `ghc-bin.cabal` to use others-extensions

This replaces the previous `default-extensions` by per-file declared
`{-# LANGUAGE ... #-}` pragmas.

Signed-off-by: Herbert Valerio Riedel <>
5 years agoDrop default-extensions:CPP in hpc-bin.cabal
Herbert Valerio Riedel [Wed, 14 May 2014 10:37:25 +0000 (12:37 +0200)] 
Drop default-extensions:CPP in hpc-bin.cabal

The utils/hpc/*.hs code doesn't use any CPP statements anyway, so this
extensions was redundantly enabled to begin with.

Signed-off-by: Herbert Valerio Riedel <>
5 years agoDrop use of CPP in `bin-package-db`
Herbert Valerio Riedel [Wed, 14 May 2014 10:33:31 +0000 (12:33 +0200)] 
Drop use of CPP in `bin-package-db`

This also removes the redundant `default-extensions` field in
`bin-package-db.cabal` and adds an `other-extensions` field instead.

Signed-off-by: Herbert Valerio Riedel <>
5 years agoAvoid NondecreasingIndentation syntax in ghc-pkg
Herbert Valerio Riedel [Wed, 14 May 2014 10:16:13 +0000 (12:16 +0200)] 
Avoid NondecreasingIndentation syntax in ghc-pkg

This also makes ghc-pkg.cabal `default-extensions`-free

NB: Printing this commit via `git show --ignore-all-spaces` shows the
    only non-whitespaces changes are in `ghc-pkg.cabal`

Signed-off-by: Herbert Valerio Riedel <>
5 years agoAdd missing stack checks to stg_ap_* functions (#9001)
Simon Marlow [Wed, 14 May 2014 11:25:08 +0000 (12:25 +0100)] 
Add missing stack checks to stg_ap_* functions (#9001)

5 years agoRemove LANGUAGE pragrams implied by Haskell2010
Herbert Valerio Riedel [Wed, 14 May 2014 07:31:57 +0000 (09:31 +0200)] 
Remove LANGUAGE pragrams implied by Haskell2010

Haskell2010 implies (at least) EmptyDataDecls, ForeignFunctionInterface,
PatternGuards, DoAndIfThenElse, and RelaxedPolyRec.

This is a follow-up to dd92e2179e3171a0630834b773c08d416101980d

Signed-off-by: Herbert Valerio Riedel <>
5 years agoSet cabal files to default-language:Haskell2010
Herbert Valerio Riedel [Wed, 14 May 2014 07:24:10 +0000 (09:24 +0200)] 
Set cabal files to default-language:Haskell2010

This is a first step towards eliminating `default-extensions` in favour of
per-file declared `{-# LANGUAGE ... #-}` pragmas.

Signed-off-by: Herbert Valerio Riedel <>
5 years agoAdd strict ver. of (<$>): (<$!>) to Control.Monad
Alexander Berntsen [Tue, 13 May 2014 08:50:30 +0000 (10:50 +0200)] 
Add strict ver. of (<$>): (<$!>) to Control.Monad

A strict (<$>) has been proposed numerous times. The first time
around[1] by Johan Tibell, and the last time around[2] by David
Luposchainsky. David's thread was able to avoid The Bikeshed Monster,
and his (<$!>) proposal received unanimous +1s all around.

This addresses #9099.


Authored-by: Alexander Berntsen <>
Signed-off-by: Herbert Valerio Riedel <>
5 years agoUpdate Haddock submodule.
Mateusz Kowalczyk [Wed, 14 May 2014 00:32:42 +0000 (02:32 +0200)] 
Update Haddock submodule.

This splits up Haddock up a bit to allow use of its parser (and in the
future perhaps more) without GHC dependency. It should build fine with
the regular work-flow but if you get problems with building Haddock then
please revert this and let me know.

5 years agoWibble to 4cfc1fae
Simon Peyton Jones [Tue, 13 May 2014 23:15:48 +0000 (00:15 +0100)] 
Wibble to 4cfc1fae

isSynTyCon is true of type *family* TyCons, which *are* allowed
in TyConAppCo

5 years agoFix globalRegMaybe for unregisterised build.
Peter Trommler [Wed, 30 Apr 2014 09:41:51 +0000 (11:41 +0200)] 
Fix globalRegMaybe for unregisterised build.

In commit 83a003f globalRegMaybe will be called but panics
for unregisterised compilers.

In an unregisterised compiler there are no global registers
so always return `Nothing`.

Fixes #9055.

5 years agoFix invariant in mkAppCoFlexible
Simon Peyton Jones [Tue, 13 May 2014 12:17:19 +0000 (13:17 +0100)] 
Fix invariant in mkAppCoFlexible

mkAppCoFlexible was breaking the invariant that the head of a TyConAppCo cannot
be a type synonym.  This small patch fixes it.

5 years agoLint should check that TyConAppCo doesn't have a synonym in the tycon position
Simon Peyton Jones [Tue, 13 May 2014 12:15:45 +0000 (13:15 +0100)] 
Lint should check that TyConAppCo doesn't have a synonym in the tycon position

That is why Lint didn't nail Trac #9102

5 years agoTypo in note
Gabor Greif [Mon, 12 May 2014 22:49:30 +0000 (00:49 +0200)] 
Typo in note

5 years agoTypo in comment
Gabor Greif [Mon, 12 May 2014 22:38:19 +0000 (00:38 +0200)] 
Typo in comment

5 years agoImprove desugaring of lazy pattern match
Simon Peyton Jones [Mon, 12 May 2014 15:03:48 +0000 (16:03 +0100)] 
Improve desugaring of lazy pattern match

This patch implements a simpler, and nicer, desugaring for
lazy pattern matching, fixing Trac #9098

5 years agoIn splitHsFunType, take account of prefix (->)
Simon Peyton Jones [Mon, 12 May 2014 15:02:36 +0000 (16:02 +0100)] 
In splitHsFunType, take account of prefix (->)

This fixes Trac #9096

5 years agoComments only, on inert_fsks and inert_no_eqs
Simon Peyton Jones [Fri, 9 May 2014 09:40:50 +0000 (10:40 +0100)] 
Comments only, on inert_fsks and inert_no_eqs

I wrote these when studying Trac #9090

5 years agoRevert output of T5979
Joachim Breitner [Sat, 10 May 2014 16:28:44 +0000 (18:28 +0200)] 
Revert output of T5979

this reverts 12332f1. The error message changes when there are two
versions of transformers in the database, one of them hidden. That might
be a bug of its own, but for now lets make the test case succeed after a
fresh build. Affected developers should probably
$ ./inplace/bin/ghc-pkg unregister transformers-

5 years agoRequire transformers for T5979
Joachim Breitner [Sat, 10 May 2014 09:38:49 +0000 (11:38 +0200)] 
Require transformers for T5979

in order to get a reliable error message
(although the error message could be improved anyways to mention the
explicit package the module is imported with.)

5 years agotestsuite: fix cc004
Austin Seipp [Sat, 10 May 2014 02:50:52 +0000 (21:50 -0500)] 
testsuite: fix cc004

Signed-off-by: Austin Seipp <>
5 years agotestsuite: fix cgrun051 exit code
Austin Seipp [Sat, 10 May 2014 01:58:06 +0000 (20:58 -0500)] 
testsuite: fix cgrun051 exit code

Signed-off-by: Austin Seipp <>
5 years agoUpdate .gitignore
Austin Seipp [Sat, 3 May 2014 22:35:04 +0000 (17:35 -0500)] 
Update .gitignore

Signed-off-by: Austin Seipp <>
5 years agoError message wibble, presumably due to recent changes in transformers
Simon Peyton Jones [Thu, 8 May 2014 12:06:05 +0000 (13:06 +0100)] 
Error message wibble, presumably due to recent changes in transformers

5 years agoBetter error message in vectoriser
Simon Peyton Jones [Thu, 8 May 2014 09:39:21 +0000 (10:39 +0100)] 
Better error message in vectoriser

5 years agoPreserve evaluated-ness in CoreTidy
Simon Peyton Jones [Thu, 8 May 2014 09:38:52 +0000 (10:38 +0100)] 
Preserve evaluated-ness in CoreTidy

The main effect of this patch is to preserve the evaluated-ness of
case binders and suchlike, to avoid spurious Lint complaints after
tidying.  See Note [Preserve evaluatedness] in CoreTidy.

Plus a bit of associated refactoring of tidyIdBndr, tidyLetBndr.

5 years agoMark evaluated arguments in dataConInstPat
Simon Peyton Jones [Thu, 8 May 2014 09:33:17 +0000 (10:33 +0100)] 
Mark evaluated arguments in dataConInstPat

See Note [Mark evaluated arguments] in CoreUtils.

This is not a significant change, but avoids a spurious Lint complaint.

5 years agoRefactor buildClass and mkDictSelId a bit, to avoid the no_unf argument
Simon Peyton Jones [Thu, 8 May 2014 09:31:53 +0000 (10:31 +0100)] 
Refactor buildClass and mkDictSelId a bit, to avoid the no_unf argument

No change in functionality, just a cleaner story, with the RHS for
dictionary selectors being treated less specially than before.

5 years agoImprove tracing in Simplifier
Simon Peyton Jones [Mon, 7 Apr 2014 14:41:45 +0000 (15:41 +0100)] 
Improve tracing in Simplifier

5 years agoUpdate transformers submodule to new v0.4 rel
Herbert Valerio Riedel [Tue, 6 May 2014 20:46:27 +0000 (22:46 +0200)] 
Update transformers submodule to new v0.4 rel

This also updates the haskeline to upstream master to
accomodate the new transformers version

5 years agoAdding missing test files for #9071
Simon Peyton Jones [Tue, 6 May 2014 08:46:14 +0000 (09:46 +0100)] 
Adding missing test files for #9071

5 years agoAdd a bit more typechecker tracing
Simon Peyton Jones [Tue, 6 May 2014 07:23:26 +0000 (08:23 +0100)] 
Add a bit more typechecker tracing

This is in pursuit of Trac #9063

5 years agoFix Trac #9071, an egregious bug in TcDeriv.inferConstraints
Simon Peyton Jones [Tue, 6 May 2014 07:22:37 +0000 (08:22 +0100)] 
Fix Trac #9071, an egregious bug in TcDeriv.inferConstraints

The constraints for Functor don't line up 1-1 with the arguments
(they are fetched out from sub-terms of the type), but the surrounding
code was mistakenly assuming they were in 1-1 association.

5 years agoSecond go at fixing #9061
Simon Peyton Jones [Tue, 6 May 2014 07:20:28 +0000 (08:20 +0100)] 
Second go at fixing #9061

My first attempt introduce a bug in -fprint-minimal-imports, but
fortunately a regression test caught it.

5 years agoModularise pretty-printing for foralls
Simon Peyton Jones [Tue, 6 May 2014 07:19:01 +0000 (08:19 +0100)] 
Modularise pretty-printing for foralls

See TypeRep.pprUserForAll.  This just makes forall-printing a bit more
consistent.  In particular, I wasn't seeing the kind foralls when
displaying a CoAxiom or CoAxBranch

The output on T7939 is just possible a bit too verbose now, but even if so
that's an error in the right direction.

5 years agoImprove comments and tracing in SpecConstr
Simon Peyton Jones [Mon, 5 May 2014 07:50:51 +0000 (08:50 +0100)] 
Improve comments and tracing in SpecConstr

5 years agoChanged profiling output is fine (according to Simon Marlow)
Simon Peyton Jones [Fri, 2 May 2014 11:10:42 +0000 (12:10 +0100)] 
Changed profiling output is fine (according to Simon Marlow)

5 years agoAdd -fno-full-laziness to get consistent profiling output
Simon Peyton Jones [Fri, 2 May 2014 11:10:26 +0000 (12:10 +0100)] 
Add -fno-full-laziness to get consistent profiling output

5 years agoFix over-zealous unused-import warning
Simon Peyton Jones [Fri, 2 May 2014 11:09:52 +0000 (12:09 +0100)] 
Fix over-zealous unused-import warning

See Note [Un-warnable import decls] in RnNames.

Fixes Trac #9061.

5 years agoRevert "Per-thread allocation counters and limits"
Simon Marlow [Sun, 4 May 2014 19:27:42 +0000 (20:27 +0100)] 
Revert "Per-thread allocation counters and limits"

Problems were found on 32-bit platforms, I'll commit again when I have a fix.

This reverts the following commits:

5 years agoImprove docs for array indexing primops
Johan Tibell [Sun, 4 May 2014 09:32:15 +0000 (11:32 +0200)] 
Improve docs for array indexing primops

5 years agoUpdate comment now that we have per-gen weak pointer lists.
Edward Z. Yang [Sun, 4 May 2014 08:18:54 +0000 (01:18 -0700)] 
Update comment now that we have per-gen weak pointer lists.

Signed-off-by: Edward Z. Yang <>
5 years agofix rts exported symbols base_GHCziIOziException_allocationLimitExceeded_closure
Sergei Trofimovich [Sat, 3 May 2014 19:29:14 +0000 (22:29 +0300)] 
fix rts exported symbols base_GHCziIOziException_allocationLimitExceeded_closure

Commit  b0534f78a73f972e279eed4447a5687bd6a8308e added new exported rts symbols,
but slightly misspelled them.

Observer on first compiled program:
> Linking dist/build/haskell-updater/haskell-updater ...
> /usr/lib64/ghc-7.9.20140503/rts-1.0/libHSrts.a(Schedule.o): In function `scheduleWaitThread':
> (.text+0xc4c): undefined reference to `base_GHCziIOziException_allocationLimitExceeded_closure'
> /usr/lib64/ghc-7.9.20140503/rts-1.0/libHSrts.a(RtsStartup.o): In function `hs_init_ghc':
> (.text+0x2fa): undefined reference to `base_GHCziIOziException_allocationLimitExceeded_closure'
> collect2: error: ld returned 1 exit status

CC: Simon Marlow <>
Signed-off-by: Sergei Trofimovich <>
5 years agoRemove external core
Austin Seipp [Mon, 28 Apr 2014 02:11:23 +0000 (21:11 -0500)] 
Remove external core

Signed-off-by: Austin Seipp <>
5 years agoUpdate Haddock submodule ref. Fixes `cabal test'.
Mateusz Kowalczyk [Sat, 3 May 2014 13:43:00 +0000 (15:43 +0200)] 
Update Haddock submodule ref. Fixes `cabal test'.

5 years agoPer-thread allocation counters and limits
Simon Marlow [Mon, 28 Apr 2014 15:55:47 +0000 (16:55 +0100)] 
Per-thread allocation counters and limits

This tracks the amount of memory allocation by each thread in a
counter stored in the TSO.  Optionally, when the counter drops below
zero (it counts down), the thread can be sent an asynchronous
exception: AllocationLimitExceeded.  When this happens, given a small
additional limit so that it can handle the exception.  See
documentation in GHC.Conc for more details.

Allocation limits are similar to timeouts, but

  - timeouts use real time, not CPU time.  Allocation limits do not
    count anything while the thread is blocked or in foreign code.

  - timeouts don't re-trigger if the thread catches the exception,
    allocation limits do.

  - timeouts can catch non-allocating loops, if you use
    -fno-omit-yields.  This doesn't work for allocation limits.

I couldn't measure any impact on benchmarks with these changes, even
for nofib/smp.

5 years agoReplace all #!/usr/bin/perl with #!/usr/bin/env perl
Joachim Breitner [Wed, 30 Apr 2014 09:22:32 +0000 (11:22 +0200)] 
Replace all #!/usr/bin/perl with #!/usr/bin/env perl

As suggested in #9057.

5 years agoDon't inline non-register GlobalRegs
Simon Marlow [Tue, 29 Apr 2014 19:32:50 +0000 (20:32 +0100)] 
Don't inline non-register GlobalRegs

5 years agoRts: Reuse scavenge_small_bitmap (#8742)
Arash Rouhani [Thu, 6 Feb 2014 08:10:03 +0000 (09:10 +0100)] 
Rts: Reuse scavenge_small_bitmap (#8742)

The function was inlined at two places already. And the function is
having the STATIC_INLINE annotation, so the assembly output should.
be the same.

To convince myself, I did diff the output of the object files before
and after the patch and they matched on my 64-bit Ubuntu 13.10 machine,
running gcc 4.8.1-10ubuntu9.

Also, I had to move scavenge_small_bitmap up a bit since it's not in any

While I was at it, I also applied the analogous patch for Compact.c.
Though I had to write `thread_small_bitmap` instead of just moving it.

5 years agoRts: Consistently use StgWord for sizes of bitmaps
Arash Rouhani [Thu, 13 Feb 2014 14:28:11 +0000 (15:28 +0100)] 
Rts: Consistently use StgWord for sizes of bitmaps

A long debate is in issue #8742, but the main motivation is that this
allows for applying a patch to reuse the function scavenge_small_bitmap
without changing the .o-file output.

Similarly, I changed the types in rts/sm/Compact.c, so I can create
a STATIC_INLINE function for the redundant code block:

        while (size > 0) {
            if ((bitmap & 1) == 0) {
                thread((StgClosure **)p);
            bitmap = bitmap >> 1;

5 years agorts: Fix memory leak when loading ELF objects
Austin Seipp [Tue, 29 Apr 2014 14:09:25 +0000 (09:09 -0500)] 
rts: Fix memory leak when loading ELF objects

Issue discovered by Coverity Scan, CID 43168.

Signed-off-by: Austin Seipp <>
5 years agorts: Fix leak of file archive handle
Austin Seipp [Tue, 29 Apr 2014 14:05:38 +0000 (09:05 -0500)] 
rts: Fix leak of file archive handle

Issue discovered by Coverity Scan, CID 43171.

Signed-off-by: Austin Seipp <>
5 years agorts: Add an initial Coverity model
Austin Seipp [Tue, 29 Apr 2014 15:07:50 +0000 (10:07 -0500)] 
rts: Add an initial Coverity model

Signed-off-by: Austin Seipp <>
5 years agoAdd Note [Role twiddling functions] to Coercion.
Richard Eisenberg [Tue, 29 Apr 2014 15:55:56 +0000 (11:55 -0400)] 
Add Note [Role twiddling functions] to Coercion.

This commit also makes better names for several of these functions,
and removes one that went unused.

5 years agoRevert "rts: Add an initial Coverity model"
Austin Seipp [Tue, 29 Apr 2014 14:59:01 +0000 (09:59 -0500)] 
Revert "rts: Add an initial Coverity model"

This reverts commit 4539400a72ded7fa69149b28cfa9c84464f4739d.

5 years agorts: Add an initial Coverity model
Austin Seipp [Tue, 29 Apr 2014 13:48:57 +0000 (08:48 -0500)] 
rts: Add an initial Coverity model

Signed-off-by: Austin Seipp <>
5 years agoTypo in comment
Gabor Greif [Tue, 29 Apr 2014 13:38:29 +0000 (15:38 +0200)] 
Typo in comment

5 years agoTypo in comments
Gabor Greif [Tue, 29 Apr 2014 13:34:29 +0000 (15:34 +0200)] 
Typo in comments

5 years agoFix scavenge_stack crash (#9045)
Simon Marlow [Mon, 28 Apr 2014 15:36:29 +0000 (16:36 +0100)] 
Fix scavenge_stack crash (#9045)

The new stg_gc_prim_p_ll stack frame was missing an info table.  This
is a regression since 7.6, because this stuff was part of a cleanup
that happened in 7.7.

5 years agoImprove implementation of unSubCo_maybe.
Richard Eisenberg [Mon, 28 Apr 2014 17:33:13 +0000 (13:33 -0400)] 
Improve implementation of unSubCo_maybe.

This is the result of an email conversation (off list) with
Conal Elliott, who needed a stronger unSubCo_maybe. This
commit adds cases to upgrade the role of a coercion when
recursion is necessary to do say (for example, for a use of
TransCo). As a side effect, more coercion optimizations are
now possible.

This was not done previously because unSubCo_maybe was used
only during coercion optimization, and the recursive cases
looked to be unlikely. However, adding them can cause no harm.

unSubCo_maybe is now also exported from Coercion, for use
cases like Conal's.

5 years agoannth_make, annth_compunits: Only run these tests if have_dynamic()
Joachim Breitner [Mon, 28 Apr 2014 14:14:10 +0000 (16:14 +0200)] 
annth_make, annth_compunits: Only run these tests if have_dynamic()

5 years agoPrint for-alls more often (Trac #9018)
Simon Peyton Jones [Mon, 28 Apr 2014 13:49:21 +0000 (14:49 +0100)] 
Print for-alls more often (Trac #9018)

We now display the foralls of a type if any of the type variables
is polykinded.  This put kind polymorphism "in your face" a bit more
often, but eliminates a lot of head scratching.

The user manual reflects the new behaviour.

5 years agotcrun045 should fail (implicit parameter as superclass)
Simon Peyton Jones [Mon, 28 Apr 2014 09:31:15 +0000 (10:31 +0100)] 
tcrun045 should fail (implicit parameter as superclass)

5 years agoAdd a comprehensive test for using Annotations from TH
Gergely Risko [Fri, 25 Apr 2014 13:39:26 +0000 (15:39 +0200)] 
Add a comprehensive test for using Annotations from TH

The provided tests test both annotation generation and reification
from Template Haskell.  Both --make and compilation via separate
units (ghc -c) are tested.

Signed-off-by: Austin Seipp <>
5 years agoFix annotation reification for home package modules
Gergely Risko [Fri, 25 Apr 2014 13:35:58 +0000 (15:35 +0200)] 
Fix annotation reification for home package modules

The reifyAnnotation method of the Q monad correctly gathered annotations
from TCG and EPS.  Unfortunately it didn't look into the Home Package
Table.  This resulted in annotations not being found if they are in the
same package as the splice that is reifying and ghc --make is used for
compilation management.  Fix this by using the already existing
prepareAnnotations method from HscTypes.lhs that correctly searches
in HPT and EPS both.

Signed-off-by: Austin Seipp <>
5 years agoStart on 7.10.1 release notes
Austin Seipp [Mon, 28 Apr 2014 09:31:14 +0000 (04:31 -0500)] 
Start on 7.10.1 release notes

Signed-off-by: Austin Seipp <>
5 years agoUpdate 32-bit perf numbers
Simon Peyton Jones [Thu, 24 Apr 2014 23:07:20 +0000 (00:07 +0100)] 
Update 32-bit perf numbers

Many of these have never been initialised, I think.  They
were simply guesses from the 64-bit version.

5 years agoRemove the definition of die, which is now provided by System.Exit
Simon Peyton Jones [Thu, 24 Apr 2014 23:06:08 +0000 (00:06 +0100)] 
Remove the definition of die, which is now provided by System.Exit

5 years agoDo type-class defaulting even if there are insoluble constraints
Simon Peyton Jones [Thu, 24 Apr 2014 23:04:45 +0000 (00:04 +0100)] 
Do type-class defaulting even if there are insoluble constraints

The argument in Trac #9033 is very compelling: we should not report 20
errors, fix one, and have the other 19 disappear.  They were spurious
in the first place.

The fix was easy; do type-class defaulting uncondionally, rather than
only if there are no insoluble constraints.

See Note [When to do type-class defaulting] in TcSimplify.

Error messages generally improve, especially tc211 which actually
had an example of precisely this phenomenon.

5 years agorm -rf ./docs/comm
Austin Seipp [Mon, 28 Apr 2014 09:13:07 +0000 (04:13 -0500)] 
rm -rf ./docs/comm

The Commentary is now on the wiki and far more complete. This copy will
of course live on in the annals of history, but there's no reason to
keep it around still.

Signed-off-by: Austin Seipp <>
5 years agoTest Trac #9036
Simon Peyton Jones [Mon, 28 Apr 2014 07:55:32 +0000 (08:55 +0100)] 
Test Trac #9036

5 years agoDon't require mk/ for all cleanup targets
Herbert Valerio Riedel [Sun, 27 Apr 2014 17:15:16 +0000 (19:15 +0200)] 
Don't require mk/ for all cleanup targets

`make clean` did already ignore a missing mk/,
but `make distclean` and `make maintainer-clean` didn't.
This commit rectifies this oversight.

Signed-off-by: Herbert Valerio Riedel <>
5 years agoFix memleak in hp2ps
Nicolas Trangez [Wed, 23 Apr 2014 19:14:23 +0000 (21:14 +0200)] 
Fix memleak in hp2ps

Issue discovered by Coverity scan, CID 43167.

Signed-off-by: Austin Seipp <>
5 years agoCheck correct variable for NULL
Nicolas Trangez [Wed, 23 Apr 2014 18:37:51 +0000 (20:37 +0200)] 
Check correct variable for NULL

Issue discovered by Coverity scan, CID 43163. This should fix CID 43172 as a
side-effect as well.

Signed-off-by: Austin Seipp <>
5 years agoFix potential out-of-bound memory access
Nicolas Trangez [Wed, 23 Apr 2014 18:27:04 +0000 (20:27 +0200)] 
Fix potential out-of-bound memory access

Issue discovered by Coverity scan, CID 43165.

Signed-off-by: Austin Seipp <>
5 years agoCheck return value of sigaction
Nicolas Trangez [Wed, 23 Apr 2014 18:06:15 +0000 (20:06 +0200)] 
Check return value of sigaction

Issue discovered by Coverity scan, CID 43142.

Signed-off-by: Austin Seipp <>
5 years agocoverity: Suppress some time-of-check-time-of-use reports
Austin Seipp [Sun, 27 Apr 2014 09:19:24 +0000 (04:19 -0500)] 
coverity: Suppress some time-of-check-time-of-use reports

CID 43178

Signed-off-by: Austin Seipp <>
5 years agorts: Fix possible int overflow in resize_nursery
Austin Seipp [Wed, 23 Apr 2014 08:41:44 +0000 (03:41 -0500)] 
rts: Fix possible int overflow in resize_nursery

n_capabilities is declared as unsigned int (32bit), and so multiplication
is 32-bit before being stored in a 64bit integer (StgWord).

Instead, cast n_capabilities to StgWord before multiplying.

Discovered by Coverity. CID 43164.

Signed-off-by: Austin Seipp <>
5 years agorts: Fix potential memory leak in ProfHeap.c
Austin Seipp [Wed, 23 Apr 2014 07:14:15 +0000 (02:14 -0500)] 
rts: Fix potential memory leak in ProfHeap.c

Discovered by Coverity. CID 43166.

Signed-off-by: Austin Seipp <>
5 years agoDrop `template-haskell`'s build-dep on `containers`
Herbert Valerio Riedel [Thu, 24 Apr 2014 07:05:45 +0000 (09:05 +0200)] 
Drop `template-haskell`'s build-dep on `containers`

This is an attempt to address

by replicating the less than 100 lines of code actually used from the
containers package into an internal non-exposed `template-haskell` module.

Moreover, `template-haskell` does not expose the `Map` type, so this change
should have no visible effect on the public API.

It may turn out that `Data.Map` is not necessary and that even a simple
list-based associative list (`Prelude.lookup`) may suffice. However, in
order to avoid any regressions, this commit takes the safe route and just
clones `Data.Map` for now.

Signed-off-by: Herbert Valerio Riedel <>
5 years agoSome typos in comments
Gabor Greif [Thu, 24 Apr 2014 10:27:50 +0000 (12:27 +0200)] 
Some typos in comments

5 years agoDon't eta-expand PAPs (fixes Trac #9020)
Simon Peyton Jones [Thu, 24 Apr 2014 07:43:07 +0000 (08:43 +0100)] 
Don't eta-expand PAPs (fixes Trac #9020)

See Note [Do not eta-expand PAPs] in SimplUtils.  This has a tremendously
good effect on compile times for some simple benchmarks.

The test is now where it belongs, in perf/compiler/T9020 (instead of simpl015).

I did a nofib run and got essentially zero change except for cacheprof which
gets 4% more allocation.  I investigated.  Turns out that we have

    instance PP Reg where
       pp ppm ST_0 = "%st"
       pp ppm ST_1 = "%st(1)"
       pp ppm ST_2 = "%st(2)"
       pp ppm ST_3 = "%st(3)"
       pp ppm ST_4 = "%st(4)"
       pp ppm ST_5 = "%st(5)"
       pp ppm ST_6 = "%st(6)"
       pp ppm ST_7 = "%st(7)"
       pp ppm r    = "%" ++ map toLower (show r)

That (map toLower (show r) does a lot of map/toLowers.  But if we inline show
we get something like

       pp ppm ST_0 = "%st"
       pp ppm ST_1 = "%st(1)"
       pp ppm ST_2 = "%st(2)"
       pp ppm ST_3 = "%st(3)"
       pp ppm ST_4 = "%st(4)"
       pp ppm ST_5 = "%st(5)"
       pp ppm ST_6 = "%st(6)"
       pp ppm ST_7 = "%st(7)"
       pp ppm EAX  = map toLower (show EAX)
       pp ppm EBX  = map toLower (show EBX)

and all those map/toLower calls can now be floated to top level.
This gives a 4% decrease in allocation.  But it depends on inlining
a pretty big 'show' function.

With this new patch we get slightly better eta-expansion, which makes
a function look slightly bigger, which just stops it being inlined.
The previous behaviour was luck, so I'm not going to worry about
losing it.

I've added some notes to nofib/Simon-nofib-notes

5 years agoBe less verbose when printing Names when we don't know what's in scope
Simon Peyton Jones [Tue, 22 Apr 2014 16:17:31 +0000 (17:17 +0100)] 
Be less verbose when printing Names when we don't know what's in scope

Previously we always printed qualified names, but that makes a lot of debug or
warning output very verbose. So now we only print qualified names with -dppr-debug.

Civilised output (from pukka error messages, with the environment available) is

5 years agoMake absolutely sure that 'done' and 'safeIndex' are strict in the index
Simon Peyton Jones [Tue, 22 Apr 2014 13:40:12 +0000 (14:40 +0100)] 
Make absolutely sure that 'done' and 'safeIndex' are strict in the index

This is just to make sure that there is no redundant boxing.
For safeIndex, for example, the error path doesn't evaluate the
index, so it may be passed boxed unless safeIndex is inlined bodily,
which I don't want to rely on.

5 years agoBe sure to UNPACK the size of an array
Simon Peyton Jones [Tue, 22 Apr 2014 13:37:22 +0000 (14:37 +0100)] 
Be sure to UNPACK the size of an array

The code before did actually unpack the size, I think, but it
wasn't very clear, and it's better to do it explicitly

5 years agoAdd comments to explain the change to EF_ (Trac #8965)
Simon Peyton Jones [Thu, 24 Apr 2014 07:36:40 +0000 (08:36 +0100)] 
Add comments to explain the change to EF_ (Trac #8965)

5 years agoBe more aggressive in `make clean`
Herbert Valerio Riedel [Tue, 22 Apr 2014 20:23:56 +0000 (22:23 +0200)] 
Be more aggressive in `make clean`

This quiets down the utils/testremove/checkremove step

Basically the idea is to have 'make clean' remove everything that was
generated by `make`, while `make distclean` ought to remove everything
created by `./configure`.

Signed-off-by: Herbert Valerio Riedel <>
5 years agoHandle base et al. specially in
Herbert Valerio Riedel [Tue, 22 Apr 2014 10:01:00 +0000 (12:01 +0200)] 
Handle base et al. specially in

This adapts the foreachLibrary rule to match the new situation of
base.git, ghc-prim.git, integer-gmp.git, integer-simple.git, and
template-haskell.git being folded into ghc.git (re #9016), and thus
not being mentioned anymore in the `packages` file.

One visible effect of this oversight was that the `clean_libraries`
make target would fail to clean those packages.

Signed-off-by: Herbert Valerio Riedel <>
5 years agoUpdate integer-gmp's .gitignore file
Herbert Valerio Riedel [Tue, 22 Apr 2014 08:21:13 +0000 (10:21 +0200)] 
Update integer-gmp's .gitignore file

Note: the .gitignore pattern rules are not that obvious

Signed-off-by: Herbert Valerio Riedel <>
5 years agoAdapt .gitignore (re #8545)
Herbert Valerio Riedel [Tue, 22 Apr 2014 07:54:09 +0000 (09:54 +0200)] 
Adapt .gitignore (re #8545)

This adapts the top-level .gitignore file to match the new situation of
base.git, ghc-prim.git, integer-gmp.git, integer-simple.git, and
template-haskell.git being folded into ghc.git

Signed-off-by: Herbert Valerio Riedel <>
5 years agoFix `make help`
Kyle J. Van Berendonck [Sat, 29 Mar 2014 09:59:58 +0000 (20:59 +1100)] 
Fix `make help`

Signed-off-by: Austin Seipp <>
5 years agoSeparate thousands when printing allocated bytes
Erlend Hamberg [Thu, 6 Mar 2014 22:27:29 +0000 (23:27 +0100)] 
Separate thousands when printing allocated bytes

When printing allocated bytes (`:set +s` in ghci), separate thousands
to make it easier to read large allocations sizes, e.g. “1,200,000

Signed-off-by: Austin Seipp <>
5 years agoAdd the powerpc64le architecture
Colin Watson [Sat, 12 Apr 2014 01:13:48 +0000 (02:13 +0100)] 
Add the powerpc64le architecture

This is ArchUnknown for now, as it requires some porting work over and
above powerpc64 due to such things as the different function calling
sequence in the ELFv2 ABI.  For now, an unregisterised port is better
than nothing.

Signed-off-by: Colin Watson <>
Signed-off-by: Austin Seipp <>
5 years agoBe less untruthful about the prototypes of external functions
Colin Watson [Sat, 12 Apr 2014 00:55:07 +0000 (01:55 +0100)] 
Be less untruthful about the prototypes of external functions

GHC's generated C code uses dummy prototypes for foreign imports.  At the
moment these all claim to be (void), i.e. functions of zero arguments.  On
most platforms this doesn't matter very much: calls to these functions put
the parameters in the usual places anyway, and (with the exception of
varargs) things just work.

However, the ELFv2 ABI on ppc64 optimises stack allocation
( a call to a
function that has a prototype, is not varargs, and receives all parameters
in registers rather than on the stack does not require the caller to
allocate an argument save area.  The incorrect prototypes cause GCC to
believe that all functions declared this way can be called without an
argument save area, but if the callee has sufficiently many arguments then
it will expect that area to be present, and will thus corrupt the caller's
stack.  This happens in particular with calls to runInteractiveProcess in

The simplest fix appears to be to declare these external functions with an
unspecified argument list rather than a void argument list.  This is no
worse for platforms that don't care either way, and allows a successful
bootstrap of GHC 7.8 on little-endian Linux ppc64 (which uses the ELFv2

Fixes #8965

Signed-off-by: Colin Watson <>
Signed-off-by: Austin Seipp <>
5 years agoghc: initial AArch64 patches
Colin Watson [Tue, 22 Apr 2014 03:26:56 +0000 (22:26 -0500)] 
ghc: initial AArch64 patches

Signed-off-by: Austin Seipp <>
5 years agoghc & docs: kill unused flags
Austin Seipp [Tue, 22 Apr 2014 03:10:05 +0000 (22:10 -0500)] 
ghc & docs: kill unused flags

This removes the following, now defunct flags, which will not be
recognized by GHC 7.10:

  -pgmm and -optm (used for the Mangler, long dead)
  -keep-raw-s-file & -keep-raw-s-files

Signed-off-by: Austin Seipp <>