Optimise `Identity` instances with `coerce`

This also overrides all optional `Foldable` methods
(which would otherwise be default-implemented in terms of `foldMap`)
with supposedly optimally minimal implementations.

While at it, this also removes the redundant `{-# LANGUAGE CPP #-}`.

Reviewed By: austin, dfeuer

Differential Revision: https://phabricator.haskell.org/D467
rts: remove old-style field designator extension (#9396)

Authored-by: jrp

Signed-off-by: Austin Seipp <austin@well-typed.com>
The test runner now also works under the msys-native Python.

Msys binaries apply heuristics to escape paths in arguments intended for
non-msys binaries, which breaks timeout invocations, see #9626.

Signed-off-by: Austin Seipp <austin@well-typed.com>
Refactor: use System.FilePath.splitSearchPath

Summary:
To address #2521 ("Trailing colon on GHC_PACKAGE_PATH doesn't work with
ghc-pkg"), we were using a custom version of splitSearchPath (e4f46f5de). This
solution however caused issue #9698 ("GHC_PACKAGE_PATH should be more lenient
for empty paths").

This patch reverts back to System.FilePath.splitSearchPath (fixes #9698) and
adresses (#2521) by testing for a trailing search path separators explicitly
(instead of implicitly using empty search path elements).

Empty paths are now allowed (ignored on Windows, interpreted as current
directory on Posix systems), and trailing path separator still tack on the
user and system package databases.

Also update submodule filepath, which has a version of splitSearchPath which
handles quotes in the same way as our custom version did.

Test Plan:
$ GHC_PACKAGE_PATH=/::/home: ./ghc-pkg list
...
db stack: ["/",".","/home","<userdb>","<systemdb>"]
...

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, carter, simonmar

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

GHC Trac Issues: #2521, #9698
Update documentation for "Batch compiler mode"

Summary:
Since commit 7828bf3ea2ea34e7a3a8662f5f621ef706ffee5c
* --make is the default
* -c is a mode flag, except when used in combination with --make

Also:
* -C (generate C code) is only available in unregisterised mode.

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, carter

Differential Revision: https://phabricator.haskell.org/D427
Implement new Foldable methods for HsPatSynDetails

Summary: Also explicitly define foldl1 and foldr1, which should generally work better with list-specific versions.

Reviewers: austin

Reviewed By: austin

Subscribers: rwbarton, thomie, carter

Differential Revision: https://phabricator.haskell.org/D430
Turn CoreWriter into a newtype; fix comment

Summary:
Turn CoreWriter into a newtype. A comment claimed something is forced
before returning, but it's actually not. Change comment to match
reality.

Reviewers: xich, simonpj, ezyang, austin

Reviewed By: ezyang, austin

Subscribers: thomie, carter

Differential Revision: https://phabricator.haskell.org/D453
Add remaining <unknown>s and comments to .mailmap

Summary:
All done, except for these 2 empty commits:

$ git log --author=unknown --use-mailmap --oneline
7e5c2b2 [project @ 2001-12-06 10:17:35 by mbs] Established under cvs.
6456598 [project @ 2000-12-01 10:33:41 by cryder] Initial revision

Reviewers: hvr, austin

Reviewed By: austin

Subscribers: thomie, carter

Differential Revision: https://phabricator.haskell.org/D477
Filter input to abiHash early

Summary:
This is already done near the only call site so why not. It is ugly to
see it at 'abiHash' itself.

Test Plan: validate

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, carter

Differential Revision: https://phabricator.haskell.org/D491
template-haskell: Missing instances for Rational and ().

Test Plan: ./validate

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, carter

Differential Revision: https://phabricator.haskell.org/D492
add missing instances for Loc and a few missing Eq instances

Summary: This adds a few missing instances that can be automatically derived

Reviewers: hvr, goldfire, austin

Reviewed By: goldfire, austin

Subscribers: thomie, carter

Differential Revision: https://phabricator.haskell.org/D495
Only test for bug #9439 when llvm is installed

Reviewers: bgamari, austin

Reviewed By: austin

Subscribers: thomie, carter

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

GHC Trac Issues: #9807
Allow -dead_strip linking on platforms with .subsections_via_symbols

Summary:
This allows to link objects produced with the llvm code generator to be linked with -dead_strip. This applies to at least the iOS cross compiler and OS X compiler.

Signed-off-by: Moritz Angermann <moritz@lichtzwerge.de>

Test Plan: Create a ffi library and link it with -dead_strip. If the resulting binary does not crash, the patch works as advertised.

Reviewers: rwbarton, simonmar, hvr, dterei, mzero, ezyang, austin

Reviewed By: dterei, ezyang, austin

Subscribers: thomie, mzero, simonmar, ezyang, carter

Differential Revision: https://phabricator.haskell.org/D206
make TcRnMonad.lhs respect -ddump-to-file

Summary: allows things such as: -ddump-to-file -ddump-splices

Test Plan:
compile with flags -ddump-to-file -ddump-splices
verify that it does output an extra file

Try out other flags.
I noticed that with -ddump-tc there is some output going to file and some to stdout.

Reviewers: hvr, austin

Reviewed By: austin

Subscribers: simonpj, thomie, carter

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

GHC Trac Issues: #9126
use correct word size for shiftRightLogical and removeOp32

Summary:
shiftRightLogical used a host sized Word for the intermediate value,
which would produce the wrong result when cross compiling to a target
with a different word size than the host.

removeOp32 used the preprocessor to bake in word size assumptions,
rather than getting the target word size from DynFlags

Test Plan: validate

Reviewers: hvr, rwbarton, carter, austin

Reviewed By: austin

Subscribers: thomie, carter

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

GHC Trac Issues: #9736
compiler/main: fixes #9776

Test Plan: test T9776 under tests/driver

Reviewers: jstolarek, austin

Reviewed By: jstolarek, austin

Subscribers: jstolarek, thomie, carter

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

GHC Trac Issues: #9776
arm64: 64bit iOS and SMP support (#7942)

Signed-off-by: Austin Seipp <austin@well-typed.com>
ghc generates more user-friendly error messages

Test Plan: Compiled ghc fine.  Opened ghci and fed it invalid code.  It gave the improved error messages in response.

Reviewers: austin

Subscribers: thomie, simonpj, spacekitteh, rwbarton, simonmar, carter

Differential Revision: https://phabricator.haskell.org/D201
Make calling conventions in template haskell Syntax.hs consistent with those in ghc ForeignCall.hs
this impliments #9703 from ghc trac

Test Plan: still needs tests

Reviewers: cmsaperstein, ekmett, goldfire, austin

Reviewed By: goldfire, austin

Subscribers: goldfire, thomie, carter, simonmar

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

GHC Trac Issues: #9703
Make Data.Functor.Identity trustworthy again

Alas `{-# LANGUAGE Safe #-}` can't be used since `Data.Coerce` isn't "safe".
However, we use `coerce` just as an optimisation
(see also 4ba884bdd3a9521ea92fcda8f601a7d0f3537bc1 which broke the
safe-inferred status of `Data.Functor.Identity`), so this module at least
deserves `{-# LANGUAGE Trustworthy #-}`.

NOTE: `Data.Functor.Identity` was added to `base` in the context of #9664

Reviewed By: luite

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