4 years agoSplit stripTicks into expression editing and tick collection ghc-7.10.1-rc2
Peter Wortmann [Mon, 19 Jan 2015 13:57:19 +0000 (07:57 -0600)] 
Split stripTicks into expression editing and tick collection

As with stripTicksTop, this is because we often need the stripped
expression but not the ticks (at least not right away). This makes a big
difference for CSE, see #9961.

Signed-off-by: Austin Seipp <>
(cherry picked from commit 55199a97c020761ff4bfdc06da0042e43bede697)

4 years agoAPI Annotations documentation update, parsing issue, add example test
Alan Zimmerman [Mon, 19 Jan 2015 14:15:18 +0000 (08:15 -0600)] 
API Annotations documentation update, parsing issue, add example test

Add a reference note to each AnnKeywordId haddock comment so GHC
developers will have an idea why they are there.

Add a new test to ghc-api/annotations to serve as a template for other
GHC developers when they need to update the parser. It provides output
which checks that each SrcSpan that an annotation is attached to
actually appears in the `ParsedSource`, and lists the individual
annotations. The idea is that a developer writes a version of this
which parses a sample file using whatever syntax is changed in
Parser.y, and can then check that all the annotations come through.

Depends on D538

Test Plan: ./validate

Reviewers: simonpj, hvr, austin

Reviewed By: austin

Subscribers: thomie, jstolarek

Differential Revision:

(cherry picked from commit 851ed7211fb18fea938be84c99b6389f6762b30d)

4 years agoAPI Annotations tweaks.
Alan Zimmerman [Thu, 15 Jan 2015 19:11:21 +0000 (13:11 -0600)] 
API Annotations tweaks.

HsTyLit now has SourceText

Update documentation of HsSyn to reflect which annotations are attached to which element.

Ensure that the parser always keeps HsSCC and HsTickPragma values, to
be ignored in the desugar phase if not needed

Bringing in SourceText for pragmas

Add Location in NPlusKPat

Add Location in FunDep

Make RecCon payload Located

Explicitly add AnnVal to RdrName where it is compound

Add Location in IPBind

Add Location to name in IEThingAbs

Add Maybe (Located id,Bool) to Match to track fun_id,infix
  This includes converting Match into a record and adding a note about why
  the fun_id needs to be replicated in the Match.

Add Location in KindedTyVar

Sort out semi-colons for parsing

  - import statements
  - stmts
  - decls
  - decls_cls
  - decls_inst

This updates the haddock submodule.

Test Plan: ./validate

Reviewers: hvr, austin, goldfire, simonpj

Reviewed By: simonpj

Subscribers: thomie, carter

Differential Revision:

(cherry picked from commit 11881ec6f8d4db881671173441df87c2457409f4)

4 years agoCorrect typos in comments to mkDataCon
Simon Peyton Jones [Mon, 12 Jan 2015 11:19:10 +0000 (11:19 +0000)] 
Correct typos in comments to mkDataCon

(cherry picked from commit 0afa37aa342c5c2087b225de76afa23cc2229d9f)

4 years agoMore comments on HsBang
Simon Peyton Jones [Sun, 11 Jan 2015 23:07:24 +0000 (23:07 +0000)] 
More comments on HsBang

In particular about the dcSrcBangs field of an imported DataCon

(cherry picked from commit c506f254b8e14fe422186322a580f9f7effca7f8)

4 years agoReturn a [HsImplBang] from dataConImplBangs even with NoDataConRep
Simon Peyton Jones [Fri, 9 Jan 2015 09:46:37 +0000 (09:46 +0000)] 
Return a [HsImplBang] from dataConImplBangs even with NoDataConRep

This fixes Trac #9969, a new crash in T7562 that I somehow missed when
fiddling with HsBang

(cherry picked from commit 327ce1d336c8fbdb068be900a187f96d1c60b851)

4 years agoImprove HsBang
Simon Peyton Jones [Thu, 8 Jan 2015 15:54:39 +0000 (15:54 +0000)] 
Improve HsBang

Provoked by questions from Johan

 - Improve comments, fix misleading stuff
 - Add commented synonyms for HsSrcBang, HsImplBang, and use them throughout
 - Rename HsUserBang to HsSrcBang
 - Rename dataConStrictMarks to dataConSrcBangs
          dataConRepBangs    to dataConImplBangs

This renaming affects Haddock in a trivial way, hence submodule update

(cherry picked from commit 9564bb8c84cbc0397a414e946cc8c28801f0fbe7)

4 years agoRespect package visibility when deciding wired in packages.
Edward Z. Yang [Mon, 19 Jan 2015 18:23:46 +0000 (10:23 -0800)] 
Respect package visibility when deciding wired in packages.

Previously, we would consider ALL versions of a wired-in package,
no matter if they were exposed or not, and pick the latest version.
This patch is a minor refinement on the behavior: now we try to
pick the wired in package from just the list of exposed packages,
and if there are no candidates fall back on the full list.  This
means that if you do:

    -hide-all-packages -package wired-in-OLD-VERSION

it will actually work by default (whereas previously you needed
to *explicitly* -ignore-package the newer version).  This is especially
useful for the 'ghc' package.  Fixes #9955.

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

Reviewers: simonpj, austin

Reviewed By: austin

Subscribers: carter, thomie

Differential Revision:

GHC Trac Issues: #9955

(cherry picked from commit 1f1595195443700b7c2708fa903969fa2f0a927b)

4 years agoMake the linker_unload test less fragile
Simon Marlow [Tue, 20 Jan 2015 11:59:25 +0000 (03:59 -0800)] 
Make the linker_unload test less fragile

Now it invokes the GHC API to load packages, rather than trying to do it
manually.  This should fix most of the issues we've had with this test,
and might make it work on Windows too.

(cherry picked from commit 6108d95a73f93d486223064ad72bf6bedc116cbd)

4 years agoImprove documentation of pattern synonyms, to reflect conclusion of Trac #9953
Simon Peyton Jones [Mon, 19 Jan 2015 11:58:54 +0000 (11:58 +0000)] 
Improve documentation of pattern synonyms, to reflect conclusion of Trac #9953

(cherry picked from commit 8e774ba1c0fb38a1e01d156734c8a1acf0b1e59b)

4 years agoRevert zipWith strictification (re #9949)
David Feuer [Fri, 23 Jan 2015 09:04:49 +0000 (10:04 +0100)] 
Revert zipWith strictification (re #9949)

Also remove foldr2/right rule to avoid possibly introducing
bottoms with rules.

This effectively reverts most of 488e95b433d4f7568aa89622c729e64aa3b6520d

(cherry picked from commit f44bbc83bab62f9a2d25e69d87c2b4af25318d52)

4 years agoUpdate Haddock submodule to `master` branch tip
Herbert Valerio Riedel [Fri, 23 Jan 2015 07:32:39 +0000 (08:32 +0100)] 
Update Haddock submodule to `master` branch tip

4 years agoUpdate binary submodule to release
Herbert Valerio Riedel [Thu, 22 Jan 2015 22:06:14 +0000 (23:06 +0100)] 
Update binary submodule to release

One highlight of is the new instance for `Natural`

(cherry picked from commit f2867dc52be69accec841dc8c4bbeb5e84edec51)

4 years agoRestore invariant in `Data (Ratio a)` instance
Herbert Valerio Riedel [Wed, 21 Jan 2015 07:21:36 +0000 (08:21 +0100)] 
Restore invariant in `Data (Ratio a)` instance

(2nd attempt, this time leaving the `Constr` using `":%"`)

The Data instance for `Ratio` just uses the raw `:%` constructor and
doesn't check that the result is reduced to normal form.

The fix is to add back the `Integral` constraint on the Data
instance (which was dropped in c409b6f30373535) and to use `%` rather
than `:%` in the `gfoldl` and `gunfold` implementation.

This restores the invariant and matches the behavior of "virtual
constructors" we've used to patch up such problems elsewhere.

This addresses #10011

(cherry picked from commit 3df429e29b6fabda12af71091ba4ad1360f49b44)

4 years agoUpdate submodule git branch for haddock
Herbert Valerio Riedel [Thu, 22 Jan 2015 15:24:46 +0000 (16:24 +0100)] 
Update submodule git branch for haddock

This is meta-information is used by commands such as e.g.

  git submodule update --remote util/haddock

[skip ci]

4 years agoRestore invariant in `Data (Ratio a)` instance
Herbert Valerio Riedel [Wed, 21 Jan 2015 07:21:36 +0000 (08:21 +0100)] 
Restore invariant in `Data (Ratio a)` instance

The Data instance for `Ratio` just uses the raw `:%` constructor and
doesn't check that the result is reduced to normal form.

The fix is to add back the `Integral` constraint on the Data
instance (which was dropped in c409b6f30373535) and to use `%` rather
than `:%` in the `gfoldl` and `gunfold` implementation.

This restores the invariant and matches the behavior of "virtual
constructors" we've used to patch up such problems elsewhere.

This addresses #10011

(cherry picked from commit 79b0d0e633af8302d2dd907663a4a231cd889b67)

4 years agoCMM: add a mechanism to import C .data labels
Sergei Trofimovich [Mon, 19 Jan 2015 22:27:06 +0000 (16:27 -0600)] 
CMM: add a mechanism to import C .data labels

This introduces new .cmm syntax for import:

    'import' 'CLOSURE' <identifier>;

Currently cmm syntax allows importing only function labels:

    import pthread_mutex_lock;

but sometimes ghc needs to import global gariables
or haskell closures:

    import ghczmprim_GHCziTypes_True_closure;
    import base_ControlziExceptionziBase_nestedAtomically_closure;
    import ghczmprim_GHCziTypes_False_closure;
    import sm_mutex;

It breaks on ia64 where there is a difference in
pointers to data and pointer to functions.

Patch fixes threaded runtime on ia64 where
dereference of 'sm_mutex' from CMM led to
incurrect location.

Exact breakage machanics are the same as in e18525fae273f4c1ad8d6cbe1dea4fc074cac721

Merge into the 7.10 branch

Signed-off-by: Sergei Trofimovich <>
Test Plan: passes ./validate, makes ghci work on ghc-7.8.4

Reviewers: simonmar, simonpj, austin

Reviewed By: austin

Subscribers: thomie

Differential Revision:

(cherry picked from commit d82f592522eb8e063276a8a8c87ab93e18353c6b)

4 years agoUpdate Cabal submodule to latest snapshot
Herbert Valerio Riedel [Mon, 19 Jan 2015 15:57:23 +0000 (16:57 +0100)] 
Update Cabal submodule to latest snapshot

4 years agoWe track branch 1.22 for GHC 7.10.x
Herbert Valerio Riedel [Mon, 19 Jan 2015 15:33:35 +0000 (16:33 +0100)] 
We track branch 1.22 for GHC 7.10.x

4 years ago#9957: fix docs for unticked promoted constructor warning
Austin Seipp [Mon, 19 Jan 2015 14:22:04 +0000 (08:22 -0600)] 
#9957: fix docs for unticked promoted constructor warning

Signed-off-by: Austin Seipp <>
4 years agoUpdate directory submodule to latest 1.2.2 snapshot
Herbert Valerio Riedel [Mon, 19 Jan 2015 13:39:57 +0000 (14:39 +0100)] 
Update directory submodule to latest 1.2.2 snapshot

(cherry picked from commit 8ce3871304d1f49e4f6fb0f3d9221d42f537848f)

4 years agoTrac #9878: Have StaticPointers support dynamic loading.
Alexander Vershilov [Mon, 12 Jan 2015 11:29:18 +0000 (05:29 -0600)] 
Trac #9878: Have StaticPointers support dynamic loading.

A mutex is used to protect the SPT.

unsafeLookupStaticPtr and staticPtrKeys in GHC.StaticPtr are made

SPT entries are removed in a destructor function of modules.

Authored-by: Facundo Domínguez <>
Authored-by: Alexander Vershilov <>
Test Plan: ./validate

Reviewers: austin, simonpj, hvr

Subscribers: carter, thomie, qnikst, mboes

Differential Revision:

GHC Trac Issues: #9878

(cherry picked from commit 7637810a93441d29bc84bbeeeced0615bbb9d9e4)

4 years agoMake AutoDeriveTypeable work for associated datatypes (fix #9999)
Jose Pedro Magalhaes [Mon, 19 Jan 2015 13:36:03 +0000 (13:36 +0000)] 
Make AutoDeriveTypeable work for associated datatypes (fix #9999)

(cherry picked from commit d839493991e508160d416311ba47b7a7e2d62aae)

4 years agoDwarf generation fixed pt 2
Peter Wortmann [Thu, 8 Jan 2015 21:19:56 +0000 (22:19 +0100)] 
Dwarf generation fixed pt 2

- Don't bracket HsTick expression uneccessarily
- Generate debug information in UTF8
- Reduce amount of information generated - we do not currently need
  block information, for example.

Special thanks to slyfox for the reports!

(cherry picked from commit 36df0988444bdf0555a842ce94f4d597b741923d)

4 years agoDon't hardcode the name "ghc" in versionedAppDir
Edsko de Vries [Wed, 14 Jan 2015 23:58:13 +0000 (17:58 -0600)] 
Don't hardcode the name "ghc" in versionedAppDir

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision:

(cherry picked from commit 6392df07e89304a4daeb1af379c051b03a39cda7)

4 years agoPackage environments
Edsko de Vries [Mon, 12 Jan 2015 11:22:22 +0000 (05:22 -0600)] 
Package environments

Summary: Package environments are files with package IDs that indicate which packages should be visible; see entry in user guide for details.

Reviewers: duncan, austin

Reviewed By: duncan, austin

Subscribers: carter, thomie

Differential Revision:

(cherry picked from commit 099b76769f02432d8efcd7881348e5f5b6b50787)

4 years agoPattern synonym names need to be in scope before renaming bindings (#9889)
Dr. ERDI Gergo [Wed, 17 Dec 2014 14:09:06 +0000 (22:09 +0800)] 
Pattern synonym names need to be in scope before renaming bindings (#9889)

I did a bit of refactoring at the same time, needless to say

(cherry picked from commit 5830fc449af6b2c0ef5be409fd3457114ae938ca)

4 years agoTrac #9384: fix increasing capabilites number for eventlog.
Alexander Vershilov [Sun, 18 Jan 2015 10:58:57 +0000 (10:58 +0000)] 
Trac #9384: fix increasing capabilites number for eventlog.

Event log had inconcistent support for increacing capabilies
number, as header were not inserted in capability buffer. It
resulted in a ghc-events crash (see #9384). This commit
fixes this issue by inserting required header when number
of capabilies grows.

Reviewers: simonmar, Mikolaj, trofi, austin

Reviewed By: Mikolaj, trofi, austin

Subscribers: carter, thomie

Differential Revision:

GHC Trac Issues: #9384

(cherry picked from commit 2edb4a7bd5b892ddfac75d0b549d6682a0be5c02)

4 years agoFix panics of PartialTypeSignatures combined with extensions
Thomas Winant [Mon, 12 Jan 2015 11:29:50 +0000 (05:29 -0600)] 
Fix panics of PartialTypeSignatures combined with extensions

Disallow wildcards in stand-alone deriving instances
(StandaloneDeriving), default signatures (DefaultSignatures) and
instances signatures (InstanceSigs).

Test Plan: validate

Reviewers: austin

Reviewed By: austin

Subscribers: carter, thomie, monoidal

Differential Revision:

GHC Trac Issues: #9922

(cherry picked from commit c9532f810a82c6395bc08fb77f2a895a50da86b5)

4 years agoTrac #9878: Make the static form illegal in interpreted mode.
Alexander Vershilov [Wed, 14 Jan 2015 23:58:30 +0000 (17:58 -0600)] 
Trac #9878: Make the static form illegal in interpreted mode.

The entries of the static pointers table are expected to exist as
object code. Thus we have ghci complain with an intelligible error
message if the static form is used in interpreted mode.

It also includes a fix to keysHashTable in Hash.c which could cause a
crash. The iteration of the hashtable internals was incorrect. This
patch has the function keysHashTable imitate the iteration in

Finally, we submit here some minor edits to comments and
GHC.StaticPtr.StaticPtrInfo field names.

Authored-by: Alexander Vershilov <alexander.vershilov@tweag.
Authored-by: Facundo Domínguez <>
Test Plan: ./validate

Reviewers: simonpj, hvr, austin

Reviewed By: austin

Subscribers: carter, thomie, qnikst, mboes

Differential Revision:

GHC Trac Issues: #9878

(cherry picked from commit fffbf0627c2c2ee4bc49f9d26a226b39a066945e)

4 years agoadd -th-file which generates a th.hs file
Greg Weber [Mon, 12 Jan 2015 11:16:37 +0000 (05:16 -0600)] 
add -th-file which generates a th.hs file

see Trac #8624

similar functionality is now available
with -ddump-to-file -ddump-splices

However, users are already accustomed to -ddump-splices
having a particular format, and this format is not completely valid code
The goal of -th-file is to dump valid Haskell code

Additionally, the convention of -ddump-to-file is to name the file after
the flag, so the file is .dump-splices
Given that the goal of the new flag is to generate valid Haskell,
The extension should be .hs

Additionally, -ddump-to-file effects all other dump flags

Test Plan:
look at the output of using the -th-file flag
and compare it to the output of using -ddump-to-file and -ddump-splices
I want to add test cases, but just need some pointers on getting started there

Reviewers: thomie, goldfire, simonpj, austin

Reviewed By: simonpj, austin

Subscribers: thomie, carter

Differential Revision:

GHC Trac Issues: #8624

(cherry picked from commit 07ace5c221adbb1675413a0fac300a9f7913c234)


4 years agoFix bad '... \\' escape in ghcversion.h generation
Herbert Valerio Riedel [Mon, 19 Jan 2015 11:18:02 +0000 (12:18 +0100)] 
Fix bad '... \\' escape in ghcversion.h generation

Today I learned about the peculiarities of escaping within

Turns out,

  echo 'foo \\'


  foo \\

rather than escaping the '\'. Curiously, if you need to escape a '
within single-quotes, here's how to do it

  echo 'foo '\'' bar'

which will emit

  foo ' bar

This fixes #10002

(cherry picked from commit 1289048eaf31915b9335c6f7e0b7b64625ab0ed5)

4 years agoUpdate bytestring submodule
Herbert Valerio Riedel [Mon, 19 Jan 2015 11:08:58 +0000 (12:08 +0100)] 
Update bytestring submodule

This pulls in

- (which is related to #9992)

(cherry picked from commit ff4733f4e0355085002a1f9053ba2276e92d2cb6)

4 years agoUpdate Cabal/directory/process/terminfo submodules
Herbert Valerio Riedel [Fri, 16 Jan 2015 22:37:50 +0000 (23:37 +0100)] 
Update Cabal/directory/process/terminfo submodules

4 years agoFix a terrible bug in the canonicaliser which led to an infinite loop
Simon Peyton Jones [Fri, 16 Jan 2015 14:18:34 +0000 (14:18 +0000)] 
Fix a terrible bug in the canonicaliser which led to an infinite loop

This fixes Trac #9971

(cherry picked from commit 854e7b8efdd7fe5fcba77e1e049e8a835f03b16a)

4 years agoRepsect the package name when checking for self-import
Simon Peyton Jones [Fri, 16 Jan 2015 14:17:14 +0000 (14:17 +0000)] 
Repsect the package name when checking for self-import

Fixes Trac #9997.

In doing this I tripped across the specialness of "this" in
PackageImports.  The magic constant (fsLit "this") is scattered across
the compiler and ought to be put in one place.  But where?

(cherry picked from commit fb7c311711c8851d0de1e40231150ad999ae9c2b)

4 years agoaclocal.m4: fix == bashism in FIND_LLVM_PROG
Tuncer Ayaz [Mon, 12 Jan 2015 11:14:45 +0000 (05:14 -0600)] 
aclocal.m4: fix == bashism in FIND_LLVM_PROG

(cherry picked from commit 0fa4240249058f327cfd283f9da2deb8dff664f1)

4 years agoAdd Eq, Ord, Show, and Read instances for Const
Fumiaki Kinoshita [Wed, 14 Jan 2015 11:41:30 +0000 (20:41 +0900)] 
Add Eq, Ord, Show, and Read instances for Const

As suggested in

this adds the following instances

 - `Show a => Show (Const a b)`
 - `Read a => Read (Const a b)`
 - `Eq a   => Eq   (Const a b)`
 - `Ord a  => Ord  (Const a b)`

The Read/Show instances are defined in such a way as if `Const` was defined
without record-syntax (i.e. as `newtype Const a b = Const a`)

Addresses #9984

(cherry picked from commit c71fb84b8c9ec9c1e279df8c75ceb8a537801aa1)

4 years agoOptimise scavenge_large_srt_bitmap
Simon Marlow [Tue, 13 Jan 2015 20:33:20 +0000 (20:33 +0000)] 
Optimise scavenge_large_srt_bitmap

Very large modules can sometimes contain very large SRT bitmaps (this
is a separate problem that I need to look into).  The large bitmaps
often contain a lot of zeros, so this patch skips over empty words in
the bitmap.

It makes a dramatic difference in the particular example that I saw,
where an old gen GC was taking 0.5s before this change and 0.07s after

(cherry picked from commit cf8e669ba622fade18f9977aa374fda25cb078e6)

4 years agoCompile the RTS with -g by default
Simon Marlow [Tue, 13 Jan 2015 20:23:35 +0000 (20:23 +0000)] 
Compile the RTS with -g by default

Having debugging info doesn't hurt performance, can be stripped from
binaries, and it's useful for debugging and profiling.

(cherry picked from commit adc542df23fd4c1766606ffcdced92beb1a192ce)

4 years agoAllow the linker to run concurrently with the GC
Simon Marlow [Fri, 19 Dec 2014 20:10:40 +0000 (20:10 +0000)] 
Allow the linker to run concurrently with the GC

(cherry picked from commit 24bbc3e7077f5f6cd51f118393e5342a4047978c)

4 years agoImprove documentation for -N and -qa (#9890)
Simon Marlow [Tue, 16 Dec 2014 11:42:42 +0000 (11:42 +0000)] 
Improve documentation for -N and -qa (#9890)

(cherry picked from commit 2a103c7d763c22dc9b0562dac1184ffb950da5ce)

4 years agoUpdate Cabal submodule to latest snapshot
Herbert Valerio Riedel [Mon, 12 Jan 2015 21:37:19 +0000 (22:37 +0100)] 
Update Cabal submodule to latest snapshot

(cherry picked from commit 8464fa29e677e6845ca96d21474840803218f0b9)

4 years agoUpdate pretty submodule to release
Herbert Valerio Riedel [Fri, 9 Jan 2015 22:53:19 +0000 (23:53 +0100)] 
Update pretty submodule to release

4 years agoFix #9243 so recompilation avoidance works with -fno-code
Edward Z. Yang [Sat, 27 Dec 2014 18:50:01 +0000 (10:50 -0800)] 
Fix #9243 so recompilation avoidance works with -fno-code

Where we track timestamps of object files, also track timestamps
for interface files.  When -fno-code -fwrite-interface is enabled, use
the interface file timestamp as an extra check to see if the files are
up-to-date.  We had to apply this logic to one-shot and make modes.

This fix would be good to merge into 7.10; it makes using -fno-code
-fwrite-interface for flywheel type checking usable.

Signed-off-by: Edward Z. Yang <>
Addresses #9243

(cherry picked from commit 2223e196b2dc5340d70e58be011c279d381b4319)

4 years agoDon't do a half-hearted recompilation check in compileOne
Edward Z. Yang [Sat, 27 Dec 2014 05:56:54 +0000 (21:56 -0800)] 
Don't do a half-hearted recompilation check in compileOne

The isNothing maybe_old_linkable check predates
48bc81ad466edfc80237015dbe5d78ba70eb5095, which fixed #481 by requiring
recompilation information to be passed in as an argument to compileOne.
As a result, the check here is redundant: the client has already taken
a look at the object file to see if it is available or not.

Signed-off-by: Edward Z. Yang <>
(cherry picked from commit af4d99803ea7676f88f250ad56a8c31c1c8cd5bc)

4 years agoPattern synonyms do work in GHCi now (see #9900)
Dr. ERDI Gergo [Fri, 9 Jan 2015 11:30:04 +0000 (19:30 +0800)] 
Pattern synonyms do work in GHCi now (see #9900)

(cherry picked from commit 6f818e083c8390b0c039bcebb6ec21b336d4173b)

4 years agoSupport pattern synonyms in GHCi (fixes #9900)
Dr. ERDI Gergo [Sun, 28 Dec 2014 03:51:00 +0000 (11:51 +0800)] 
Support pattern synonyms in GHCi (fixes #9900)

This involves recognizing lines starting with `"pattern "` as declarations,
keeping non-exported pattern synonyms in `deSugar`, and including
pattern synonyms in the result of `hscDeclsWithLocation`.

(cherry picked from commit 0cc0cc8688ddb53db65a73d7d562e9564cfad22b)

4 years agoFix system linker on Mac OS X
Peter Trommler [Mon, 29 Dec 2014 16:33:24 +0000 (11:33 -0500)] 
Fix system linker on Mac OS X

Flag `-l:` is GNU ld specific and not supported by the
Mac OS X link editor. So we create a temporary file name
lib<tmpname>.<so_ext> and link with the standard -l<tmpname>
option on Linux and OS X.

Fixes #9875

Test Plan: validate on Mac OS X

Reviewers: austin, hvr, ezyang

Reviewed By: ezyang

Subscribers: carter, thomie, ezyang

Differential Revision:

GHC Trac Issues: #9875

(cherry picked from commit b32c22760687a6a1a2e88fdba8de32f6951b5029)

4 years agoUpdate syntax of pattern synonym type signature in documentation (fixes #9967)
Dr. ERDI Gergo [Fri, 9 Jan 2015 11:29:28 +0000 (19:29 +0800)] 
Update syntax of pattern synonym type signature in documentation (fixes #9967)

(cherry picked from commit 68a5a784e71b7535aa7d739bf1b003e96267a021)

4 years agoFix `heapSizeSuggesionAuto` typo (#9934)
Herbert Valerio Riedel [Mon, 29 Dec 2014 08:14:05 +0000 (09:14 +0100)] 
Fix `heapSizeSuggesionAuto` typo (#9934)

This was introduced in 1617a10a (re #5364)

(cherry picked from commit 40561cd235f07d41904d2604ff7f0c942af4d35e)

4 years agoRelease note entry for `-fdefer-typed-holes`
Merijn Verstraaten [Fri, 9 Jan 2015 14:14:38 +0000 (15:14 +0100)] 
Release note entry for `-fdefer-typed-holes`

4 years agoUpdate Cabal submodule to release tag
Herbert Valerio Riedel [Fri, 9 Jan 2015 14:12:10 +0000 (15:12 +0100)] 
Update Cabal submodule to release tag

4 years agoUpdate Cabal submodule to latest 1.22 snapshot
Herbert Valerio Riedel [Sat, 3 Jan 2015 22:17:14 +0000 (23:17 +0100)] 
Update Cabal submodule to latest 1.22 snapshot

(cherry picked from commit d84742b0df27daa2b48464ca9e71f0101e9266cc)

4 years agoRun T9762 only if dynamic libraries are available
Joachim Breitner [Sat, 27 Dec 2014 15:01:54 +0000 (16:01 +0100)] 
Run T9762 only if dynamic libraries are available

(cherry picked from commit 1dcef98a77afa0f9dc73896b8d8cc7444e2e0039)

4 years agoUse directory-style database for bootstrapping database
Edward Z. Yang [Sat, 27 Dec 2014 15:57:30 +0000 (10:57 -0500)] 
Use directory-style database for bootstrapping database

This allows GHC HEAD to be bootstrapped using 7.10.

Addresses #9652

Signed-off-by: Edward Z. Yang <>
(cherry picked from commit 0899caab400e7a095528ea769a7e93a33717ae72)

4 years agoFix linker interaction between Template Haskell and HPC (#9762)
Reid Barton [Tue, 23 Dec 2014 21:53:16 +0000 (16:53 -0500)] 
Fix linker interaction between Template Haskell and HPC (#9762)

I'm not really happy about perpetuating the hackish fix for #8696,
but at least in the context of building with -fhpc, the performance
cost should be negligible.

I'm suspicious about PlainModuleInitLabel and the Windows stuff too,
but I don't know what it does / can't test it (respectively) so I'll
leave those alone for now.

Hopefully out-of-process TH will save us from these hacks some day.

The test is an adaptation of T8696. It's a bit more awkward since
I couldn't think of a way to get cross-module tickbox references
without optimizations (inlining), but ghci doesn't permit -O for
some reason.

(cherry picked from commit 3e3aa9258b521d362d3a51cb48969df3eeab4981)

4 years agoMake ghc -e not exit on valid import commands (#9905)
Reid Barton [Tue, 23 Dec 2014 20:22:01 +0000 (15:22 -0500)] 
Make ghc -e not exit on valid import commands (#9905)

Some Trues and Falses were mixed up due to Bool being used in
different senses in different parts of GHCi.

(cherry picked from commit 878910e1c4520732ab9d8372c1c81f00d484e48f)

4 years agoCopy GHC's config.guess/sub over libffi's versions
Herbert Valerio Riedel [Sat, 27 Dec 2014 08:11:16 +0000 (09:11 +0100)] 
Copy GHC's config.guess/sub over libffi's versions

This should address #9924 as GHC's config.guess/sub versions need to be
up to date anyway.

(cherry picked from commit 9ae78b0ac20199982b994122889a04c6124e01b2)

4 years agoTest earlier for self-import (Trac #9032)
Simon Peyton Jones [Tue, 23 Dec 2014 15:59:30 +0000 (15:59 +0000)] 
Test earlier for self-import (Trac #9032)

This patch makes the renamer check for self-import, especially when
dependencies change, because the typechecker can fall over if that

I'm still uneasy about *indirect* self-import, but I'll leave that for
another day

(cherry picked from commit edd233acc19d269385c1a870829e0916a3df8e88,
7a2c9dde24b72fe53216881867d5543e5a6f756c, and

4 years agoalways use 'mkdir -p' and fix missing dir (fixes #9876)
Joe Hillenbrand [Tue, 23 Dec 2014 15:15:20 +0000 (09:15 -0600)] 
always use 'mkdir -p' and fix missing dir (fixes #9876)

Summary: Signed-off-by: Joe Hillenbrand <>

Reviewers: thomie, austin

Reviewed By: thomie, austin

Subscribers: carter, thomie

Differential Revision:

GHC Trac Issues: #9876

(cherry picked from commit 9fc3aebd0920561d9d3c747e6b78591d332bed08)

4 years agoGroom comments related to StaticPointers.
Facundo Domínguez [Mon, 22 Dec 2014 21:15:36 +0000 (19:15 -0200)] 
Groom comments related to StaticPointers.

Reviewed By: austin

Differential Revision:

(cherry picked from commit c72f61c6d4dd779d61bd0ebc0b1211a84c5b9038)

4 years agoFix panic on :kind _ in GHCi (Trac #9879)
Thomas Winant [Tue, 23 Dec 2014 14:48:15 +0000 (08:48 -0600)] 
Fix panic on :kind _ in GHCi (Trac #9879)

Running `:kind _` in GHCi produced a panic, fix it by extracting the
wildcards. Now, `:kind _` produces `_ :: k0`. Unfortunately, a `0` is
added after the kind is tidied and I haven't found a way to get rid of

This does not fix the other panic involving TemplateHaskell mentioned
in #9879.

Test Plan: new test GHCiWildcardKind should pass

Reviewers: austin, simonpj

Reviewed By: austin

Subscribers: simonpj, carter, thomie, monoidal

Differential Revision:

GHC Trac Issues: #9879

(cherry picked from commit 6eb86a56135a9274d2c958a2ccf4df510c9dab86)

4 years agoRename NamedWildcards flag to NamedWildCards
Thomas Winant [Tue, 23 Dec 2014 14:48:29 +0000 (08:48 -0600)] 
Rename NamedWildcards flag to NamedWildCards

Mind the capital C. As there is already a flag RecordWildCards with a capital
C, we should at least try to be consistent in the spelling of WildCards.

Test Plan: validate

Reviewers: goldfire, simonpj, austin

Reviewed By: simonpj, austin

Subscribers: carter, thomie

Differential Revision:

(cherry picked from commit 089222c9d6798c79179264e5c77c31d5c460a880)

4 years agodwarf: sync getIdFromTrivialExpr with exprIsTrivial (test break028 and others)
Sergei Trofimovich [Tue, 23 Dec 2014 14:55:06 +0000 (08:55 -0600)] 
dwarf: sync getIdFromTrivialExpr with exprIsTrivial (test break028 and others)

The bug manifests when built with
    EXTRA_HC_OPTS += -g

+++ ./ghci.debugger/scripts/ 2014-12-19 23:08:46.199876621 +0000
@@ -0,0 +1,11 @@
+ghc-stage2: panic! (the 'impossible' happened)
+  (GHC version 7.9.20141219 for x86_64-unknown-linux):
+       getIdFromTrivialExpr x_alJ
+Please report this as a GHC bug:
+<interactive>:3:1: Not in scope: ‘g’
+<interactive>:3:3: Not in scope: data constructor ‘False’

Signed-off-by: Sergei Trofimovich <>
Reviewers: simonmar, austin, scpmw

Reviewed By: scpmw

Subscribers: carter, thomie

Differential Revision:

(cherry picked from commit 30fdf86eec34711be07c6771b02a6fc81ac99ee2)

4 years agofix spInfoSrcLoc field name
Facundo Domínguez [Mon, 22 Dec 2014 21:20:11 +0000 (19:20 -0200)] 
fix spInfoSrcLoc field name

(cherry picked from commit 1da2c0fcd1f9f00e25bed8a8abcc81e3f5b1de04)

4 years agoFix typo in GLASGOW_HASKELL_PATCHLEVEL2 macro ghc-7.10.1-rc1
Herbert Valerio Riedel [Mon, 22 Dec 2014 16:35:39 +0000 (17:35 +0100)] 

This typo slipped in through 3549c952b535803270872adaf87262f2df0295a4

(cherry picked from commit 3879bdf3afb00ff8569cba4648876652d1addadb)

4 years agoBump version to 7.10.0
Austin Seipp [Mon, 22 Dec 2014 15:46:08 +0000 (09:46 -0600)] 
Bump version to 7.10.0

Signed-off-by: Austin Seipp <>
4 years agoComments only
Simon Peyton Jones [Mon, 22 Dec 2014 12:43:58 +0000 (12:43 +0000)] 
Comments only

4 years agoFor :info, return all matching Names, rather than complaining about ambiguity
Simon Peyton Jones [Mon, 22 Dec 2014 12:00:10 +0000 (12:00 +0000)] 
For :info, return all matching Names, rather than complaining about ambiguity

This fixes Trac #9881, and gives more helpful output in the case of ambiguity.
Certainly more helpful than the positively-misleading error we get right now.

4 years agoUpdate containers submodule to release
Herbert Valerio Riedel [Mon, 22 Dec 2014 11:45:34 +0000 (12:45 +0100)] 
Update containers submodule to release

4 years agoUpdate pretty and random submodules
Herbert Valerio Riedel [Mon, 22 Dec 2014 11:44:33 +0000 (12:44 +0100)] 
Update pretty and random submodules

This updates those two packages to their most recent respective proper

4 years agoStrip leading whitespace before checking if a statement looks like a declaration...
Dr. ERDI Gergo [Mon, 22 Dec 2014 11:01:37 +0000 (19:01 +0800)] 
Strip leading whitespace before checking if a statement looks like a declaration (fixes #9914)

4 years agoAdd expected output to T9915 test
Dr. ERDI Gergo [Sun, 21 Dec 2014 08:19:42 +0000 (16:19 +0800)] 
Add expected output to T9915 test

4 years agoCheck dflags for language extensions when deciding if "foreign " and "deriving "
Dr. ERDI Gergo [Sun, 21 Dec 2014 07:07:43 +0000 (15:07 +0800)] 
Check dflags for language extensions when deciding if "foreign " and "deriving "
look like prefixes of valid declarations (fixes #9915)

4 years agotrac #9744, make program name and product version configurable through DynFlags/Settings
Luite Stegeman [Sat, 20 Dec 2014 00:30:08 +0000 (18:30 -0600)] 
trac #9744, make program name and product version configurable through DynFlags/Settings


This allows GHC API clients to use a package database and dynamic
library names that do not clash with those of the host GHC

This also updates the Haddock submodule.

Reviewers: hvr, austin

Reviewed By: austin

Subscribers: thomie, carter

Differential Revision:

4 years agoadd runMeta hook
Luite Stegeman [Sat, 20 Dec 2014 00:28:17 +0000 (18:28 -0600)] 
add runMeta hook

The runMeta hook can be used to override how metaprogramming expressions
are evaluated. It makes the metaprogramming request types explicit and
has access to the TcM monad. This makes it a much more convenient starting
point for implementing out of process Template Haskell than the existing
hscCompileCoreExpr hook.

Reviewers: hvr, edsko, austin, simonpj

Reviewed By: austin

Subscribers: thomie, carter

Differential Revision:

4 years agoUse a new $b prefix for pattern synonym builder names, instead of re-using $W from...
Dr. ERDI Gergo [Sat, 20 Dec 2014 13:34:08 +0000 (21:34 +0800)] 
Use a new $b prefix for pattern synonym builder names, instead of re-using $W from wrappers

4 years agoChange performance numbers for T3064
Richard Eisenberg [Sat, 20 Dec 2014 03:35:03 +0000 (22:35 -0500)] 
Change performance numbers for T3064

4 years agoOptimize flattener by trying to reduce a TF before reducing its args.
Richard Eisenberg [Thu, 18 Dec 2014 04:30:15 +0000 (23:30 -0500)] 
Optimize flattener by trying to reduce a TF before reducing its args.

This has a demonstrated 2x speed boost on the T9872{a,b,c} tests.

4 years agoImproved Backpack IR description. [skip ci]
Edward Z. Yang [Sat, 20 Dec 2014 02:23:52 +0000 (21:23 -0500)] 
Improved Backpack IR description. [skip ci]

Signed-off-by: Edward Z. Yang <>
4 years agoUpdate hoopl submodule to rls
Herbert Valerio Riedel [Fri, 19 Dec 2014 22:36:14 +0000 (23:36 +0100)] 
Update hoopl submodule to rls

[skip ci]

4 years agoUpdate Cabal submodule to latest 1.22 branch tip
Herbert Valerio Riedel [Fri, 19 Dec 2014 20:37:58 +0000 (21:37 +0100)] 
Update Cabal submodule to latest 1.22 branch tip

4 years agoUpdate directory submodule to latest snapshot
Herbert Valerio Riedel [Fri, 19 Dec 2014 20:36:18 +0000 (21:36 +0100)] 
Update directory submodule to latest snapshot

This pulls in

> make `getModificationTime` support sub-second resolution on windows

4 years agoUpdate Cabal submodule to latest 1.22 branch tip
Herbert Valerio Riedel [Fri, 19 Dec 2014 16:35:24 +0000 (17:35 +0100)] 
Update Cabal submodule to latest 1.22 branch tip

4 years agoAdd instance Lift Natural
Richard Eisenberg [Fri, 19 Dec 2014 15:29:54 +0000 (10:29 -0500)] 
Add instance Lift Natural

4 years agoAdd Jan Stolarek's test for Trac #9872
Simon Peyton Jones [Fri, 19 Dec 2014 15:25:51 +0000 (15:25 +0000)] 
Add Jan Stolarek's test for Trac #9872

4 years agoUpdate release notes for recent language and TH changes.
Richard Eisenberg [Fri, 19 Dec 2014 15:19:55 +0000 (10:19 -0500)] 
Update release notes for recent language and TH changes.

4 years agoClarify that declaration splices exist at top level only. (#9880)
Richard Eisenberg [Tue, 16 Dec 2014 22:21:42 +0000 (17:21 -0500)] 
Clarify that declaration splices exist at top level only. (#9880)

4 years agoMerge some instances from th-orphans.
Richard Eisenberg [Tue, 16 Dec 2014 22:17:06 +0000 (17:17 -0500)] 
Merge some instances from th-orphans.

4 years agoConsider equality contexts exotic, uninferrable by "deriving"
Richard Eisenberg [Tue, 16 Dec 2014 22:15:49 +0000 (17:15 -0500)] 
Consider equality contexts exotic, uninferrable by "deriving"

See comments in #8984. This takes back the fix for #6088.

4 years agoAdd Data.Version.makeVersion & `IsList Version`
Herbert Valerio Riedel [Fri, 19 Dec 2014 10:08:09 +0000 (11:08 +0100)] 
Add Data.Version.makeVersion & `IsList Version`

These two facilities provide some means to avoid the double-breakage caused by
first by the deprecation (see #2496), and then again by the actual future

See also

for details about this library addition.

Reviewed By: ekmett

Differential Revision:

4 years agoRelocate bash completion scripts to utils/
Jan Stolarek [Fri, 19 Dec 2014 10:10:50 +0000 (11:10 +0100)] 
Relocate bash completion scripts to utils/

4 years agoUpdate process and unix submodules
Herbert Valerio Riedel [Fri, 19 Dec 2014 09:57:03 +0000 (10:57 +0100)] 
Update process and unix submodules

This updates the submodules to the respective final releases,

 - `unix-`, and
 - `process-`

4 years agoSome Dwarf generation fixes
Peter Wortmann [Thu, 18 Dec 2014 20:11:23 +0000 (21:11 +0100)] 
Some Dwarf generation fixes

- Make abbrev offset absolute on Non-Mac systems
- Add another termination byte at the end of the abbrev section
  (readelf complains)
- Scope combination was wrong for the simpler cases
- Shouldn't have a "global/" in front of all scopes

4 years agoUpdate Cabal submodule to 1.22 version
Herbert Valerio Riedel [Thu, 18 Dec 2014 22:15:03 +0000 (23:15 +0100)] 
Update Cabal submodule to 1.22 version

4 years agoUpdate `bytestring` submodule
Herbert Valerio Riedel [Thu, 18 Dec 2014 20:49:17 +0000 (21:49 +0100)] 
Update `bytestring` submodule

this just pulls in the version bump to 0.10.6

4 years agoFix wrong-kind-of-family error message (Trac #9896)
Simon Peyton Jones [Thu, 18 Dec 2014 11:19:14 +0000 (11:19 +0000)] 
Fix wrong-kind-of-family error message (Trac #9896)

4 years agoAmend TcPluginM interface
Adam Gundry [Thu, 18 Dec 2014 08:04:20 +0000 (08:04 +0000)] 
Amend TcPluginM interface

Expose some new functions in TcPluginM and remove one, in the light of
experience writing plugins.  In particular, I've removed lookupRdrName
because using it to import modules containing instances leads to subtle
bugs; I've expanded on the lookupRdrNameInModuleForPlugins comments.

Test Plan: validate

Reviewers: simonpj, austin

Reviewed By: austin

Subscribers: goldfire, ezyang, carter, thomie, yav, gridaphobe

Differential Revision:


4 years agoUpdate Haddock submodule
Mateusz Kowalczyk [Thu, 18 Dec 2014 07:32:07 +0000 (07:32 +0000)] 
Update Haddock submodule