Move expansion of 'assert' from renamer to typechecker

This improves error messages when there is a type error,
fixing Trac #9774
Remove unused tyConsOfDataCon
Make tyConsOfType return a (NameEnv TyCon) rather than [TyCon]

A little refactoring
Comments and white space only
Give T3064 the right module name (just tidying up)
Switch off lazy flattening (fix Trac #3064)

See Note [Lazy flattening] in TcFlatten.

Lazy flattening was an apparently good idea which actually made
the type inference engine go a LOTS slower in T3064.  So I switched
it off again.
Minor refacoring and trace-message printing
Allow the solved dictionaries to propagate from outside in

See Note [Propagate solved dictionaries] in TcSMonad.  This
can signficantly reduce the number of solver steps.
Wibbles to notes
Refactor the code that prevents recursion among Coercible constraints

The main description is in Note [Preventing recursive dictionaries]
in TcRnTypes, which applies only to Coercible dictionaries.

But it was a bit of a mess:
 - It wasn't applied consistently
 - It was being applied to non-Coercible dictionaries in some places

This patch tidies it up.

This hack will largely go away when Richard starts treating Coercible
constraints more like equalities than like dictionaries.
Re-enable T3064, which works now
Better error messages for new per-instance overlap flags and Safe
Haskell.
Add in Incoherent Instances test for Safe Haskell.
Warn for Safe Haskell when -XOverlappingInstances or
-XIncoherentInstances turned on.
Improve Applicative definitions

Generally clean up things relating to Applicative and Monad in `GHC.Base`
and `Control.Applicative` to make `Applicative` feel like a bit more of a
first-class citizen rather than just playing second fiddle to `Monad`. Use
`coerce` and GND to improve performance and clarity.

Change the default definition of `(*>)` to use `(<$)`, in case the
`Functor` instance optimizes that.

Moreover, some manually written instances are made into compiler-derived
instances.

Finally, this also adds a few AMP-related laws to the `Applicative` docstring.

NOTE: These changes result in a 13% decrease in allocation for T9020

Reviewed By: ekmett, hvr

Differential Revision: https://phabricator.haskell.org/D432
Make getTag use a bang pattern instead of seq

It's prettier that way, and there's less risk of anything
going sideways.

Reviewed By: hvr, simonpj

Differential Revision: https://phabricator.haskell.org/D450
Update .gitignore to properly ignore emacs temp files

Signed-off-by: Austin Seipp <austin@well-typed.com>
*Really*, really fix RTS crash due to bad coercion.

Summary:
My previous attempt to fix the new coercion bug introduced by my fix actually
just reverted back to the *old* bug. This time it should properly handle all
three size scenarios.

Signed-off-by: Merijn Verstraaten <merijn@inconsistent.nl>

Test Plan: validate

Reviewers: dfeuer, austin, hvr

Reviewed By: austin, hvr

Subscribers: thomie, carter, simonmar

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

GHC Trac Issues: #8089
small parser/lexer cleanup

Summary:
The last three '#define ...' macros were removed from Parser.y.pp and this file was renamed to Parser.y.
This basically got rid of a CPP step in the build.

Also converted two modules in compiler/parser/ from .lhs to .hs.

Test Plan: Does it build? Yes, I performed a full build here and things are looking good.

Reviewers: austin

Reviewed By: austin

Subscribers: adamse, thomie, carter, simonmar

Differential Revision: https://phabricator.haskell.org/D411
[Docs] Fixed several broken urls in user's guide

Summary: Some of the links in user's guide were broken, I've found the files they used to link and updated urls.

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, carter, simonmar

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