ghc.git
4 years agoTest Trac #10112
Simon Peyton Jones [Thu, 26 Feb 2015 17:27:15 +0000 (17:27 +0000)] 
Test Trac #10112

4 years agoImprove comments on coreView/tcView, and combine coreExpandTyCon/tcExpandTyCon
Simon Peyton Jones [Thu, 26 Feb 2015 17:26:56 +0000 (17:26 +0000)] 
Improve comments on coreView/tcView, and combine coreExpandTyCon/tcExpandTyCon

This is minor stuff triggered by Trac #10103.

* Fix outdated comments on tcView/coreView (we should really combine
  them with a new name, but I'll leave that slightly-disruptive change
  for now)

* Combine tcExpandTyCon_maybe and coreExpandTyCon_maybe (which were identical)
  into expandSynTyCon_maybe

* A few more comment fixups

4 years agoComments only
Simon Peyton Jones [Thu, 26 Feb 2015 16:41:12 +0000 (16:41 +0000)] 
Comments only

4 years agoExtend the docs for Data.List.transpose
Joachim Breitner [Mon, 2 Mar 2015 09:55:22 +0000 (10:55 +0100)] 
Extend the docs for Data.List.transpose

by giving a sufficient general example to explain what happens when the
rows are not of the same lengths. Thanks to Doug McIlroy for the
suggestoin. Fixes #10128.

4 years agoUpdate process submodule to 1.2.3.0 snapshot
Herbert Valerio Riedel [Fri, 27 Feb 2015 07:47:36 +0000 (08:47 +0100)] 
Update process submodule to 1.2.3.0 snapshot

This fixes the compilation failure

  libraries\process\System\Process\Internals.hs:36:5:
      Not in scope: `stopDelegateControlC'
      ...

(however, GHC HEAD skipped process-1.2.2 which has that issue)

4 years agoAllocationLimitExceeded should be a child of SomeAsyncException
Simon Marlow [Wed, 25 Feb 2015 09:31:18 +0000 (09:31 +0000)] 
AllocationLimitExceeded should be a child of SomeAsyncException

4 years agoAxe ModFinderCache, folding it into a generalized FinderCache.
Edward Z. Yang [Tue, 27 Jan 2015 23:55:52 +0000 (15:55 -0800)] 
Axe ModFinderCache, folding it into a generalized FinderCache.

Summary:
FinderCache is now keyed by a module, ModuleNames in the home package are
turned into Modules using thisPackage in the dynamic flags.  Simplifies some
code!

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate

Reviewers: simonpj, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D634

4 years agoFix comments, and a little reformatting
Simon Marlow [Tue, 24 Feb 2015 08:22:25 +0000 (08:22 +0000)] 
Fix comments, and a little reformatting

4 years agoUpdate submodule to Cabal 1.22.1.0 release
Herbert Valerio Riedel [Sun, 22 Feb 2015 17:04:27 +0000 (18:04 +0100)] 
Update submodule to Cabal 1.22.1.0 release

4 years agoEmulate GMP 5+ operations for GMP 4.x compat
Herbert Valerio Riedel [Sun, 22 Feb 2015 16:50:07 +0000 (17:50 +0100)] 
Emulate GMP 5+ operations for GMP 4.x compat

The following operations are only (officially) available starting with
GMP 5.0:

- `mpn_and_n`
- `mpn_andn_n`
- `mpn_ior_n`
- `mpn_xor_n`

In order to properly support GMP 4.x, we simply emulate those operation
in terms of `mpz_*` operations available in GMP 4.x (unless GMP>=5.x
available, obviously) while incurring some overhead. Ideally, GMP 4.x
environments will reach their EOL in the foreseeable future...

This fixes #10003

Reviewed By: austin

Differential Revision: https://phabricator.haskell.org/D675

4 years agodriver: split -fwarn-unused-binds into 3 flags (fixes #17)
Oleg Grenrus [Mon, 23 Feb 2015 14:51:28 +0000 (08:51 -0600)] 
driver: split -fwarn-unused-binds into 3 flags (fixes #17)

Summary: New flags:

 -fwarn-unused-top-binds
 -fwarn-unused-local-binds
 -fwarn-unused-pattern-binds

Test Plan: `tests/rename/should_compile/T17` tests

Correct other tests

Reviewers: austin, rwbarton

Reviewed By: austin, rwbarton

Subscribers: rwbarton, carter, thomie

Differential Revision: https://phabricator.haskell.org/D591

GHC Trac Issues: #17

4 years agoComment typo
Joachim Breitner [Mon, 23 Feb 2015 14:45:59 +0000 (15:45 +0100)] 
Comment typo

and reference to long-removed note in CallArity.hs

4 years agoSystem.IO.Error: Fix a documentation link to Control.Exception.Exception
Wieland Hoffmann [Mon, 5 Jan 2015 15:44:30 +0000 (16:44 +0100)] 
System.IO.Error: Fix a documentation link to Control.Exception.Exception

Instead of using double quotes (which are used to link to modules), use
single quotes (that are used to link, among others, to link to types,
which C.E.Exception is).

Signed-off-by: Austin Seipp <austin@well-typed.com>
4 years agotestsuite: update .gitignore
Austin Seipp [Mon, 23 Feb 2015 14:07:44 +0000 (08:07 -0600)] 
testsuite: update .gitignore

Signed-off-by: Austin Seipp <austin@well-typed.com>
4 years agoProvide a faster implementation for the Read Integer instance
Marios Titas [Mon, 23 Feb 2015 12:46:25 +0000 (06:46 -0600)] 
Provide a faster implementation for the Read Integer instance

Summary:
The current implementation of the Read Integer instance has quadratic
complexity and thus performs badly on large inputs. This patch provides a
rather simple sub-quadratic algorithm. For small inputs, we use the old
algorithm (there is a small penalty for that). The gains for large
inputs can be dramatic: on my system, the time to perform
    read (take 1000000 $ cycle "1234567890") :: Integer
drops from 65 seconds to less than a second.

Note that we already provide an ad-hoc instance for Show Integer, so this
patch essentially does the same thing for Read Integer.

Test Plan: Check that read :: String -> Integer returns correct results for inputs of various sizes.

Reviewers: austin, hvr

Reviewed By: austin, hvr

Subscribers: ekmett, thomie

Differential Revision: https://phabricator.haskell.org/D645

GHC Trac Issues: #10067

4 years agobase: Fix (**) implementation for Data.Complex
Alexander [Mon, 23 Feb 2015 11:44:33 +0000 (05:44 -0600)] 
base: Fix (**) implementation for Data.Complex

See the extensive discussion in #8539.

Signed-off-by: Austin Seipp <austin@well-typed.com>
4 years agoFix build bogons due to missing separator
Austin Seipp [Mon, 23 Feb 2015 11:48:15 +0000 (05:48 -0600)] 
Fix build bogons due to missing separator

Signed-off-by: Austin Seipp <austin@well-typed.com>
4 years agobase: fix broken link (#10088)
Austin Seipp [Mon, 23 Feb 2015 11:32:56 +0000 (05:32 -0600)] 
base: fix broken link (#10088)

Signed-off-by: Austin Seipp <austin@well-typed.com>
4 years agodocs: Flatten MAKEHELP/SUBMAKEHELP
Austin Seipp [Mon, 23 Feb 2015 11:21:11 +0000 (05:21 -0600)] 
docs: Flatten MAKEHELP/SUBMAKEHELP

There's no reason to have two files, and this is one step towards a
cleaner root directory.

Signed-off-by: Austin Seipp <austin@well-typed.com>
4 years agodocs: add INSTALL.md to root dir (#9926)
Austin Seipp [Mon, 23 Feb 2015 11:19:59 +0000 (05:19 -0600)] 
docs: add INSTALL.md to root dir (#9926)

This gives a very quick rundown on installation for end-users (HACKING
etc is for developers/possible contributors).

Signed-off-by: Austin Seipp <austin@well-typed.com>
4 years agoShow '#' on unboxed literals
Thomas Miedema [Mon, 23 Feb 2015 09:40:58 +0000 (03:40 -0600)] 
Show '#' on unboxed literals

Test Plan: deriving/should_run/T10104

Reviewers: austin, jstolarek

Reviewed By: austin, jstolarek

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D672

GHC Trac Issues: #10104

4 years agorts/linker: ignore unknown PE sections
Tamar Christina [Mon, 23 Feb 2015 09:40:43 +0000 (03:40 -0600)] 
rts/linker: ignore unknown PE sections

Summary: Currently the linker tries to see if it understands/knows every section in the PE file before it continues. If it encounters a section it doesn't know about it errors out. Every time there's a change in MinGW compiler that adds a new section to the PE file this will break the ghc linker. The new sections don't need to be understood by `ghc` to continue so instead of erroring out the section is just ignored. When running with `-debug` the sections that are ignored will be printed.

Test Plan:
See the file `ghcilinkerbug.zip` in #9907.

 1) unzip file content.
 2) open examplecpp.cabal and change base <4.8 to <4.9.
 3) execute cabal file with cabal repl.

Applying the patch makes `cabal repl` in step 3) work.

Note that the file will fail on a `___mingw_vprintf` not being found. This is because of the `cc-options` specifying `-std=c++0x`, which will also require `libmingwex.a` to be linked in but wasn't specified in the cabal file. To fix this, remove the `cc-options` which defaults to c99.

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D671

GHC Trac Issues: #9907, #7103, #10051, #7056, #8546

4 years agoDeclare some Makefile targets to be PHONY
Thomas Miedema [Mon, 23 Feb 2015 09:40:34 +0000 (03:40 -0600)] 
Declare some Makefile targets to be PHONY

Summary:
Given:
  a Makefile with a non-PHONY target called `target`
If:
  after running `make target`, a file exists with the same name as `target`
  (it was either already there, or it was created by running `make target`)
And:
  `target` has no dependencies, such as `clean`, that modify or delete that
  file
Then:
  subsequent invocations of `make target` will not have any effect.

Solution: make `target` PHONY.

BAD:
  ```
  foo:
          ...
          ./foo
  ```

BETTER:
  ```
  foo:
          ...
          ./foo
  .PHONY: foo
  ```

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D670

4 years agoAlways ignore user-package-db when running tests
Thomas Miedema [Mon, 23 Feb 2015 09:40:23 +0000 (03:40 -0600)] 
Always ignore user-package-db when running tests

Summary:
The user package database was already ignored for systems that
`have_subprocess`.

To [wiki:Debugging/InstallingPackagesInplace install] a package inplace:
`cabal install
  --with-compiler=<inplace-ghc>
  --with-package-db=<inplace-package-db>`
  <package>

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D668

4 years agoFix for ticket #10078: ensure that tcPluginStop is called even in case of type errors
Jan Bracker [Mon, 23 Feb 2015 09:40:15 +0000 (03:40 -0600)] 
Fix for ticket #10078: ensure that tcPluginStop is called even in case of type errors

Summary:
Remove unused variable that appeared through the fix for ticket #10078

Merge branch 'master' of git://git.haskell.org/ghc

Added comment with bug ID.

Reviewers: adamgundry, gridaphobe, austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D667

GHC Trac Issues: #10078

4 years agoMake top-level "configure" accept and propagate --with-curses-{includes,libraries...
PHO [Mon, 23 Feb 2015 09:40:05 +0000 (03:40 -0600)] 
Make top-level "configure" accept and propagate --with-curses-{includes,libraries} to libraries

Summary:
If curses is installed into some non-standard path, we currently have
to say something like the following in mk/build.mk:

  libraries/terminfo_CONFIGURE_OPTS += \
      --configure-option=--with-curses-includes=/somewhere/include \
      --configure-option=--with-curses-libraries=/somewhere/lib

This is because the top-level configure does not accept nor propagate
--with-curses-{includes,libraries} to libraries while it does so for
iconv, gmp and libffi. It would be nice if curses were handled in the
same manner.

Test Plan: Install curses into some non-standard path. Then run the top-level "configure" script with options "--with-curses-includes=/path/to/curses/include" and "--with-curses-libraries=/path/to/curses/lib".

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, PHO

Differential Revision: https://phabricator.haskell.org/D665

GHC Trac Issues: #10096

4 years agoError out on `Main` without `main` in GHCi (#7765)
Thomas Miedema [Mon, 23 Feb 2015 09:38:26 +0000 (03:38 -0600)] 
Error out on `Main` without `main` in GHCi (#7765)

Summary:
GHC does 2 validation checks for module `Main`:
* does `main` exist
* is `main` exported (#414)

The second check is done in ghc as well as in ghci (and runghc and ghc -e).
The first check however is currently not done in ghci, to prevent "'main' is
not in scope" errors when loading simple scripts. See commit d28ba8c8009 for
more information.

This commit tightens the special case for ghci. When the file does not contain
a main function, but does contain an explicit module header (i.e. "module Main
where"), then /do/ raise an error in ghci (and runghc and ghc -e) as well

Test Plan:
module/T7765: a module Main with an explicit module header but without a
main function should be an error for all Ways.

Additionaly: delete test module/mod174. It was added in commit 5a54c38, but it
is a duplicate of module/T414.

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D649

GHC Trac Issues: #7765

4 years agofix bus errors on SPARC caused by unalignment access to alloc_limit (fixes #10043)
Karel Gardas [Sat, 14 Feb 2015 21:46:47 +0000 (22:46 +0100)] 
fix bus errors on SPARC caused by unalignment access to alloc_limit (fixes #10043)

Reviewers: austin, simonmar

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D657

4 years ago{Data,Generic(1),MonadZip} instances for Identity
Herbert Valerio Riedel [Sun, 22 Feb 2015 14:21:18 +0000 (15:21 +0100)] 
{Data,Generic(1),MonadZip} instances for Identity

These instances were missed when the identity functor was added to
the `base` package (re #9664).

Reviewed By: ekmett

Differential Revision: https://phabricator.haskell.org/D674

4 years agoUnbreak travis by installing llvm-3.6
Joachim Breitner [Sat, 21 Feb 2015 14:42:39 +0000 (15:42 +0100)] 
Unbreak travis by installing llvm-3.6

4 years ago[ci skip] comment typo
Joachim Breitner [Mon, 2 Feb 2015 13:10:31 +0000 (14:10 +0100)] 
[ci skip] comment typo

4 years agoComments only
Simon Peyton Jones [Fri, 20 Feb 2015 08:52:12 +0000 (08:52 +0000)] 
Comments only

4 years agoComments only
Simon Peyton Jones [Fri, 13 Feb 2015 17:43:39 +0000 (17:43 +0000)] 
Comments only

4 years agoComments only
Simon Peyton Jones [Fri, 13 Feb 2015 13:53:14 +0000 (13:53 +0000)] 
Comments only

4 years agoAdd a bizarre corner-case to cgExpr (Trac #9964)
Simon Peyton Jones [Fri, 20 Feb 2015 08:49:32 +0000 (08:49 +0000)] 
Add a bizarre corner-case to cgExpr (Trac #9964)

David Feuer managed to tickle a corner case in the
code generator. See Note [Scrutinising VoidRep]
in StgCmmExpr.

I rejigged the comments in that area of the code generator
  Note [Dodgy unsafeCoerce 1]
  Note [Dodgy unsafeCoerce 2]
but I can't say I fully understand them, alas.

4 years agoDon't report instance constraints with fundeps as redundant
Simon Peyton Jones [Thu, 19 Feb 2015 23:14:17 +0000 (23:14 +0000)] 
Don't report instance constraints with fundeps as redundant

More subtlety due to functional dependencies.
Note [Redundant constraints in instance decls] in TcErrors.

Fixes Trac #10100.

4 years agofix T7600 run on bigendian platform
Karel Gardas [Thu, 19 Feb 2015 21:41:02 +0000 (22:41 +0100)] 
fix T7600 run on bigendian platform

4 years agoComments only
Simon Peyton Jones [Thu, 19 Feb 2015 20:53:55 +0000 (20:53 +0000)] 
Comments only

4 years agoFix #10045
Thomas Winant [Wed, 18 Feb 2015 16:13:37 +0000 (10:13 -0600)] 
Fix #10045

Summary:
SPJ's solution is to only bring the `TcId` (which includes the type) of a
binder into scope when it had a non-partial type signature.

Take care of this by only storing the `TcId` in `TcSigInfo` of non-partial
type signatures, hence the change to `sig_poly_id :: Maybe TcId`. Only in case
of a `Just` will we bring the `TcId` in scope. We still need to know the name
of the binder, even when it has a partial type signature, so add a `sig_name
:: Name` field. The field `sig_partial :: Bool` is no longer necessary, so
reimplement `isPartialSig` in terms of `sig_poly_id`.

Note that the new test case fails, but not because of a panic, but because the
`Num a` constraint is missing. Adding an extra-constraints wildcard to
`copy`'s signature would fix it.

Test Plan: validate

Reviewers: simonpj, austin

Reviewed By: simonpj

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D646

GHC Trac Issues: #10045

4 years agoTypo in function name
Gabor Greif [Wed, 18 Feb 2015 17:18:49 +0000 (18:18 +0100)] 
Typo in function name

4 years agoCleanup ghc-pkg
Thomas Miedema [Wed, 18 Feb 2015 15:46:49 +0000 (09:46 -0600)] 
Cleanup ghc-pkg

Summary:
* Delete dead code in ghc-pkg (not_yet ready since 2004)
* remove --auto-ghc-libs
Commit 78185538b (2011) mentions:
"Deprecate the ghc-pkg --auto-ghci-libs flag
It was never a universal solution. It only worked with the GNU linker.
It has not been used by Cabal for ages. GHCi can now load .a files so it will
not be needed in future."
"Warning: --auto-ghci-libs is deprecated and will be removed in GHC 7.4"

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D666

4 years agorunghc: be explicit about ghc version (#9054)
Thomas Miedema [Wed, 18 Feb 2015 15:46:40 +0000 (09:46 -0600)] 
runghc: be explicit about ghc version (#9054)

Summary: runghc-7.x should always call ghc-7.x

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D664

GHC Trac Issues: #9054

4 years agoDo not clobber CPPFLAGS nor LDFLAGS, fixes #10093
PHO [Wed, 18 Feb 2015 15:46:30 +0000 (09:46 -0600)] 
Do not clobber CPPFLAGS nor LDFLAGS, fixes #10093

Summary: Append -I/-L flags to CPPFLAGS/LDFLAGS instead of clobbering.

Test Plan: Install libiconv into /some/non-standard/path. Set CONF_GCC_LINKER_OPTS_STAGE{0,1,2} to -Wl,-rpath,/some/non-standard/path/lib. And then run ./configure with arguments --with-iconv-includes=/some/non-standard/path/include and --with-iconv-libraries=/some/non-standard/path/lib

Reviewers: hvr, austin

Reviewed By: austin

Subscribers: thomie, PHO

Differential Revision: https://phabricator.haskell.org/D663

GHC Trac Issues: #10093

4 years agoRevert "Eta-expand argument to foldr in mapM_ for []"
Austin Seipp [Tue, 17 Feb 2015 15:08:12 +0000 (09:08 -0600)] 
Revert "Eta-expand argument to foldr in mapM_ for []"

This change lacked justification (or a test!) for its improvements, and
I merged it on a sweep of Phabricator without fixing this. Trac #10034.

This reverts commit 7cf87fc6928f0252d9f61719e2344e6c69237079.

4 years agoAdd configurable verbosity level to hpc
Yuras Shumovich [Tue, 17 Feb 2015 14:39:54 +0000 (08:39 -0600)] 
Add configurable verbosity level to hpc

Summary:
All commands now have `--verbosity` flag, so one can configure
cabal package with `--hpc-options="--verbosity=0"`.

Right now it is used only in `hpc markup` to supress unnecessary
output.

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D660

GHC Trac Issues: #10091

4 years agoDelete vestigial external core code (#9402)
Thomas Miedema [Tue, 17 Feb 2015 14:39:43 +0000 (08:39 -0600)] 
Delete vestigial external core code (#9402)

Test Plan: harbormaster

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D659

GHC Trac Issues: #9402

4 years agoImprove outdated ghc-pkg cache warning (#9606)
Thomas Miedema [Tue, 17 Feb 2015 14:39:35 +0000 (08:39 -0600)] 
Improve outdated ghc-pkg cache warning (#9606)

Summary: No more frustration.

Test Plan: I tested it.

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D658

GHC Trac Issues: #9606

4 years agoDon't truncate traceEvents to 512 bytes (#8309)
Thomas Miedema [Tue, 17 Feb 2015 14:39:08 +0000 (08:39 -0600)] 
Don't truncate traceEvents to 512 bytes (#8309)

Summary:
Don't call postLogMsg to post a user msg, because it truncates messages to
512 bytes.

Rename traceCap_stderr and trace_stderr to vtraceCap_stderr and trace_stderr,
to signal that they take a va_list (similar to vdebugBelch vs debugBelch).

See #3874 for the original reason behind traceFormatUserMsg.

See the commit msg in #9395 (d360d440) for a discussion about using
null-terminated strings vs strings with an explicit length.

Test Plan:
Run `cabal install ghc-events` and inspect the result of `ghc-events show` on
an eventlog file created with `ghc -eventlog Test.hs` and `./Test +RTS -l`,
where Test.hs contains:

```
import Debug.Trace
main = traceEvent (replicate 510 'a' ++ "bcd") $ return ()
```

Depends on D655.

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D656

GHC Trac Issues: #8309

4 years agoAdd missing va_end to va_start
Thomas Miedema [Tue, 17 Feb 2015 14:37:49 +0000 (08:37 -0600)] 
Add missing va_end to va_start

Summary: See also ab9711d8.

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D655

4 years agoRemove RAWCPP_FLAGS (Task #9094)
Thomas Miedema [Tue, 17 Feb 2015 14:36:56 +0000 (08:36 -0600)] 
Remove RAWCPP_FLAGS (Task #9094)

Reviewers: carter, austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D648

GHC Trac Issues: #9094

4 years agoFix typo in error message
Gabor Greif [Tue, 17 Feb 2015 15:00:24 +0000 (16:00 +0100)] 
Fix typo in error message

4 years agoMove comments about evaluating the message to the top of the module
Simon Peyton Jones [Sun, 15 Feb 2015 20:22:57 +0000 (20:22 +0000)] 
Move comments about evaluating the message to the top of the module

The remarks apply equally to all the functions here (Trac #9795)

4 years agoImprove typechecking of RULEs, to account for type wildcard holes
Simon Peyton Jones [Sun, 15 Feb 2015 20:21:42 +0000 (20:21 +0000)] 
Improve typechecking of RULEs, to account for type wildcard holes

This fixes Trac #10072. Previously the type-hole constraint was
escaping to top level, but it belongs in the scope of the skolems
bound by the RULE.

4 years agoComments only
Simon Peyton Jones [Sun, 15 Feb 2015 20:14:54 +0000 (20:14 +0000)] 
Comments only

4 years agoImprove documentation of 'trace'
Simon Peyton Jones [Fri, 13 Feb 2015 23:10:18 +0000 (23:10 +0000)] 
Improve documentation of 'trace'

See Trac #9795.

4 years agoRefactor decideQuantification
Simon Peyton Jones [Fri, 13 Feb 2015 23:09:34 +0000 (23:09 +0000)] 
Refactor decideQuantification

Richard was interrogating me about decideQuantification yesterday.
I got a bit stuck on the promote_tvs part. This refactoring

 * simplifes the API of decideQuantification

 * move mkMinimalBySCs into decideQuantification (a better place for it)

 * moves promotion out of decideQuantification (where it didn't really
   fit), and comments much more fully what is going on with the promtion stuff

 * comments decideQuantification more fully

 * coments the EqPred case of quantifyPred more fully

It turned out that the theta returned by decideQuantification,
and hence by simplifyInfer, is now fully zonked, so I could remove
a zonking in TcBinds.

4 years agoTiny refactoring; no change in behaviour
Simon Peyton Jones [Thu, 12 Feb 2015 15:31:15 +0000 (15:31 +0000)] 
Tiny refactoring; no change in behaviour

4 years agoComments and white space; plus structurally avoiding the previously "egregious bug"
Simon Peyton Jones [Thu, 12 Feb 2015 14:12:43 +0000 (14:12 +0000)] 
Comments and white space; plus structurally avoiding the previously "egregious bug"

4 years agoPropagate ReturnTvs in matchExpectedFunTys
Richard Eisenberg [Wed, 11 Feb 2015 18:40:21 +0000 (13:40 -0500)] 
Propagate ReturnTvs in matchExpectedFunTys

This really should have done a while ago, with the ReturnTv factoring.
It's surprising that I can't tickle the bug!

Please merge to ghc-7.10.

4 years agoFix egregious typo in checkTauTvUpdate.
Richard Eisenberg [Wed, 11 Feb 2015 18:13:53 +0000 (13:13 -0500)] 
Fix egregious typo in checkTauTvUpdate.

The old code used an unzonked type in an occurs-check, which
would sometimes lead to an infinite loop.

Please merge to ghc-7.10.

4 years agoFix #10079 by recurring after flattening exposes a TyConApp.
Richard Eisenberg [Wed, 11 Feb 2015 18:06:15 +0000 (13:06 -0500)] 
Fix #10079 by recurring after flattening exposes a TyConApp.

Previously, try_decompose_nom_app was smart enough to recur if
flattening exposed a TyConApp, but try_decompose_repr_app was
not. Now, if neither type in try_decompose_repr_app is an AppTy,
recur.

Seems all straightforward enough to avoid a Note.

4 years agonameIsLocalOrFrom should include interactive modules
Simon Peyton Jones [Wed, 11 Feb 2015 10:55:10 +0000 (10:55 +0000)] 
nameIsLocalOrFrom should include interactive modules

The provoking cause was Trac #10019, but it revealed that nameIsLocalOrFrom
should really include all interactive modules (ones from the 'interactive'
package).  Previously we had some ad-hoc 'isInteractiveModule' tests with
some (but not all) the calls to nameIsLocalOrFrom.

See the new comments with Name.nameIsLocalOrFrom.

4 years agoDo not share T9878.hs between test T9878 and T9878b
Simon Peyton Jones [Wed, 11 Feb 2015 10:30:05 +0000 (10:30 +0000)] 
Do not share T9878.hs between test T9878 and T9878b

I think the sharing was giving a race condition in the test suite;
I got a failure from validate which went away when I ran the tests
individually.

4 years agoDo not complain about missing fields in Trac #10047
Simon Peyton Jones [Tue, 10 Feb 2015 23:22:34 +0000 (23:22 +0000)] 
Do not complain about missing fields in Trac #10047

4 years agoAdd a couple of tcTraces around reify
Simon Peyton Jones [Tue, 10 Feb 2015 21:07:43 +0000 (21:07 +0000)] 
Add a couple of tcTraces around reify

4 years agoMore comments and white space
Simon Peyton Jones [Tue, 10 Feb 2015 21:07:18 +0000 (21:07 +0000)] 
More comments and white space

4 years agoComments only
Simon Peyton Jones [Mon, 9 Feb 2015 15:33:40 +0000 (15:33 +0000)] 
Comments only

4 years agoRefactor the handling of quasi-quotes
Simon Peyton Jones [Tue, 10 Feb 2015 14:09:12 +0000 (14:09 +0000)] 
Refactor the handling of quasi-quotes

As Trac #10047 points out, a quasi-quotation [n|...blah...|] is supposed
to behave exactly like $(n "...blah...").  But it doesn't!  This was outright
wrong: quasiquotes were being run even inside brackets.

Now that TH supports both typed and untyped splices, a quasi-quote is properly
regarded as a particular syntax for an untyped splice. But apart from that
they should be treated the same.  So this patch refactors the handling of
quasiquotes to do just that.

The changes touch quite a lot of files, but mostly in a routine way.
The biggest changes by far are in RnSplice, and more minor changes in
TcSplice.  These are the places where there was real work to be done.
Everything else is routine knock-on changes.

* No more QuasiQuote forms in declarations, expressions, types, etc.
  So we get rid of these data constructors
    * HsBinds.QuasiQuoteD
    * HsExpr.HsSpliceE
    * HsPat.QuasiQuotePat
    * HsType.HsQuasiQuoteTy

* We get rid of the HsQuasiQuote type altogether

* Instead, we augment the HsExpr.HsSplice type to have three
  consructors, for the three types of splice:
    * HsTypedSplice
    * HsUntypedSplice
    * HsQuasiQuote
  There are some related changes in the data types in HsExpr near HsSplice.
  Specifically: PendingRnSplice, PendingTcSplice, UntypedSpliceFlavour.

* In Hooks, we combine rnQuasiQuoteHook and rnRnSpliceHook into one.
  A smaller, clearer interface.

* We have to update the Haddock submodule, to accommodate the hsSyn changes

4 years agoDon't overwrite input file by default
Phil Ruffwind [Mon, 9 Feb 2015 19:39:12 +0000 (13:39 -0600)] 
Don't overwrite input file by default

Summary:
If the default filename of the output executable coincides with that of main
source file, throw an error instead of silently clobbering the input file.

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D642

GHC Trac Issues: #9930

4 years agollvmGen: move to LLVM 3.6 exclusively
Ben Gamari [Mon, 9 Feb 2015 21:21:28 +0000 (15:21 -0600)] 
llvmGen: move to LLVM 3.6 exclusively

Summary:
Rework llvmGen to use LLVM 3.6 exclusively. The plans for the 7.12 release are to ship LLVM alongside GHC in the interests of user (and developer) sanity.

Along the way, refactor TNTC support to take advantage of the new `prefix` data support in LLVM 3.6. This allows us to drop the section-reordering component of the LLVM mangler.

Test Plan: Validate, look at emitted code

Reviewers: dterei, austin, scpmw

Reviewed By: austin

Subscribers: erikd, awson, spacekitteh, thomie, carter

Differential Revision: https://phabricator.haskell.org/D530

GHC Trac Issues: #10074

4 years agoAdd Uniquable instances for InstalledPackageId/SourcePackageId/PackageName
Edward Z. Yang [Mon, 9 Feb 2015 19:46:29 +0000 (13:46 -0600)] 
Add Uniquable instances for InstalledPackageId/SourcePackageId/PackageName

Summary: Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>

Test Plan: validate

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D633

4 years agoAdd a workaround to allow older cabal-install to use ghc-7.10
Duncan Coutts [Mon, 9 Feb 2015 19:46:06 +0000 (13:46 -0600)] 
Add a workaround to allow older cabal-install to use ghc-7.10

Summary:
This should smooth the upgrade process for people and help with testing
the 7.10 RCs. Otherwise people need to first install cabal-install-1.22
before they can use 7.10.

The problem is that older cabal still used file-style package dbs for
the inplace package db when building packages. The workaround is that
both ghc and ghc-pkg will notice when cabal tells them to use a file
style db e.g. "dist/package.conf.inplace" and, so long as that db is
empty (ie content is []) then they'll instead us a dir style db with
the same name but ".d" appended, so in this example that would be
"dist/package.conf.inplace.d". We have to use a separate dir rather
than transparently upgrading because old Cabal really assumes the path
is a file, and if it encounters a dir it will fail.

This seems to be enough for older Cabal to work, and may well be enough
for other scripts that create dbs using "echo [] > package.conf".

Test Plan:
validate and check new and old cabal can sucessfully install things,
including packages that have internal deps (ie using the inplace db)

Reviewers: hvr, tibbe, austin

Reviewed By: tibbe, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D628

4 years agoClarify the documentation for 'evaluate'
Roman Cheplyaka [Mon, 9 Feb 2015 19:44:03 +0000 (13:44 -0600)] 
Clarify the documentation for 'evaluate'

Summary:
See:

  https://www.haskell.org/pipermail/ghc-devs/2015-January/007900.html
  https://ghc.haskell.org/trac/ghc/ticket/5129#comment:17

Reviewers: hvr, Mikolaj, austin

Reviewed By: Mikolaj, austin

Subscribers: ezyang, nomeata, thomie

Differential Revision: https://phabricator.haskell.org/D615

4 years agoRemove deprecated libraries/base/include/Typeable.h
Thomas Miedema [Mon, 9 Feb 2015 19:42:53 +0000 (13:42 -0600)] 
Remove deprecated libraries/base/include/Typeable.h

Test Plan: I grepped for other references, there were none.

Reviewers: ekmett, hvr, austin

Reviewed By: austin

Subscribers: ekmett, thomie, carter

Differential Revision: https://phabricator.haskell.org/D483

4 years agoReplace .lhs with .hs in compiler comments
Yuri de Wit [Mon, 9 Feb 2015 19:41:02 +0000 (13:41 -0600)] 
Replace .lhs with .hs in compiler comments

Summary: It looks like during .lhs -> .hs switch the comments were not updated. So doing exactly that.

Reviewers: austin, jstolarek, hvr, goldfire

Reviewed By: austin, jstolarek

Subscribers: thomie, goldfire

Differential Revision: https://phabricator.haskell.org/D621

GHC Trac Issues: #9986

4 years agoProvide default implementation of `Monad(return)`
Herbert Valerio Riedel [Sun, 8 Feb 2015 19:56:58 +0000 (20:56 +0100)] 
Provide default implementation of `Monad(return)`

This was dropped last-minute from d94de87252d0fe2ae97341d186b03a2fbe136b04
(re #4834) together with the default implementation for `(>>)`
(see 65f887e1a0d864526f6a2609a3afc2c151c25e38 for explanation).

However, the risk of accidental mutually recursive definitions of
`return`/`pure` is rather low as unlike with the `(>>) = (*>)` default,
any cyclic definitions would necessarily wind up being new ones, rather
than changing the semantics for old operations and introducing bottoms.

On the other hand, not having the default method implementation in place
in GHC 7.10 would complicate/delay any future attempt to clean-up the
`Monad`-class.

This finally allows (for `base >= 4.8`) to define a F/A/M instance-chain
with the following minimal definitions (while ignoring that `return` is
still a class-method in `Monad`)

  instance Functor M where
    fmap  = ...

  instance Applicative M where
    pure  = ...
    (<*>) = ...

  instance Monad M where
    (>>=) = ...

Reviewed By: ekmett, austin

Differential Revision: https://phabricator.haskell.org/D647

4 years agoRemove the *o pattern in testsuite/.gitignore
Simon Peyton Jones [Fri, 6 Feb 2015 16:40:28 +0000 (16:40 +0000)] 
Remove the *o pattern in testsuite/.gitignore

It cause the entire testsuite/test/mdo directory to be ignored.
We already ignore *.o files.  Maybe there are some other suffixes
we need to add, but ignoring *o isn't good!

4 years agoFix Trac #10004: head [] exception when using recursive mdo
Simon Peyton Jones [Fri, 6 Feb 2015 16:38:52 +0000 (16:38 +0000)] 
Fix Trac #10004: head [] exception when using recursive mdo

4 years agoTest Trac #10041
Simon Peyton Jones [Fri, 6 Feb 2015 15:16:51 +0000 (15:16 +0000)] 
Test Trac #10041

4 years agoFix the nullary-type-class case for associated types
Simon Peyton Jones [Fri, 6 Feb 2015 15:04:50 +0000 (15:04 +0000)] 
Fix the nullary-type-class case for associated types

It was already ok for methods.
Fixes Trac #10020

4 years agoPut parens around (ty :: kind) when pretty-printing TH syntax
Simon Peyton Jones [Fri, 6 Feb 2015 14:48:33 +0000 (14:48 +0000)] 
Put parens around (ty :: kind) when pretty-printing TH syntax

See Note [Pretty-printing kind signatures] in Language.Haskell.TH.Ppr.hs,
and Trac #10050.

4 years agoComments only
Simon Peyton Jones [Fri, 6 Feb 2015 12:32:01 +0000 (12:32 +0000)] 
Comments only

4 years agoComments only
Simon Peyton Jones [Tue, 3 Feb 2015 15:40:42 +0000 (15:40 +0000)] 
Comments only

4 years agoMake -ddump-splices output to stdout (fixes #8796)
Alexander Vershilov [Thu, 5 Feb 2015 23:43:32 +0000 (17:43 -0600)] 
Make -ddump-splices output to stdout (fixes #8796)

Summary:
Fixes debug output so all info messages will use
stdout. Fixes #8796.

Make -ddump-splices output to stdout (fixes #8796)
Make -dverbose-core2core use stdout (fixes #8796)

Reviewers: simonpj, austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D627

GHC Trac Issues: #8796

4 years agoEta-expand argument to foldr in mapM_ for []
David Feuer [Thu, 5 Feb 2015 23:42:50 +0000 (17:42 -0600)] 
Eta-expand argument to foldr in mapM_ for []

Summary:
This improves performance, at least sometimes--the previous
implementation can be worse than the version in base 4.7. I
have not had the time to run benchmarks and such, but `mapM`
already does this.

Also, inline `mapM_`, like `mapM`.

Reviewers: hvr, nomeata, ekmett, austin

Reviewed By: ekmett, austin

Subscribers: thomie

Projects: #ghc

Differential Revision: https://phabricator.haskell.org/D632

GHC Trac Issues: #10034

4 years agoAdd packageName to GHC.Generics.Datatype
Oleg Grenrus [Thu, 5 Feb 2015 23:42:36 +0000 (17:42 -0600)] 
Add packageName to GHC.Generics.Datatype

Summary: Added packageName to GHC.Generics.Datatype class definition

Reviewers: hvr, dreixel, austin

Reviewed By: dreixel, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D631

GHC Trac Issues: #10030

4 years agoGRHS with empty wherebinds gets wrong SrcSpan
Alan Zimmerman [Thu, 5 Feb 2015 23:37:42 +0000 (17:37 -0600)] 
GRHS with empty wherebinds gets wrong SrcSpan

Summary:
When parsing a rhs, the GRHS is constructed via unguardedRHS which is
given a SrcSpan which only takes account of the '=' and wherebinds, so
does not include the exp when wherebinds are empty.

Test Plan: ./validate

Reviewers: hvr, austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D643

4 years agoBring Match m_fun_id_infix through the renamer.
Alan Zimmerman [Thu, 5 Feb 2015 23:36:57 +0000 (17:36 -0600)] 
Bring Match m_fun_id_infix through the renamer.

Summary:
This is a first step for #9988

It turns out that bringing m_fun_id_infix through the renamer is
actually very simple, affecting the internals of rnMatch' only.

Is this simple enough to hit 7.10.1?

Test Plan: ./validate

Reviewers: hvr, simonpj, austin

Reviewed By: simonpj, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D639

GHC Trac Issues: #9988

4 years agofix _FILE_OFFSET_BITS redefined warning on Solaris/i386 platform
Karel Gardas [Thu, 5 Feb 2015 23:35:45 +0000 (17:35 -0600)] 
fix _FILE_OFFSET_BITS redefined warning on Solaris/i386 platform

Summary:
The problem with Solaris is that system header files include
/usr/include/sys/feature_tests.h header file and it tests if
_FILE_OFFSET_BITS define is defined. If not, it defines it to 32
which is in conflict with 64 which we need for large file support.
The solution is easy, always include own header files before system header
files.

Reviewers: hvr, austin

Reviewed By: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D644

4 years agoFix a profiling bug
Simon Marlow [Wed, 28 Jan 2015 11:25:52 +0000 (11:25 +0000)] 
Fix a profiling bug

Summary:
We were erroneously discarding SCCs on function-typed variables.
These can affect the call stack, so we have to retain them.  The bug
was introduced during the recent SourceNote refactoring.

This is an alternative to the fix proposed in D616.  I also added the
scc005 test from that diff, which works with this change.

While I was here, I also fixed up the other profiling tests, marking a
few as expect_broken_for(10037) where the opt/unopt output differs in
non-fatal ways.

Test Plan: profiling tests

Reviewers: scpmw, ezyang, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D636

GHC Trac Issues: #10007

4 years agoFix #10017
Andreas Voellmy [Mon, 2 Feb 2015 15:50:52 +0000 (10:50 -0500)] 
Fix #10017

Summary:
In the threaded RTS, a signal is delivered from the RTS to Haskell
user code by writing to file that one of the IO managers watches (via
an instance of GHC.Event.Control.Control). When the IO manager
receives the signal, it calls GHC.Conc.Signal.runHandlers to invoke
Haskell signal handler. In the move from a single IO manager to one IO
manager per capability, the behavior was (wrongly) extended so that a
signal is delivered to every event manager (see #9423), each of which
invoke Haskell signal handlers, leading to multiple invocations of
Haskell signal handlers for a single signal. This change fixes this
problem by having the RTS (in generic_handler()) notify only the
Control instance used by the TimerManager, rather than all the
per-capability IO managers.

Reviewers: austin, hvr, simonmar, Mikolaj

Reviewed By: simonmar, Mikolaj

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D641

4 years agoUse strict atomicModifyIORef' (added in GHC 7.6).
Edward Z. Yang [Wed, 28 Jan 2015 00:20:54 +0000 (16:20 -0800)] 
Use strict atomicModifyIORef' (added in GHC 7.6).

Summary: Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>

Test Plan: validate

Reviewers: austin, hvr

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D635

4 years agoImprove error message on typed holes, and user manual (Tradc #10040)
Simon Peyton Jones [Wed, 28 Jan 2015 14:31:52 +0000 (14:31 +0000)] 
Improve error message on typed holes, and user manual (Tradc #10040)

4 years agoupdate submodule
Simon Marlow [Wed, 28 Jan 2015 11:34:26 +0000 (11:34 +0000)] 
update submodule

4 years agoFix #10031 by inverting a critical test in kick_out.
Richard Eisenberg [Tue, 27 Jan 2015 16:40:26 +0000 (11:40 -0500)] 
Fix #10031 by inverting a critical test in kick_out.

Summary:
The documentation (Note [The flattening story] in TcFlatten) was
correct; it's just the implementation that was not.

Test in typecheck/should_compile/T10031

Test Plan: validate

Reviewers: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D630

GHC Trac Issues: #10031

4 years agoAdd cost semantics for STG profiling.
Edward Z. Yang [Tue, 27 Jan 2015 18:43:57 +0000 (10:43 -0800)] 
Add cost semantics for STG profiling.

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
4 years agoRTS : Fix StgRun for aarch64-linux (#9935).
Erik de Castro Lopo [Mon, 26 Jan 2015 23:12:49 +0000 (10:12 +1100)] 
RTS : Fix StgRun for aarch64-linux (#9935).

Summary:
The GCC assembler doesn't seem to recognise the 'fp' and 'lr' register
names which are aliases for 'x29' and 'x30' respectively.

Depends on D598.

Test Plan: validate

Reviewers: lukexi, bgamari, austin

Reviewed By: austin

Subscribers: carter, thomie

Differential Revision: https://phabricator.haskell.org/D599

GHC Trac Issues: #9935

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

Reviewed By: nomeata

Differential Revision: https://phabricator.haskell.org/D602

4 years agoRevert "Update Haddock submodule"
Herbert Valerio Riedel [Fri, 23 Jan 2015 07:27:38 +0000 (08:27 +0100)] 
Revert "Update Haddock submodule"

This reverts commit 34d68d8e83676c5010e9bc5d4619f24879f222af
as it breaks the build:

  Configuring hsc2hs-0.67...
  Configuring ghc-cabal-0.1...
  Configuring parallel-3.2.0.6...
  Configuring hpc-bin-0.67...
  Configuring haddock-2.16.0...
  ghc-cabal: At least the following dependencies are missing:
  ghc >=7.9 && <7.11
  make[1]: *** [utils/haddock/dist/package-data.mk] Error 1
  make[1]: *** Waiting for unfinished jobs....
    GHC PKG libraries/parallel/dist-install/package-data.mk
  Reading package info from "libraries/parallel/dist-install/inplace-pkg-config" ... done.
  parallel-3.2.0.6: Warning: haddock-interfaces: /srv/builds/commits/rGHC/B3035-34d68d8e83676c5010e9bc5d4619f24879f222af/libraries/parallel/dist-install/doc/html/parallel/parallel.haddock doesn't exist or isn't a file
  parallel-3.2.0.6: cannot find any of ["Control/Seq.hi","Control/Seq.p_hi","Control/Seq.dyn_hi"] (ignoring)
  parallel-3.2.0.6: cannot find any of ["Control/Parallel.hi","Control/Parallel.p_hi","Control/Parallel.dyn_hi"] (ignoring)
  parallel-3.2.0.6: cannot find any of ["Control/Parallel/Strategies.hi","Control/Parallel/Strategies.p_hi","Control/Parallel/Strategies.dyn_hi"] (ignoring)
  parallel-3.2.0.6: cannot find any of ["libHSparal_791B1zx5CJ25cUOFECtmw0.a","libHSparal_791B1zx5CJ25cUOFECtmw0.p_a","libHSparal_791B1zx5CJ25cUOFECtmw0-ghc7.11.20150123.so","libHSparal_791B1zx5CJ25cUOFECtmw0-ghc7.11.20150123.dylib","HSparal_791B1zx5CJ25cUOFECtmw0-ghc7.11.20150123.dll"] on library path (ignoring)
  make: *** [all] Error 2

Moreover, utils/haddock is supposed to track the `ghc-head` branch
(which is what `git submodule update --remote utils/haddock` helps with)

4 years agoUpdate Haddock submodule
Mateusz Kowalczyk [Fri, 23 Jan 2015 00:14:00 +0000 (00:14 +0000)] 
Update Haddock submodule