5 years agoFold ghc-prim.git into ghc.git (re #8545)
Herbert Valerio Riedel [Sat, 19 Apr 2014 07:44:33 +0000 (09:44 +0200)] 
Fold ghc-prim.git into ghc.git (re #8545)

At the time of merge, ghc-prim.git was at

Signed-off-by: Herbert Valerio Riedel <>
5 years agoTake account of the AvailTC invariant when importing
Simon Peyton Jones [Fri, 18 Apr 2014 22:30:18 +0000 (23:30 +0100)] 
Take account of the AvailTC invariant when importing

In the rather gnarly filterImports code, someone had forgotten
the AvailTC invariant:  in AvailTC n [n,s1,s2], the 'n' is itself
included in the list of names.

5 years agoUpdate Cabal submodule to fix Solaris build
Herbert Valerio Riedel [Fri, 18 Apr 2014 10:31:51 +0000 (12:31 +0200)] 
Update Cabal submodule to fix Solaris build

see also

5 years agoUpdate Cabal submodule to latest tip of 1.20 branch
Herbert Valerio Riedel [Thu, 17 Apr 2014 14:12:23 +0000 (16:12 +0200)] 
Update Cabal submodule to latest tip of 1.20 branch

The testsuite reference output for ghcpkg01 needs to be adapted
since a "More diff friendly pretty printing of cabal files"
is now performed.

5 years agoMake qReport force its error message before printing it
Simon Peyton Jones [Thu, 17 Apr 2014 10:15:16 +0000 (11:15 +0100)] 
Make qReport force its error message before printing it

Fixes Trac #8987.  See Note [Exceptions in TH]

Thanks to Yuras Shumovich for doing this.

5 years agoUpdate Cabal submodule to tip of v1.20 branch
Herbert Valerio Riedel [Tue, 15 Apr 2014 09:09:45 +0000 (11:09 +0200)] 
Update Cabal submodule to tip of v1.20 branch

This corresponds to the RC of the soon-to-be Cabal 1.20 release

One noteworthy change is the removal of the `--with-ranlib` flag
requiring a small adaptation in the GHC build system.

Moreover two new licences were added, MPL and BSD2.

Due to Cabal-1.20 now
allows to strip libraries as well, this doesn't work well with
`ghc-cabal copy` being fed a `":"` strip-command argument which was
simply ignored in the past. The current code tries to retain this
semantics as backward compat. However, this needs more investigation as
I'm not sure if/why the `test_bindist` step doesn't want the libraries
to be stripped on installation.

Signed-off-by: Herbert Valerio Riedel <>
5 years agos/FromList/isList in docs
Joachim Breitner [Tue, 15 Apr 2014 13:33:39 +0000 (15:33 +0200)] 
s/FromList/isList in docs

This was reported by David Virebayre on haskell-cafe.

5 years agoTest Trac #8985
Simon Peyton Jones [Mon, 14 Apr 2014 12:06:22 +0000 (13:06 +0100)] 
Test Trac #8985

5 years agoHonour the untouchability of kind variables
Simon Peyton Jones [Mon, 14 Apr 2014 12:03:40 +0000 (13:03 +0100)] 
Honour the untouchability of kind variables

Trac #8985 showed up a major shortcoming in the kind unifier: it was
ignoring untoucability.  This has unpredictably-bad consequences;
notably, the skolem-escape check can fail.

There were two things wrong
 * TcRnMonad.isTouchableTcM was returning a constant value for kind variables
   (wrong), and even worse the constant was back-to-front (it was always False).

 * We weren't even calling isTouchableTcM in TcType.unifyKindX.

I'm not sure how this ever worked.

Merge to 7.8.3 in due course.

5 years agoA bit more trace information in an ASSERT failure
Simon Peyton Jones [Mon, 14 Apr 2014 11:48:31 +0000 (12:48 +0100)] 
A bit more trace information in an ASSERT failure

5 years agoTidy up trace message
Simon Peyton Jones [Mon, 14 Apr 2014 09:01:12 +0000 (10:01 +0100)] 
Tidy up trace message

5 years agoBetter layout for coercion error message
Simon Peyton Jones [Mon, 14 Apr 2014 08:59:08 +0000 (09:59 +0100)] 
Better layout for coercion error message

5 years agoUpdate Haddock submodule to follow LHsBindsLR changes
Herbert Valerio Riedel [Mon, 14 Apr 2014 07:04:31 +0000 (09:04 +0200)] 
Update Haddock submodule to follow LHsBindsLR changes

This submodule update was forgotten to be included in

Signed-off-by: Herbert Valerio Riedel <>
5 years agoTypos in comments
Gabor Greif [Sun, 13 Apr 2014 11:57:15 +0000 (13:57 +0200)] 
Typos in comments

5 years agoInstead of tracking Origin in LHsBindsLR, track it in MatchGroup
Dr. ERDI Gergo [Sat, 12 Apr 2014 11:36:31 +0000 (19:36 +0800)] 
Instead of tracking Origin in LHsBindsLR, track it in MatchGroup

5 years agoMake BlockAlloc.c comment slightly more accurate (fixes #8491)
Edward Z. Yang [Sun, 13 Apr 2014 08:09:40 +0000 (01:09 -0700)] 
Make BlockAlloc.c comment slightly more accurate (fixes #8491)

Signed-off-by: Edward Z. Yang <>
5 years agoFix linked list manipulation code (buggy on consecutive deletion)
Edward Z. Yang [Sun, 13 Apr 2014 06:02:13 +0000 (23:02 -0700)] 
Fix linked list manipulation code (buggy on consecutive deletion)

Signed-off-by: Edward Z. Yang <>
5 years agoExpected output of as-pattern test
Dr. ERDI Gergo [Sat, 12 Apr 2014 09:52:26 +0000 (17:52 +0800)] 
Expected output of as-pattern test

5 years agoAdd source file for new test that checks that as-patterns are rejected
Dr. ERDI Gergo [Sat, 12 Apr 2014 08:35:44 +0000 (16:35 +0800)] 
Add source file for new test that checks that as-patterns are rejected
in pattern synonym definitions

5 years agoRemove unused variable binding to fix validate
Dr. ERDI Gergo [Sat, 12 Apr 2014 00:57:27 +0000 (08:57 +0800)] 
Remove unused variable binding to fix validate

5 years agoUpdate Haddock submodule reference.
Mateusz Kowalczyk [Fri, 11 Apr 2014 18:15:07 +0000 (19:15 +0100)] 
Update Haddock submodule reference.

5 years agoFix #8641, creating directories when we have stubs.
Edward Z. Yang [Fri, 11 Apr 2014 01:28:11 +0000 (18:28 -0700)] 
Fix #8641, creating directories when we have stubs.

Signed-off-by: Edward Z. Yang <>
5 years agoSplit off pattern synonym definition checking from pattern inversion
Dr. ERDI Gergo [Thu, 10 Apr 2014 14:13:00 +0000 (22:13 +0800)] 
Split off pattern synonym definition checking from pattern inversion

5 years agoFix egregious blunder in the type flattener
Simon Peyton Jones [Wed, 9 Apr 2014 21:47:09 +0000 (22:47 +0100)] 
Fix egregious blunder in the type flattener

In tidying up the flattener I introduced an error that no
regression test caught, giving rise to Trac #8978, #8979.
It shows up if you have a type synonym whose RHS mentions
type functions, such sas
     type family F a
     type T a = (F a, a)   -- This synonym isn't properly flattened

The fix is easy, but sadly the bug is in the released GHC 7.8.1

5 years agoSuppress uniques to stop output wobbling (test for Trac #8958)
Simon Peyton Jones [Wed, 9 Apr 2014 21:40:22 +0000 (22:40 +0100)] 
Suppress uniques to stop output wobbling (test for Trac #8958)

5 years agoFix #5435, adding new test config check_stdout.
Edward Z. Yang [Wed, 9 Apr 2014 09:32:21 +0000 (02:32 -0700)] 
Fix #5435, adding new test config check_stdout.

check_stdout(f) allows you to override the test framework's
diff based output checking with another mechanism.  f is
a function which takes two arguments: the first is the
filename containing the observed stdout, the second is the
normaliser that would have been applied (in case you want
to read, normalise, and then do something.)

Signed-off-by: Edward Z. Yang <>
5 years agoImprove error reporting for untouchable type variables
Simon Peyton Jones [Tue, 8 Apr 2014 16:37:45 +0000 (17:37 +0100)] 
Improve error reporting for untouchable type variables

This change adds a suggestion
    Possible fix: add a type signature for â€˜f’
when we have a GADT-style definition with a
type we can't figure out.

See Note [Suggest adding a type signature] in TcErrors.

This initially came up in the discussion of Trac #8968.

5 years agoTest Trac #8963
Simon Peyton Jones [Tue, 8 Apr 2014 15:28:56 +0000 (16:28 +0100)] 
Test Trac #8963

5 years agoRefactor in worker/wrapper generation
Simon Peyton Jones [Tue, 8 Apr 2014 15:28:31 +0000 (16:28 +0100)] 
Refactor in worker/wrapper generation

I don't think there should be any change in behaviour, but
the code is clearer now.  Function checkSize is elimiated
in favour of doing those checks before (rather than after)

5 years agoAllow a longer demand signature than arity
Simon Peyton Jones [Tue, 8 Apr 2014 15:20:11 +0000 (16:20 +0100)] 
Allow a longer demand signature than arity

See Note [Demand analysis for trivial right-hand sides] in DmdAnal.
This allows a function with arity 2 to have a DmdSig with 3 args;
which in turn had a knock-on effect, which showed up in the test for
Trac #8963.

In fact it seems entirely reasonable, so this patch removes the
WARN and CoreLint checks that were complaining.

5 years agoDon't preprocess .s files
Simon Marlow [Tue, 8 Apr 2014 09:21:27 +0000 (10:21 +0100)] 
Don't preprocess .s files

One important reason is that gcc 4.8.1 sometimes crashes:

Another reason is that preprocessing assembly files unnecessarily
slows down compilation.

5 years agoAdd comments & notes explaining the typing of pattern synonym definitions
Dr. ERDI Gergo [Tue, 8 Apr 2014 14:29:23 +0000 (22:29 +0800)] 
Add comments & notes explaining the typing of pattern synonym definitions

5 years agoImprove documentation of GeneralisedNewtypeDeriving
Simon Peyton Jones [Tue, 8 Apr 2014 08:43:13 +0000 (09:43 +0100)] 
Improve documentation of GeneralisedNewtypeDeriving

5 years agoZonk the existential type variables in tcPatSynDecl
Simon Peyton Jones [Tue, 8 Apr 2014 08:42:51 +0000 (09:42 +0100)] 
Zonk the existential type variables in tcPatSynDecl

This was just an omission, which showed up as Trac #8966

5 years agoImprove tracing slightly
Simon Peyton Jones [Tue, 8 Apr 2014 08:41:20 +0000 (09:41 +0100)] 
Improve tracing slightly

5 years agoClarify bits about role inference in users' guide.
Richard Eisenberg [Tue, 8 Apr 2014 03:41:24 +0000 (23:41 -0400)] 
Clarify bits about role inference in users' guide.

5 years agousers_guide: note -XPatternSynonyms is required for use sites
Austin Seipp [Mon, 7 Apr 2014 15:15:05 +0000 (10:15 -0500)] 
users_guide: note -XPatternSynonyms is required for use sites

Signed-off-by: Austin Seipp <>
5 years agoDerive Typable for promoted data constructors (Trac #8950)
Simon Peyton Jones [Mon, 7 Apr 2014 14:45:35 +0000 (15:45 +0100)] 
Derive Typable for promoted data constructors (Trac #8950)

I got sucked into a significant refactoring of the way that
Typeable instances are derived.  This makes it simpler and
more uniform.

I also improved the documentation in the user manual.  Typeable
really is different to other classes, and now gets its own subsection.

5 years agoInclude LD_OPTS when building the RTS shared libs
Simon Marlow [Mon, 7 Apr 2014 12:51:29 +0000 (13:51 +0100)] 
Include LD_OPTS when building the RTS shared libs

5 years agoIgnore repeated loads of the same archive (#8942)
Simon Marlow [Mon, 7 Apr 2014 08:15:14 +0000 (09:15 +0100)] 
Ignore repeated loads of the same archive (#8942)

5 years agoUpdate long-out-of-date performance numbers on 32-bit
Simon Peyton Jones [Mon, 7 Apr 2014 14:22:46 +0000 (15:22 +0100)] 
Update long-out-of-date performance numbers on 32-bit

Many are improvements!

5 years agoSmall issue with signatures in a TH splice (fixes Trac #8932)
Simon Peyton Jones [Mon, 7 Apr 2014 14:22:11 +0000 (15:22 +0100)] 
Small issue with signatures in a TH splice (fixes Trac #8932)

5 years agoRequire PatternSynonyms language flag when encountering a use of pattern synonym
Dr. ERDI Gergo [Sun, 6 Apr 2014 13:26:46 +0000 (21:26 +0800)] 
Require PatternSynonyms language flag when encountering a use of pattern synonym

5 years agoAdd test case for #8950.
Richard Eisenberg [Sat, 5 Apr 2014 17:58:17 +0000 (13:58 -0400)] 
Add test case for #8950.

5 years agoFix #8958.
Richard Eisenberg [Sat, 5 Apr 2014 17:56:00 +0000 (13:56 -0400)] 
Fix #8958.

We now do role inference on stupid datatype contexts, allowing a
lightweight role annotation syntax.

5 years agoDisable thin archive support on Windows
Simon Marlow [Fri, 4 Apr 2014 16:02:20 +0000 (17:02 +0100)] 
Disable thin archive support on Windows

5 years agoTest return value of clock_gettime() for errors.
Simon Marlow [Tue, 1 Apr 2014 12:10:27 +0000 (13:10 +0100)] 
Test return value of clock_gettime() for errors.

I don't want to fall back to gettimeofday(), because that might have a
different absolute value.

5 years agoFix copy/paste error (#8937)
Simon Marlow [Tue, 1 Apr 2014 12:02:59 +0000 (13:02 +0100)] 
Fix copy/paste error (#8937)

5 years agowindows: Fix #8870
Austin Seipp [Fri, 4 Apr 2014 15:33:14 +0000 (10:33 -0500)] 
windows: Fix #8870

This bumps the amount of default reserved and committed stack for GHC
executables to 8mb, to work around #8870. A proper fix should happen in

See note [Windows stack usage] in SysTools for the details.

Signed-off-by: Austin Seipp <>
5 years agoRevert "Revert ad15c2, which causes Windows seg-faults (Trac #8834)"
Austin Seipp [Fri, 4 Apr 2014 15:33:03 +0000 (10:33 -0500)] 
Revert "Revert ad15c2, which causes Windows seg-faults (Trac #8834)"

This reverts commit a79613a75c7da0d3d225850382f0f578a07113b5.

5 years agoSimplify and tidy up the handling of tuple names
Simon Peyton Jones [Fri, 4 Apr 2014 07:41:35 +0000 (08:41 +0100)] 
Simplify and tidy up the handling of tuple names

This fixes Trac #8954.

There were actually three places where tuple occ-names
were parsed:
  - IfaceEnv.lookupOrigNameCache
  - Convert.isBuiltInOcc
  - OccName.isTupleOcc_maybe

I combined all three into TysWiredIn.isBuiltInOcc_maybe
Much nicer.

5 years agoWith AutoDeriveTypeable, derive for promoted constructors, too.
Richard Eisenberg [Fri, 4 Apr 2014 04:39:59 +0000 (00:39 -0400)] 
With AutoDeriveTypeable, derive for promoted constructors, too.

This addresses #8950. However, the problem isn't completely solved,
because the Prelude types' Typeable instances are not created by

5 years agoUpdate Haddock submodule
Mateusz Kowalczyk [Thu, 3 Apr 2014 20:21:12 +0000 (21:21 +0100)] 
Update Haddock submodule

5 years agoParse the variables in a type signature in the order given (Trac #8945)
Simon Peyton Jones [Thu, 3 Apr 2014 14:55:46 +0000 (15:55 +0100)] 
Parse the variables in a type signature in the order given (Trac #8945)

This is just making the parser behave more sensibly, and return
the list [x,y,z] from the signature
   x,y,z :: Int
rathe than [x,z,y] as now.

Turns out that the other use of sig_vars *did* do the right
thing already.

5 years agoTest Trac #8931
Simon Peyton Jones [Thu, 3 Apr 2014 12:34:52 +0000 (13:34 +0100)] 
Test Trac #8931

5 years agoFix desguaring of bang patterns (Trac #8952)
Simon Peyton Jones [Thu, 3 Apr 2014 12:30:59 +0000 (13:30 +0100)] 
Fix desguaring of bang patterns (Trac #8952)

A palpable bug, although one that will rarely bite

5 years agoMake sure that polykinded Typeable is defaultable (Trac #8931)
Simon Peyton Jones [Tue, 1 Apr 2014 13:34:11 +0000 (14:34 +0100)] 
Make sure that polykinded Typeable is defaultable (Trac #8931)

5 years agoUpdate Haddock submodule
Mateusz Kowalczyk [Tue, 1 Apr 2014 18:15:53 +0000 (19:15 +0100)] 
Update Haddock submodule

5 years agoSupport thin archive format
Simon Marlow [Fri, 28 Mar 2014 14:43:53 +0000 (14:43 +0000)] 
Support thin archive format

This is a patch from FB's internal build of GHC that I'm pushing

Author: Andrew Gallagher <>

This diff adds simple thin archive support to ghc's linker code, which
basically just entails finding the member data from disk rather than
from inside the archive (except for the case of the symbol index and
gnu filename index, where the member data is still inline).

5 years agoTemporarily fight off build bogons on OS X
Austin Seipp [Mon, 31 Mar 2014 11:47:44 +0000 (06:47 -0500)] 
Temporarily fight off build bogons on OS X

Right now there's a bug with Clang that prevents 'cabal haddock' from
working nicely. But there's an easy fix for now.

Signed-off-by: Austin Seipp <>
5 years agoUpdate Haddock submodule
Mateusz Kowalczyk [Mon, 31 Mar 2014 04:40:50 +0000 (05:40 +0100)] 
Update Haddock submodule

5 years agoAdd inline versions of copy ops for small arrays
Johan Tibell [Sun, 30 Mar 2014 13:12:01 +0000 (15:12 +0200)] 
Add inline versions of copy ops for small arrays

If the number of elements being copied is known statically this might
lead to the copy loop being unrolled in the backend.

5 years agoCopySmallArrayStressTest needs random
Joachim Breitner [Sat, 29 Mar 2014 20:08:17 +0000 (21:08 +0100)] 
CopySmallArrayStressTest needs random

5 years agoAdd more missing linker symbols
Johan Tibell [Sat, 29 Mar 2014 16:17:41 +0000 (17:17 +0100)] 
Add more missing linker symbols

5 years agoPrimOps.cmm: whitespace only
Johan Tibell [Fri, 28 Mar 2014 08:21:10 +0000 (09:21 +0100)] 
PrimOps.cmm: whitespace only

Harmonize the indentation amount. The file mixed 4, 2, and in some
cases 3 spaces for indentation.

5 years agoAdd missing symbols to linker
Johan Tibell [Sat, 29 Mar 2014 09:57:49 +0000 (10:57 +0100)] 
Add missing symbols to linker

The copy array family of primops were moved out-of-line.

5 years agoAdd SmallArray# and SmallMutableArray# types
Johan Tibell [Sun, 23 Mar 2014 11:06:56 +0000 (12:06 +0100)] 
Add SmallArray# and SmallMutableArray# types

These array types are smaller than Array# and MutableArray# and are
faster when the array size is small, as they don't have the overhead
of a card table. Having no card table reduces the closure size with 2
words in the typical small array case and leads to less work when
updating or GC:ing the array.

Reduces both the runtime and memory allocation by 8.8% on my insert
benchmark for the HashMap type in the unordered-containers package,
which makes use of lots of small arrays. With tuned GC settings
(i.e. `+RTS -A6M`) the runtime reduction is 15%.

Fixes #8923.

5 years agoRemove debugging output
Simon Marlow [Fri, 28 Mar 2014 09:09:38 +0000 (09:09 +0000)] 
Remove debugging output

5 years agoMake copy array ops out-of-line by default
Johan Tibell [Thu, 27 Mar 2014 17:04:56 +0000 (18:04 +0100)] 
Make copy array ops out-of-line by default

This should reduce code size when there's little to gain from inlining
these primops, while still retaining the inlining benefit when the
size of the copy is known statically.

5 years agorts: remove unused functions, fix validate on OS X
Austin Seipp [Thu, 27 Mar 2014 21:51:07 +0000 (16:51 -0500)] 
rts: remove unused functions, fix validate on OS X

After a toolchain update, Clang is no longer appreciative of the fact
these are unused, thanks to -Werror during validate.

Signed-off-by: Austin Seipp <>
5 years agoUse the correct callClobberedRegs on Windows/x64 (#8834)
Simon Marlow [Mon, 24 Mar 2014 14:36:16 +0000 (14:36 +0000)] 
Use the correct callClobberedRegs on Windows/x64 (#8834)

Signed-off-by: Austin Seipp <>
5 years agoincrease bounds for T3064
Simon Marlow [Thu, 27 Mar 2014 13:49:36 +0000 (13:49 +0000)] 
increase bounds for T3064

5 years agoUse LDFLAGS when compiling ghc-pwd
Simon Marlow [Thu, 27 Mar 2014 12:34:38 +0000 (12:34 +0000)] 
Use LDFLAGS when compiling ghc-pwd

5 years agoInclude SRC_CC_OPTS and SRC_LD_OPTS when compiling ghc-cabal
Simon Marlow [Thu, 27 Mar 2014 12:33:44 +0000 (12:33 +0000)] 
Include SRC_CC_OPTS and SRC_LD_OPTS when compiling ghc-cabal

5 years agoPass custom CC and LD opts to Cabal when configuring a package
Simon Marlow [Thu, 27 Mar 2014 12:29:48 +0000 (12:29 +0000)] 
Pass custom CC and LD opts to Cabal when configuring a package

Cabal compiles a program to check for the existence of foreign
libraries, so it needs to know our custom options, if any.

5 years agoInclude EXTRA_LD_OPTS (amongst other things) when linking programs
Simon Marlow [Tue, 25 Mar 2014 14:32:28 +0000 (14:32 +0000)] 
Include EXTRA_LD_OPTS (amongst other things) when linking programs

One problem was that we weren't including $1_$2_DIST_LD_OPTS when
linking a program, which looks to be accidental: it was being defined
but not used anywhere.  This meant that setting $1_$2_EXTRA_LD_OPTS,
for example, had no effect.

This commit straightens out the handling of LD_OPTS to be consistent
with the way we handle CC_OPTS and HC_OPTS.

5 years agoDon't perform permission checks for scripts named with -ghci-script (#6017)
Simon Marlow [Thu, 20 Mar 2014 21:47:22 +0000 (21:47 +0000)] 
Don't perform permission checks for scripts named with -ghci-script (#6017)

The user explicitly requested this script on the command-line, so it's
unnecessary to require that the script is also owned by the user.
Also, it is currently impossible to make a GHCi wrapper that invokes a
custom script without first making a copy of the script to circumvent
the permissions check, which seems wrong.

5 years ago--with-gcc overrides CC_STAGE0 when not cross-compiling (#8498)
Simon Marlow [Thu, 20 Mar 2014 15:47:18 +0000 (15:47 +0000)] 
--with-gcc overrides CC_STAGE0 when not cross-compiling (#8498)

5 years agoFixup help text
Simon Marlow [Thu, 20 Mar 2014 15:46:41 +0000 (15:46 +0000)] 
Fixup help text

5 years agoAdd flags to control memcpy and memset inlining
Johan Tibell [Wed, 26 Mar 2014 16:08:29 +0000 (17:08 +0100)] 
Add flags to control memcpy and memset inlining

This adds -fmax-inline-memcpy-insns and -fmax-inline-memset-insns.
These flags control when we inline calls to memcpy/memset with
statically known arguments. The flag naming style is taken from GCC
and the same limit is used by both GCC and LLVM.

5 years agoTypos in comments
Gabor Greif [Tue, 25 Mar 2014 21:52:13 +0000 (22:52 +0100)] 
Typos in comments

5 years agoSuppress uniques for simpl016 to normalise debug output
Simon Peyton Jones [Tue, 25 Mar 2014 14:59:38 +0000 (14:59 +0000)] 
Suppress uniques for simpl016 to normalise debug output

5 years agoTest Trac #8848
Simon Peyton Jones [Tue, 25 Mar 2014 14:34:44 +0000 (14:34 +0000)] 
Test Trac #8848

5 years agoComments only
Simon Peyton Jones [Tue, 25 Mar 2014 14:20:10 +0000 (14:20 +0000)] 
Comments only

5 years agoImprove the desugaring of RULE left-hand-sides (fixes Trac #8848)
Simon Peyton Jones [Tue, 25 Mar 2014 14:12:59 +0000 (14:12 +0000)] 
Improve the desugaring of RULE left-hand-sides (fixes Trac #8848)

I've added detailed comments with
  Note [Decomposing the left-hand side of a RULE]

The result is a noticeable improvement.  Previously

 * we rejected a perfectly decent SPECIALISE (Trac #8848)

 * and for something like
      f :: (Eq a) => b -> a -> a
      {-# SPECIALISE f :: b -> [Int] -> [Int] #-}
   we ended up with
      RULE  f ($fdEqList $dfEqInt) = f_spec
   whereas we wanted
      RULES forall (d:Eq [Int]). f d = f_spec

5 years agoEliminate redundant seq's (Trac #8900)
Simon Peyton Jones [Mon, 24 Mar 2014 14:22:50 +0000 (14:22 +0000)] 
Eliminate redundant seq's (Trac #8900)

This patch makes the simplifier eliminate a redundant seq like
    case x of y -> ...y....
where y is used strictly.  GHC used to do this, but I made it less
aggressive in

   commit 28d9a03253e8fd613667526a170b684f2017d299 (Jan 2013)

However #8900 shows that doing so sometimes loses good
transformations; and the transformation is valid according to "A
semantics for imprecise exceptions".  So I'm restoring the old

See Note [Eliminating redundant seqs]

5 years agorelnotes: GND is not -XSafe compatible.
Austin Seipp [Mon, 24 Mar 2014 11:07:27 +0000 (06:07 -0500)] 
relnotes: GND is not -XSafe compatible.

Signed-off-by: Austin Seipp <>
5 years agoComments only
Simon Peyton Jones [Mon, 24 Mar 2014 08:27:20 +0000 (08:27 +0000)] 
Comments only

5 years agoImplicit parameters should not be allowed in class and instance declarations
Simon Peyton Jones [Fri, 21 Mar 2014 15:55:39 +0000 (15:55 +0000)] 
Implicit parameters should not be allowed in class and instance declarations

Trac #8912 pointed out that GHC 7.4 and 7.6 have omitted this test, although
7.2 and earlier had it.  This patch puts the test back in, and refactors a

5 years agoFlattener preserves synonyms, rewriteEvidence can drop buggy "optimisation"
Simon Peyton Jones [Fri, 21 Mar 2014 15:37:27 +0000 (15:37 +0000)] 
Flattener preserves synonyms, rewriteEvidence can drop buggy "optimisation"

There was a special case in rewriteEvidence, looking like:
  = return (Just (if ctEvPred old_ev `tcEqType` new_pred
                  then old_ev
                  else old_ev { ctev_pred = new_pred }))

But this was wrong: old_pred and new_pred might differ in the kind
of a TyVar occurrence, in which case tcEqType would not notice,
but we really, really want new_pred.  This caused Trac #8913.

I solved this by dropping the whole test, and instead making
the flattener preserve type synonyms. This was easy because
TcEvidence has TcTyConAppCo which (unlike) Coercion, handles

5 years agoDebug tracing only
Simon Peyton Jones [Fri, 21 Mar 2014 15:33:10 +0000 (15:33 +0000)] 
Debug tracing only

5 years agoFor equalities with incompatible kinds, new IrredCan goes in the inert set, not work...
Simon Peyton Jones [Fri, 21 Mar 2014 15:32:58 +0000 (15:32 +0000)] 
For equalities with incompatible kinds, new IrredCan goes in the inert set, not work list

This change makes the code for canIrred markedly simpler (and more efficient)
See Note [Equalities with incompatible kinds].

I don't think there was really a bug here, but I came across it when
fixing Trac #8913

5 years agoComments only
Simon Peyton Jones [Fri, 21 Mar 2014 15:26:11 +0000 (15:26 +0000)] 
Comments only

5 years agoDon't export isTcReflCo_maybe (unused)
Simon Peyton Jones [Fri, 21 Mar 2014 15:25:30 +0000 (15:25 +0000)] 
Don't export isTcReflCo_maybe (unused)

5 years agoAdd missing kind-check for tcEqType on forall-types
Simon Peyton Jones [Fri, 21 Mar 2014 15:24:49 +0000 (15:24 +0000)] 
Add missing kind-check for tcEqType on forall-types

This wasn't showing up as a bug, but it was definitely wrong.

5 years agoRevert "change deriveConstants to use nm in a POSIX way (fixes #8781)"
Austin Seipp [Mon, 24 Mar 2014 07:14:09 +0000 (02:14 -0500)] 
Revert "change deriveConstants to use nm in a POSIX way (fixes #8781)"

It causes a failure on Windows right now.

This reverts commit 045b28033a33a48d31951240a8cb35f2b78345dc.

5 years agoRevert "Fix #8745 - GND is now -XSafe compatible."
Austin Seipp [Mon, 24 Mar 2014 04:45:22 +0000 (23:45 -0500)] 
Revert "Fix #8745 - GND is now -XSafe compatible."

See #8827 - for now, we're making GND unsafe again.

This also fixes the tests since they were originally not using the new
unicode quote style we're using.

This reverts commit a8a01e742434df11b830ab99af12d9045dfcbc4b.

5 years agoThe substitution is never needed, so don't prepare it
Gabor Greif [Sun, 23 Mar 2014 22:27:47 +0000 (23:27 +0100)] 
The substitution is never needed, so don't prepare it

5 years agoCatch a bunch of typos in comments
Gabor Greif [Sun, 23 Mar 2014 20:05:10 +0000 (21:05 +0100)] 
Catch a bunch of typos in comments

5 years agoFix typo
Gabor Greif [Sun, 23 Mar 2014 19:33:48 +0000 (20:33 +0100)] 
Fix typo