ghc.git
22 months agoMake function intToSBigNat# preserve sign (fixes #14085)
Olivier Chéron [Thu, 17 Aug 2017 14:32:28 +0000 (10:32 -0400)] 
Make function intToSBigNat# preserve sign (fixes #14085)

Impacts only functions gcdExtInteger, powModInteger and
recipModInteger which gave invalid results on negative S# inputs.

Also fixes gcdExtInteger assertion when first argument is negative.

Test Plan: Updated test case integerGmpInternals

Reviewers: austin, hvr, goldfire, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14085

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

22 months agoRemove unneeded reqlibs for mtl and parsec in the GHC testsuite
Ryan Scott [Thu, 17 Aug 2017 14:31:26 +0000 (10:31 -0400)] 
Remove unneeded reqlibs for mtl and parsec in the GHC testsuite

Now that `mtl` and `parsec` are boot libraries, there's no need to
qualify various tests in the testsuite with `reqlib('mtl')` or
`reqlib('parsec')`.

Test Plan: make test TEST="T4809 tcfail126 T4355 tc232 tc223 tc220
tc217 tc183 T5303 DoParamM qq005 qq006 galois_raytrace T1074 mod133
T3787 T4316 prog011 drvfail006 drvfail008"

Reviewers: bgamari, austin

Subscribers: rwbarton, thomie

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

22 months agoFix #13399 by documenting higher-rank kinds.
Richard Eisenberg [Thu, 17 Aug 2017 14:29:57 +0000 (10:29 -0400)] 
Fix #13399 by documenting higher-rank kinds.

Test Plan: Read it.

Reviewers: simonpj, RyanGlScott, austin, bgamari

Reviewed By: RyanGlScott

Subscribers: rwbarton, thomie

GHC Trac Issues: #13399

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

22 months agouser-guide: add `:type +d` and `:type +v` in release highlight
Takenobu Tani [Thu, 17 Aug 2017 14:29:43 +0000 (10:29 -0400)] 
user-guide: add `:type +d` and `:type +v` in release highlight

Add new ghci command to release highlight and fix link anchor.

This commit is for ghc-8.2 branch.

Test Plan: build

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #11975

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

22 months agorts: Enable USDT probes object on Linux
Ben Gamari [Thu, 17 Aug 2017 14:28:39 +0000 (10:28 -0400)] 
rts: Enable USDT probes object on Linux

Summary: The dtrace utility shipped with Debian expects this.

Reviewers: austin, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie

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

22 months agouser-guide: fix examples of ghci commands
Takenobu Tani [Thu, 17 Aug 2017 14:28:01 +0000 (10:28 -0400)] 
user-guide: fix examples of ghci commands

Fix examples of ghci commands:
  * correct typos
  * add top-level binding without let statement
  * modify Time.getClockTime to Data.Time.getZonedTime
  * modify Directory.setCurrentDirectory
  * modify ghc version number

Test Plan: build

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

22 months agoFix index entries in "separate compilation" section
Chris Martin [Tue, 15 Aug 2017 01:15:22 +0000 (21:15 -0400)] 
Fix index entries in "separate compilation" section

This appears to have been a mistake from the translation of the manual into RST
format by 4fd6207ec6.

22 months agoAdd missing initial version for extension doc.
superfunc [Mon, 14 Aug 2017 00:20:47 +0000 (20:20 -0400)] 
Add missing initial version for extension doc.

22 months agoLoads of doc(test)s
David Luposchainsky [Fri, 11 Aug 2017 12:25:57 +0000 (14:25 +0200)] 
Loads of doc(test)s

22 months agoConvert documentation examples to doctests for ReadP module
David Luposchainsky [Fri, 11 Aug 2017 11:46:13 +0000 (13:46 +0200)] 
Convert documentation examples to doctests for ReadP module

22 months agoMention the category laws explicitly
David Luposchainsky [Fri, 11 Aug 2017 10:56:32 +0000 (12:56 +0200)] 
Mention the category laws explicitly

22 months agoAdd some Monoid doctests
David Luposchainsky [Fri, 11 Aug 2017 10:50:13 +0000 (12:50 +0200)] 
Add some Monoid doctests

22 months agoInsert missing blank line to fix Applicative doc
David Luposchainsky [Fri, 11 Aug 2017 10:31:23 +0000 (12:31 +0200)] 
Insert missing blank line to fix Applicative doc

22 months agoSections with undefined operators have non-standard behavior
David Luposchainsky [Fri, 11 Aug 2017 09:26:52 +0000 (11:26 +0200)] 
Sections with undefined operators have non-standard behavior

22 months agoDoctest for Void.absurd
David Luposchainsky [Fri, 11 Aug 2017 08:38:24 +0000 (10:38 +0200)] 
Doctest for Void.absurd

22 months agoHandle ListPat in isStrictPattern
Alexander Biehl [Fri, 11 Aug 2017 06:29:23 +0000 (08:29 +0200)] 
Handle ListPat in isStrictPattern

This fixes #14105.

22 months agoRemove extra ` from "kind-indexed GADTs" doc
Chris Martin [Thu, 10 Aug 2017 23:37:02 +0000 (19:37 -0400)] 
Remove extra ` from "kind-indexed GADTs" doc

22 months agoFix #11785 by making reifyKind = reifyType
Ryan Scott [Thu, 17 Aug 2017 14:07:32 +0000 (10:07 -0400)] 
Fix #11785 by making reifyKind = reifyType

Summary:
This ties up the last loose end in Template Haskell's separate
code paths for types and kinds. By making `reifyKind = reifyType` in
`TcSplice`, types and kinds are now treated on equal terms in TH.

This is itself a small patch, but most of the heavy lifting to make this
possible was done in ad7b945257ea262e3f6f46daa4ff3e451aeeae0b.

Test Plan: ./validate

Reviewers: goldfire, austin, bgamari

Reviewed By: goldfire

Subscribers: rwbarton, thomie

GHC Trac Issues: #11785

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

22 months agoSuggest how to fix illegally nested foralls in GADT constructor type signatures
Ryan Scott [Thu, 17 Aug 2017 14:07:03 +0000 (10:07 -0400)] 
Suggest how to fix illegally nested foralls in GADT constructor type signatures

Summary:
Although the code from #12087 isn't accepted by GHC, we can at least
do a better job of letting users know what the problem is, and how to fix it.

Test Plan: make test TEST=T12087

Reviewers: goldfire, austin, bgamari

Reviewed By: goldfire

Subscribers: rwbarton, thomie

GHC Trac Issues: #12087

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

22 months agoFix #13972 by producing tidier errors
Ryan Scott [Thu, 17 Aug 2017 14:06:32 +0000 (10:06 -0400)] 
Fix #13972 by producing tidier errors

Summary:
Previously, one could experience an error message like this:

```
Expected: T (a -> Either a b)
  Actual: T (a -> Either a b)
```

This makes the error message an iota clearer by tidying it first, which will
instead produce:

```
Expected: T (a1 -> Either a1 b1)
  Actual: T (a -> Either a b)
```

Which steers users towards the understanding that the two sets of tyvars are
actually different.

Test Plan: make test TEST=T13972

Reviewers: simonpj, austin, bgamari, goldfire

Reviewed By: goldfire

Subscribers: goldfire, rwbarton, thomie

GHC Trac Issues: #13972

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

22 months agoAllow TcDerivInfer to compile with GHC 8.0.1
Ben Gamari [Wed, 16 Aug 2017 23:01:59 +0000 (19:01 -0400)] 
Allow TcDerivInfer to compile with GHC 8.0.1

As of ed7a830de6a2ea74dd6bb81f8ec55b9fe0b52f28 this module uses
MultiWayIf, the parsing behavior of which changed in 8.0.2 due
to #10807. Reformat the code so that it compiles under both 8.0.1 and
8.0.2/8.2.1.

Test Plan: Validate bootstrapping with 8.0.1

Reviewers: austin

Subscribers: rwbarton, thomie, RyanGlScott

GHC Trac Issues: #14130

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

22 months agoSpeed up compilation of profiling stubs
Ben Gamari [Wed, 16 Aug 2017 23:01:05 +0000 (19:01 -0400)] 
Speed up compilation of profiling stubs

Here we encode the cost centre list as static data. This means that the
initialization stubs are small functions which should be easy for GCC to
compile, even with optimization.

Fixes #7960.

Test Plan: Test profiling

Reviewers: austin, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie

GHC Trac Issues: #7960

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

22 months agoBump mtl, parsec, text submodules (again)
Ryan Scott [Wed, 16 Aug 2017 15:50:41 +0000 (11:50 -0400)] 
Bump mtl, parsec, text submodules (again)

We failed to add dist-install and dist-boot to .gitignore in the commits
brought in via commit e054c5f06451def4437d9d770ae156f034796c59. This round of
submodule commits should do the trick.

22 months agoBump mtl, parsec, text submodules
Ben Gamari [Tue, 15 Aug 2017 12:28:50 +0000 (08:28 -0400)] 
Bump mtl, parsec, text submodules

a520adcce27908c799b64214618cf9b33572dc37 updated the upstream repository
locations but failed to update the commits themselves.

22 months agoBump nofib submodule
Ben Gamari [Tue, 15 Aug 2017 00:52:57 +0000 (20:52 -0400)] 
Bump nofib submodule

22 months agoAdd Semigroup/Monoid instances to ST monad
Ben Gamari [Tue, 15 Aug 2017 00:58:16 +0000 (20:58 -0400)] 
Add Semigroup/Monoid instances to ST monad

Fixes #14107.

Signed-off-by: Philipp Middendorf <middendorf@plapadoo.de>
Reviewers: austin, hvr, bgamari, RyanGlScott

Reviewed By: bgamari

Subscribers: RyanGlScott, rwbarton, thomie

GHC Trac Issues: #14107

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

22 months agoBump mtl, parsec, text submodules
Ryan Scott [Tue, 15 Aug 2017 00:57:11 +0000 (20:57 -0400)] 
Bump mtl, parsec, text submodules

These three submodules have commits which add certain files to their
respective .gitignores which GHC's build system produces. Also update
the packages file accordingly.

Test Plan: If it builds, ship it

Reviewers: hvr, austin, bgamari

Subscribers: rwbarton, thomie

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

22 months agoRecognize FreeBSD compiler as Clang.
Gleb Popov [Tue, 15 Aug 2017 00:56:44 +0000 (20:56 -0400)] 
Recognize FreeBSD compiler as Clang.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

22 months agoUse a ReaderT in TcDeriv to avoid some tedious plumbing
Ryan Scott [Tue, 15 Aug 2017 00:56:04 +0000 (20:56 -0400)] 
Use a ReaderT in TcDeriv to avoid some tedious plumbing

Addresses point (2) of https://phabricator.haskell.org/D3337#107865.

Before, several functions in `TcDeriv` and `TcDerivInfer` which compute
an `EarlyDerivSpec` were manually threading through about 10 different
arguments, which contribute to quite a lot of clutter whenever they need
to be updated. To minimize this plumbing, and to make it clearer which
of these 10 values are being used where, I refactored the code in
`TcDeriv` and `TcDerivInfer` to use a new `DerivM` type:

```lang=haskell
type DerivM = ReaderT DerivEnv TcRn
```

where `DerivEnv` contains the 10 aforementioned values. In addition to
cleaning up the code, this should make some subsequent changes planned
for later less noisy.

Test Plan: ./validate

Reviewers: austin, bgamari

Subscribers: rwbarton, thomie

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

22 months agoDon't drop GHCi-defined functions with -fobject-code enabled
Ryan Scott [Tue, 15 Aug 2017 00:55:39 +0000 (20:55 -0400)] 
Don't drop GHCi-defined functions with -fobject-code enabled

The desugarer was using `targetRetainsAllBindings` as a litmus test for
determining if a function was defined in interactive mode (and thus
should be exported). However, there is a corner case where one can be in
interactive mode and have `targetRetainsAllBindings` return `False`: if
`-fobject-code` is enabled (since the target will no longer be
`HscInteractive`). In such a scenario, we should fall back on a
different test for determining if we are in a GHCi session. I chose to
use `isInteractiveModule`, which appears to do the trick.

Test Plan: make test TEST=T12091

Reviewers: austin, bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #12091

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

22 months agoProperly handle dlerror() message on FreeBSD when linking linker scripts
Gleb Popov [Tue, 15 Aug 2017 00:54:36 +0000 (20:54 -0400)] 
Properly handle dlerror() message on FreeBSD when linking linker scripts

Test Plan: `GHCi.loadDll "/usr/lib/libc++.so` now works on FreeBSD.

Reviewers: austin, bgamari, erikd, simonmar

Reviewed By: simonmar

Subscribers: rwbarton, thomie

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

22 months agoFix #14060 by more conservatively annotating TH-reified types
Ryan Scott [Tue, 15 Aug 2017 00:53:57 +0000 (20:53 -0400)] 
Fix #14060 by more conservatively annotating TH-reified types

Before, TH was quite generous in applying kind annotations to reified
type constructors whose result kind happened to mention type variables.
This could result in agonizingly large reified types, so this patch aims
to quell this a bit by adopting a more nuanced algorithm for determining
when a tycon application deserves a kind annotation.

This implements the algorithm laid out in
https://ghc.haskell.org/trac/ghc/ticket/14060#comment:1. I've updated
`Note [Kind annotations on TyConApps]` to reflect the new wisdom.
Essentially, instead of only checking if the result kind contains free
variables, we also check if any of those variables do not appear free in
injective positions in the argument kinds—only then do we put on a kind
annotation.

Bumps `haddock` submodule.

Test Plan: make test TEST=T14060

Reviewers: goldfire, austin, bgamari

Reviewed By: goldfire

Subscribers: rwbarton, thomie

GHC Trac Issues: #14060

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

22 months agoPoint to FunDeps documentation on Haskell wiki
Ben Gamari [Tue, 8 Aug 2017 03:40:51 +0000 (23:40 -0400)] 
Point to FunDeps documentation on Haskell wiki

22 months agoAdd test for #14101
Ryan Scott [Sat, 12 Aug 2017 20:24:19 +0000 (16:24 -0400)] 
Add test for #14101

I forgot to do this in
0bb1e84034a12d7f700b48fca6710c01bd08f397.

22 months agoExpand type synonyms during role inference
Ryan Scott [Sat, 12 Aug 2017 19:52:08 +0000 (15:52 -0400)] 
Expand type synonyms during role inference

Summary:
During role inference, we need to expand type synonyms, since
oversaturated applications of type synonym tycons would otherwise have overly
conservative roles inferred for its arguments.

Fixes #14101.

Test Plan: ./validate

Reviewers: goldfire, austin, bgamari

Reviewed By: goldfire

Subscribers: rwbarton, thomie

GHC Trac Issues: #14101

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

22 months agoChange isClosedAlgType to be TYPE-aware, and rename it to pmIsClosedType
Ryan Scott [Sat, 12 Aug 2017 19:51:37 +0000 (15:51 -0400)] 
Change isClosedAlgType to be TYPE-aware, and rename it to pmIsClosedType

Summary:
In a267580e4ab37115dcc33f3b8a9af67b9364da12, I somewhat awkwardly
inserted a special case for `TYPE` in the `EmptyCase` coverage checker.
Instead of placing it there, @mpickering noted that `isClosedAlgType` would
be a better fit for it. I do just that in this patch.

I also renamed `isClosedAlgType` to `pmIsClosedType`, reflecting the fact that
`TYPE` technically isn't an algebraic type (it's a primitive one), and that its
behavior is pattern-match coverage checking-oriented. I also moved it to
`Check`, which is a better home for this function than `Type`. Luckily,
the only call sites for `isClosedAlgType` were in the pattern-match coverage
checker anyways, so this change is simple enough.

Test Plan: ./validate

Reviewers: mpickering, austin, goldfire, bgamari

Reviewed By: goldfire

Subscribers: rwbarton, thomie, mpickering

GHC Trac Issues: #14086

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

22 months agoUse NonEmpty lists to represent lists of duplicate elements
Ryan Scott [Sat, 12 Aug 2017 19:47:27 +0000 (15:47 -0400)] 
Use NonEmpty lists to represent lists of duplicate elements

Summary:
Three functions in `ListSetOps` which compute duplicate elements
represent lists of duplicates of `[a]`. This is a really bad way to go about
things, because these lists are guaranteed to always have at least one element
(the "representative" of the duplicates), and several places in the GHC API
call `head` (a partial function) on these lists of duplicates to retrieve the
representative.

This changes the representation of duplicates to `NonEmpty` lists instead,
which allow for many partial uses of `head` to be made total.

Fixes #13823.

Test Plan: ./validate

Reviewers: bgamari, austin, goldfire

Reviewed By: bgamari

Subscribers: goldfire, rwbarton, thomie

GHC Trac Issues: #13823

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

22 months agoDon't suppress unimplemented type family warnings with DeriveAnyClass
Ryan Scott [Sat, 12 Aug 2017 19:46:44 +0000 (15:46 -0400)] 
Don't suppress unimplemented type family warnings with DeriveAnyClass

Summary:
For some asinine reason, we were suppressing warnings when
deriving associated type family instances with `DeriveAnyClass`. That seems
like a bad idea. Let's not do that.

Along the way, I noticed that the error contexts associated with these
newly emitted warnings were less than ideal, so I did some minor refactoring
to improve the story there.

Fixes #14094

Test Plan: ./validate

Reviewers: bgamari, austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #14094

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

22 months agoSplit out inferConstraintsDataConArgs from inferConstraints
Ryan Scott [Sat, 12 Aug 2017 19:46:22 +0000 (15:46 -0400)] 
Split out inferConstraintsDataConArgs from inferConstraints

Summary:
Addresses point (1) of https://phabricator.haskell.org/D3337#107865.

Before, `inferConstraints` awkwardly combined all of the logic needed to handle
stock, newtype, and anyclass deriving. Really, though, the stock/newtype logic
is quite different from the anyclass logic, so this splits off
`inferConstraintsDataConArgs` (so named because it infers constraints by
inspecting the types of the arguments to data constructors) from
`inferConstraints` to handle the stock/newtype-specific bits.

Aside from making the code somewhat clearer, this allows us to factor out
superclass constraint inference, which is done regardless of deriving strategy.

Test Plan: If it builds, ship it

Reviewers: bgamari, austin

Subscribers: rwbarton, thomie

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

22 months agoFix EmptyCase documentation
Cyd Parser [Mon, 7 Aug 2017 05:23:23 +0000 (22:23 -0700)] 
Fix EmptyCase documentation

22 months agoConvert examples to doctests, and add a handful of new ones
David Luposchainsky [Sun, 6 Aug 2017 11:32:52 +0000 (13:32 +0200)] 
Convert examples to doctests, and add a handful of new ones

22 months agoFix string escaping in JSON
Dmitry Malikov [Sat, 5 Aug 2017 14:28:40 +0000 (16:28 +0200)] 
Fix string escaping in JSON

It seems to that double quotes is not escaped well at the moment.

We'd noticed this with @alexbiehl during the work on https://github.com/haskell/haddock/pull/645

22 months agoAdd forgotten > in Control.Applicative
Oleg Grenrus [Fri, 4 Aug 2017 15:07:14 +0000 (18:07 +0300)] 
Add forgotten > in Control.Applicative

As reported by tabaqui on `#hackage`

22 months agoDon't warn when empty casing on Type
Ryan Scott [Sat, 5 Aug 2017 16:02:54 +0000 (12:02 -0400)] 
Don't warn when empty casing on Type

Summary:
`Type` (a.k.a. `TYPE LiftedRep`) can be used at the type level thanks
to `TypeInType`. However, expressions like

```lang=haskell
f :: Type -> Int
f x = case x of {}
```

were falsely claiming that the empty case on the value of type `Type` was
non-exhaustive. The reason is a bit silly: `TYPE` is technically not an empty
datatype in GHC's eyes, since it's a builtin, primitive type. To convince the
pattern coverage checker otherwise, this adds a special case for `TYPE`.

Test Plan: make test TEST=T14086

Reviewers: gkaracha, austin, bgamari, goldfire

Reviewed By: goldfire

Subscribers: goldfire, rwbarton, thomie

GHC Trac Issues: #14086

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

22 months agoRemove the deprecated Typeable{1..7} type synonyms
Ryan Scott [Sat, 5 Aug 2017 16:02:41 +0000 (12:02 -0400)] 
Remove the deprecated Typeable{1..7} type synonyms

Summary:
`Typeable{1..7}` (type synonyms for the poly-kinded `Typeable`) have
been deprecated since GHC 7.8. They're now causing problems for users who try
to still work with them in legacy code, since they can no longer be used in
instances. To avoid this sort of confusion, let's just remove `Typeable{1..7}`
altogether. Resolves #14047.

Reviewers: bgamari, austin, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #14047

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

22 months agoAdd MonadIO Q - by requiring MonadIO => Quasi
Oleg Grenrus [Sat, 5 Aug 2017 16:02:16 +0000 (12:02 -0400)] 
Add MonadIO Q - by requiring MonadIO => Quasi

Summary: This is follow-up to https://ghc.haskell.org/trac/ghc/ticket/10773

Reviewers: austin, goldfire, bgamari, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: RyanGlScott, rwbarton, thomie

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

22 months agoAdd the bootstrapping/ dir to .gitignore
Ryan Scott [Wed, 2 Aug 2017 20:12:03 +0000 (16:12 -0400)] 
Add the bootstrapping/ dir to .gitignore

Summary: This is generated when building `ghc-cabal`.

Reviewers: hvr, bgamari, austin

Subscribers: rwbarton, thomie

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

22 months agoRemove unneeded uses of ImplicitParams
Ryan Scott [Wed, 2 Aug 2017 20:10:34 +0000 (16:10 -0400)] 
Remove unneeded uses of ImplicitParams

Summary:
Finish the work started in
7d1909ad110f05c8cb2fb0689ee75857ceb945f6.

Test Plan: If it builds, ship it

Reviewers: austin, bgamari

Subscribers: rwbarton, thomie

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

22 months agoGet the roles right for newtype instances
Simon Peyton Jones [Wed, 2 Aug 2017 16:59:56 +0000 (12:59 -0400)] 
Get the roles right for newtype instances

This was a simple slip, that gave rise to the bug reported in
comment:13 of Trac #14045.  We were supplying roles to mkAlgTyCon
that didn't match the tyvars.

22 months agoAdd .gitmodules entries for text, parsec, mtl submodules
Ben Gamari [Tue, 1 Aug 2017 20:51:41 +0000 (16:51 -0400)] 
Add .gitmodules entries for text, parsec, mtl submodules

22 months agoBump unix submodule
Ben Gamari [Tue, 1 Aug 2017 15:10:46 +0000 (11:10 -0400)] 
Bump unix submodule

22 months agoEnable building Cabal with parsec
Herbert Valerio Riedel [Tue, 1 Aug 2017 15:05:18 +0000 (11:05 -0400)] 
Enable building Cabal with parsec

Cabal's parser has been rewritten in terms of Parsec (which is not
enabled yet in Cabal-2.0 by default, but can be enabled by a cabal
flag). The plan for Cabal is to drop support for the non-parsec parser,
so we need to prepare GHC to cope with new situation.

However, this means that lib:Cabal requires three new library
dependency submodules,

 - parsec
 - text
 - mtl

What complicates matters is that we need to build `ghc-cabal` early on
during the bootstrap phase which currently needs to invoke `ghc --make`
directly. So these additional dependencies need to be integrated into
the monolithic `ghc --make` invocation which produces the `ghc-cabal`
executable.

Test Plan: `./validate --fast` passed

Reviewers: austin, bgamari

Subscribers: erikd, phadej, rwbarton, thomie

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

22 months agoDrop GHC 7.10 compatibility
Ryan Scott [Tue, 1 Aug 2017 13:48:52 +0000 (09:48 -0400)] 
Drop GHC 7.10 compatibility

GHC 8.2.1 is out, so now GHC's support window only extends back to GHC
8.0. This means we can delete gobs of code that was only used for GHC
7.10 support. Hooray!

Test Plan: ./validate

Reviewers: hvr, bgamari, austin, goldfire, simonmar

Reviewed By: bgamari

Subscribers: Phyx, rwbarton, thomie

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

22 months agoSimplify OccurAnal.tagRecBinders
Joachim Breitner [Tue, 1 Aug 2017 02:56:51 +0000 (22:56 -0400)] 
Simplify OccurAnal.tagRecBinders

No need to mark the binders with markNonTailCalled, as they already have been
marked as such in rhs_udss' via adjust.

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

22 months agorts: Fix "variable set but not used" warning
Ben Gamari [Tue, 1 Aug 2017 02:33:51 +0000 (22:33 -0400)] 
rts: Fix "variable set but not used" warning

gcc complains about this while building with Hadrian,
```
rts/RetainerProfile.c: In function ‘computeRetainerSet’:

rts/RetainerProfile.c:1758:18: error:
     error: variable ‘rtl’ set but not used
[-Werror=unused-but-set-variable]
         RetainerSet *rtl;
                      ^~~
     |
1758 |     RetainerSet *rtl;
     |                  ^
```

Reviewers: austin, erikd, simonmar, Phyx

Reviewed By: Phyx

Subscribers: Phyx, rwbarton, thomie

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

22 months agoAllow bundling pattern synonyms with exported data families
Ryan Scott [Tue, 1 Aug 2017 02:33:40 +0000 (22:33 -0400)] 
Allow bundling pattern synonyms with exported data families

Test Plan: make test TEST=T14058

Reviewers: mpickering, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #14058

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

22 months agoKnownUniques: Handle DataCon wrapper names
Ben Gamari [Tue, 1 Aug 2017 02:33:24 +0000 (22:33 -0400)] 
KnownUniques: Handle DataCon wrapper names

For some reason these weren't handled. I seem to remember thinking I had
a reason for omitting them when writing the original patch, but I don't
recall what that reason was at this point and clearly workers do show up
in interface files.

Test Plan: Validate against T14051

Reviewers: austin

Subscribers: rwbarton, thomie, RyanGlScott

GHC Trac Issues: #14051

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

22 months agoTypofixes [ci skip]
Gabor Greif [Tue, 1 Aug 2017 12:14:31 +0000 (14:14 +0200)] 
Typofixes [ci skip]

22 months agoA bunch of typofixes
Gabor Greif [Mon, 31 Jul 2017 15:34:43 +0000 (17:34 +0200)] 
A bunch of typofixes

22 months agoUse field names for all uses of datacon Match
Simon Peyton Jones [Mon, 31 Jul 2017 12:27:54 +0000 (13:27 +0100)] 
Use field names for all uses of datacon Match

This is refactoring only... elimiante all positional uses
of the data constructor Match in favour of field names.

No change in behaviour.

22 months agoRemove redundant goop
Simon Peyton Jones [Mon, 31 Jul 2017 12:25:17 +0000 (13:25 +0100)] 
Remove redundant goop

See comment:22 in Trac #13594

22 months agoReject top-level banged bindings
Simon Peyton Jones [Mon, 31 Jul 2017 12:22:38 +0000 (13:22 +0100)] 
Reject top-level banged bindings

Bizarrely, we were not rejecting
  !x = e

Fix:

* In the test in DsBinds.dsTopLHsBinds, use isBangedHsBind, not
  isBangedPatBind.  (Indeed the latter dies altogther.)

* Implement isBangedHsBind in HsUtils;
  be sure to handle AbsBinds

All this was shown up by Trac #13594

22 months agoDo a bit more CSE
Simon Peyton Jones [Mon, 31 Jul 2017 10:00:33 +0000 (11:00 +0100)] 
Do a bit more CSE

I discovered that in

   let x = MkT y in ....(MKT y |> co)....

we weren't CSE'ing the (MkT y).  The fix is easy.

22 months agoImprove the desugaring of -XStrict
Simon Peyton Jones [Mon, 31 Jul 2017 09:49:16 +0000 (10:49 +0100)] 
Improve the desugaring of -XStrict

Trac #14035 showed that -XStrict was generating some TERRIBLE
desugarings, espcially for bindings with INLINE pragmas. Reason: with
-XStrict, all AbsBinds (even for non-recursive functions) went via the
general-case deguaring for AbsBinds, namely "generate a tuple and
select from it", even though in this case there was only one variable
in the tuple.  And that in turn interacts terribly badly with INLINE
pragmas.

This patch cleans things up:

* I killed off AbsBindsSig completely, in favour of a boolean flag
  abs_sig in AbsBinds.  See Note [The abs_sig field of AbsBinds]

  This allowed me to delete lots of code; and instance-method
  declarations can enjoy the benefits too.  (They could have
  before, but no one had changed them to use AbsBindsSig.)

* I refactored all the AbsBinds handling in DsBinds into a new
  function DsBinds.dsAbsBinds.  This allowed me to handle the
  strict case uniformly

22 months agoRefactoring around FunRhs
Simon Peyton Jones [Mon, 31 Jul 2017 09:48:00 +0000 (10:48 +0100)] 
Refactoring around FunRhs

* Clarify the comments around the mc_strictness field of FunRhs
* Use record field names consistently for FunRhs

22 months agoClarify comment about data family arities
Richard Eisenberg [Mon, 31 Jul 2017 12:29:48 +0000 (08:29 -0400)] 
Clarify comment about data family arities

as requested in #14045.

[skip ci] comments only

22 months agoAllow Windows to set blank environment variables
Habib Alamin [Mon, 31 Jul 2017 04:48:43 +0000 (05:48 +0100)] 
Allow Windows to set blank environment variables

Test Plan: ./validate on harbormaster

Reviewers: austin, hvr, bgamari, erikd, Phyx

Reviewed By: Phyx

Subscribers: Phyx, rwbarton, thomie

GHC Trac Issues: #12494

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

22 months agoAdd haddock markup
Gabor Greif [Fri, 28 Jul 2017 19:09:03 +0000 (21:09 +0200)] 
Add haddock markup

22 months agoTypofixes [ci skip]
Gabor Greif [Fri, 28 Jul 2017 18:36:59 +0000 (20:36 +0200)] 
Typofixes [ci skip]

22 months agoFollow-up to #13887, for promoted infix constructors
Ryan Scott [Sat, 29 Jul 2017 23:36:42 +0000 (19:36 -0400)] 
Follow-up to #13887, for promoted infix constructors

Summary:
Correct a couple more spots in the TH pretty-printer by applying the
appropriate parenthesization for infix names. Fixes #13887 (again).

Test Plan: make test TEST=T13887

Reviewers: austin, bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13887

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

22 months agoAdd regression test for #14055
Ryan Scott [Sat, 29 Jul 2017 23:35:52 +0000 (19:35 -0400)] 
Add regression test for #14055

22 months agoFix #14045 by omitting an unnecessary check
Richard Eisenberg [Sat, 29 Jul 2017 01:43:38 +0000 (21:43 -0400)] 
Fix #14045 by omitting an unnecessary check

Previously, we checked the number of patterns in a data instances
for all data families whose kind did not end in a kind variable.
But, of course, undersaturating instances can happen even without
the kind ending in a kind variable. So I've omitted the arity check.
Data families aren't as particular about their arity as type families
are (because data families can be undersaturated). Still, this change
degrades error messages when instances don't have the right arity;
now, instead of reporting a simple mismatch in the number of patterns,
GHC reports kind errors. The new errors are fully accurate, but perhaps
not as easy to work with. Still, with the new flexibility of allowing
data family instances with varying numbers of patterns, I don't see
a better way.

This commit also improves source fidelity in some error messages,
requiring more changes than really are necessary. But without these
changes, error messages around mismatched associated instance heads
were poor.

test cases: indexed-types/should_compile/T14045,
            indexed-types/should_fail/T14045a

22 months agoAdd '<&>' operator to Data.Functor. '<&>' calls '<$>' with flipped arguments.
Sven Tennie [Fri, 28 Jul 2017 22:25:50 +0000 (18:25 -0400)] 
Add '<&>' operator to Data.Functor. '<&>' calls '<$>' with flipped arguments.

This was proposed by David Feuer
(https://mail.haskell.org/pipermail/libraries/2016-August/027293.html)
and solves #14029.

The implementation is a copy of the '<&>' operator in Control.Lens.Lens.

Add tests for following Data.Functor operators: '<$>', '<&>', '<$' and '$>'.

'<&>' was added for solving #14029. '<$>', '<$' and '$>' were probably
untested.

Reviewers: austin, hvr, bgamari, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: RyanGlScott, rwbarton, thomie

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

22 months agoEnsure that GHC.Stack.callStack doesn't fail
Ben Gamari [Fri, 28 Jul 2017 22:25:35 +0000 (18:25 -0400)] 
Ensure that GHC.Stack.callStack doesn't fail

Test Plan: Validate, ensure the `f7` program of `IPLocation` doesn't
crash.

Reviewers: gridaphobe, austin, hvr

Reviewed By: gridaphobe

Subscribers: rwbarton, thomie

GHC Trac Issues: #14028

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

22 months agoAdd rtsopts ignore and ignoreAll.
Andreas Klebinger [Fri, 28 Jul 2017 22:25:24 +0000 (18:25 -0400)] 
Add rtsopts ignore and ignoreAll.

These ignore commandline arguments for ignore and commandline as well as
GHCRTS arguments for ignoreAll. Passing RTS flags given on the command
line along to the program by simply skipping processing of these flags
by the RTS.

This fixes #12870.

Test Plan: ./validate

Reviewers: austin, hvr, bgamari, erikd, simonmar

Reviewed By: simonmar

Subscribers: Phyx, rwbarton, thomie

GHC Trac Issues: #12870

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

22 months agoFix hs-boot knot-tying with record wild cards.
Edward Z. Yang [Fri, 28 Jul 2017 22:25:12 +0000 (18:25 -0400)] 
Fix hs-boot knot-tying with record wild cards.

Fixes #13710.

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

Reviewers: bgamari, austin, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #13710

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

22 months agoRemove unnecessary GHC option from SrcLoc
Sven Tennie [Fri, 28 Jul 2017 22:24:34 +0000 (18:24 -0400)] 
Remove unnecessary GHC option from SrcLoc

This was an old workaround for #5252. Fixes #13173.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

22 months agotestsuite: Don't pass allow_abbrev
Ben Gamari [Fri, 28 Jul 2017 22:23:55 +0000 (18:23 -0400)] 
testsuite: Don't pass allow_abbrev

This is only supported by Python 3.5 and later, which is too new for us
to rely on.

Reviewers: austin

Subscribers: rwbarton, thomie, RyanGlScott

GHC Trac Issues: #14050

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

22 months agoEnsure that we always link against libm
Ben Gamari [Fri, 28 Jul 2017 17:41:04 +0000 (13:41 -0400)] 
Ensure that we always link against libm

ld.gold is particularly picky that we declare all of our link
dependencies on Nix. See #14022.

Test Plan: Validate on Nix

Reviewers: austin

Subscribers: hvr, rwbarton, thomie

GHC Trac Issues: #14022

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

22 months agoconfigure: Ensure that user's LD setting is respected
Ben Gamari [Fri, 28 Jul 2017 17:35:01 +0000 (13:35 -0400)] 
configure: Ensure that user's LD setting is respected

This broke in the fix for #13541.

22 months agogitmodules: Delete entry for dead hoopl submodule
Ben Gamari [Fri, 28 Jul 2017 17:32:19 +0000 (13:32 -0400)] 
gitmodules: Delete entry for dead hoopl submodule

22 months agoFix lld detection if both gold and lld are found
Ben Gamari [Fri, 28 Jul 2017 15:48:52 +0000 (11:48 -0400)] 
Fix lld detection if both gold and lld are found

If you have ld.gold and ld.lld, then ld.gold will be selected by the
detection logic. This patch prioritizes lld by changing the order. The
rationale for checking lld first is that it's (right now) not part of,
say, a default Linux distro installation and if it's available, it's
very likely that it was installed explicitly and should be seen as a
sign of preference. On FreeBSD LLVM is the (default) base toolchain and
the changed order makes sense there as well, since ld.gold can be
available in /usr/local via ports/pkg. I don't have access to macOS and
can't say anything about their LLVM toolchain.

At some point we could add a check for LD=ld.lld or LD=ld.gold as an
optional override to explicitly select a linker.

Since I cannot really remove gcc on Linux, this was the only way to
configure GHC to use ld.lld.

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, erikd

Tags: PHID-PROJ-5azim3sqhsf7wzvlvaag

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

22 months agoByteCodeGen: use byte indexing for BCenv
Michal Terepeta [Fri, 28 Jul 2017 15:47:28 +0000 (11:47 -0400)] 
ByteCodeGen: use byte indexing for BCenv

This is another change needed for #13825 (also based on D38 by Simon
Marlow).

With the change, we count the stack depth in bytes (instead of words).
We also introduce some `newtype`s to help with the change.

Note that this only changes how `ByteCodeGen` works and shouldn't
affect the generated bytecode.

Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
Test Plan: ./validate

Reviewers: bgamari, simonmar, austin, hvr

Reviewed By: bgamari, simonmar

Subscribers: rwbarton, thomie

GHC Trac Issues: #13825

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

22 months agoAdd “BINARY_DIST_DIR” to Makefile
Moritz Angermann [Fri, 28 Jul 2017 15:44:33 +0000 (11:44 -0400)] 
Add “BINARY_DIST_DIR” to Makefile

This allows to customize the location where binary distributions are
placed with `make binary-dist`.

E.g. using:
```
BINARY_DIST_DIR=/path/to/bindists make binary-dist
```
will place binary dists outside of the source tree into the given
folder.

This change falls back to ".", which is the old behaviour.

Test Plan: build binary-dist

Reviewers: bgamari, austin

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

22 months agotestsuite: Add test for #14028
Ben Gamari [Fri, 28 Jul 2017 15:44:20 +0000 (11:44 -0400)] 
testsuite: Add test for #14028

Reviewers: austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #14028

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

22 months agotestsuite: Produce JUnit output
Ben Gamari [Fri, 28 Jul 2017 15:40:42 +0000 (11:40 -0400)] 
testsuite: Produce JUnit output

Test Plan: Validate, try ingesting into Jenkins.

Reviewers: austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #13716

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

22 months agoSwitched out optparse for argparse in runtests.py
Jared Weakly [Thu, 27 Jul 2017 18:33:16 +0000 (14:33 -0400)] 
Switched out optparse for argparse in runtests.py

Tangentially related to my prior work on trac ticket #12758.

Signed-off-by: Jared Weakly <jweakly@pdx.edu>
Reviewers: austin, bgamari

Subscribers: rwbarton, thomie

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

22 months agoAdd regression tests for #13601, #13780, #13877
Ryan Scott [Fri, 28 Jul 2017 15:47:38 +0000 (11:47 -0400)] 
Add regression tests for #13601, #13780, #13877

Summary:
Some recent commits happened to fix other issues:

c2417b87ff59c92fbfa8eceeff2a0d6152b11a47 fixed #13601 and #13780
8e15e3d370e9c253ae0dbb330e25b72cb00cdb76 fixed the original program in #13877

Let's add regression tests for each of these to ensure they stay fixed.

Test Plan: make test TEST="T13601 T13780a T13780c T13877"

Reviewers: goldfire, bgamari, austin

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13601, #13780, #13877

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

22 months agoMerge types and kinds in DsMeta
Ryan Scott [Fri, 28 Jul 2017 15:35:37 +0000 (11:35 -0400)] 
Merge types and kinds in DsMeta

Summary:
Types and kinds are now the same in GHC... well, except in the code
that involves Template Haskell, where types and kinds are given separate
treatment. This aims to unify that treatment in the `DsMeta` module.

The gist of this patch is replacing all uses of `repLKind` with `repLTy`.
This is isn't quite as simple as one might imagine, since `repLTy` returns a
`Core (Q Type)` (a monadic expression), whereas `repLKind` returns a
`Core Kind` (a pure expression). This causes many awkward impedance mismatches.

One option would be to change every combinator in `Language.Haskell.TH.Lib` to
take `KindQ` as an argument instead of `Kind`. But this would be a breaking
change of colossal proportions.

Instead, this patch takes a somewhat different approach. This migrates the
existing `Language.Haskell.TH.Lib` module to
`Language.Haskell.TH.Lib.Internal`, and changes all `Kind`-related combinators
in `Language.Haskell.TH.Lib.Internal` to live in `Q`. The new
`Language.Haskell.TH.Lib` module then re-exports most of
`Language.Haskell.TH.Lib.Internal` with the exception of the `Kind`-related
combinators, for which it redefines them to be their current definitions (which
don't live in `Q`). This allows us to retain backwards compatibility with
previous `template-haskell` releases, but more importantly, it allows GHC to
make as many changes to the `Internal` code as it wants for its purposes
without fear of disrupting the public API.

This solves half of #11785 (the other half being `TcSplice`).

Test Plan: ./validate

Reviewers: goldfire, austin, bgamari

Reviewed By: goldfire

Subscribers: rwbarton, thomie

GHC Trac Issues: #11785

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

22 months agoError eagerly after renaming failures in reifyInstances
Ryan Scott [Fri, 28 Jul 2017 15:35:22 +0000 (11:35 -0400)] 
Error eagerly after renaming failures in reifyInstances

Summary:
Previously, if `reifyInstances` failed to discover a `Name` during
renaming, it would blindy charge into typechecking, at which point GHC would
become very confused at the absence of that `Name` and throw an internal error.
A simple workaround is to fail eagerly after renaming errors.

Test Plan: make test TEST=T13837

Reviewers: goldfire, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #13837

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

22 months agoAdd DebugCallStack to piResultTy
Simon Peyton Jones [Fri, 28 Jul 2017 08:29:25 +0000 (09:29 +0100)] 
Add DebugCallStack to piResultTy

This was provoked by an ASSERT failure when debugging #14038,
but it's a godo idea anyway.

22 months agoDo not discard insolubles in implications
Simon Peyton Jones [Thu, 27 Jul 2017 13:52:38 +0000 (14:52 +0100)] 
Do not discard insolubles in implications

Trac #14000 showed up two errors

* In TcRnTypes.dropInsolubles we dropped all implications, which
  might contain the very insolubles we wanted to keep.  This was
  an outright error, and is why the out-of-scope error was actually
  lost altogether in Trac #14000

* In TcSimplify.simplifyInfer, if there are definite (insoluble)
  errors, it's better to suppress the following ambiguity test,
  because the type may be bogus anyway.  See TcSimplify
  Note [Quantification with errors].  This fix seems a bit clunky,
  but it'll do for now.

22 months agoFix ASSERT failure in tc269
Simon Peyton Jones [Thu, 27 Jul 2017 13:47:07 +0000 (14:47 +0100)] 
Fix ASSERT failure in tc269

This ASSERT failure (in substTy) was reported in Trac #14024.

This patch gets the in-scope set right.

(Does not fix tests T13822 or T13594.)

22 months agoRemove redundant constraint in context
Simon Peyton Jones [Thu, 27 Jul 2017 13:46:38 +0000 (14:46 +0100)] 
Remove redundant constraint in context

22 months agoFix instantiation of pattern synonyms
Simon Peyton Jones [Thu, 27 Jul 2017 13:45:54 +0000 (14:45 +0100)] 
Fix instantiation of pattern synonyms

In Check.hs (pattern match ovelap checking) we to figure out the
instantiation of a pattern synonym from the type of the pattern. We
were doing this utterly wrongly.  Trac #13768 demonstrated this
bogosity.

The fix is easy; and is described in PatSyn.hs
  Note [Pattern synonym result type]

22 months agoInitialize hs_init with UTF8 encoded arguments on Windows.
Andreas Klebinger [Thu, 27 Jul 2017 17:16:09 +0000 (18:16 +0100)] 
Initialize hs_init with UTF8 encoded arguments on Windows.

Summary:
Get utf8 encoded arguments before we call hs_init and use them
instead of ignoring hs_init arguments. This reduces differing
behaviour of the RTS between windows and linux and simplifies
the code involved.

A few testcases were changed to expect the same result on windows
as on linux after the changes.

This fixes #13940.

Test Plan: ./validate

Reviewers: austin, hvr, bgamari, erikd, simonmar, Phyx

Subscribers: Phyx, rwbarton, thomie

GHC Trac Issues: #13940

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

22 months agoRefactor tcInferApps.
Richard Eisenberg [Mon, 24 Jul 2017 19:49:00 +0000 (15:49 -0400)] 
Refactor tcInferApps.

With the changes caused by the fix to #12369, it is now clearer
how to rewrite tcInferApps and friends. This should change no
behavior, but it does clean up a nasty corner of the type checker.
This commit also removes some uses of substTyUnchecked.

22 months agoFix #12369 by being more flexible with data insts
Richard Eisenberg [Wed, 19 Jul 2017 16:28:04 +0000 (12:28 -0400)] 
Fix #12369 by being more flexible with data insts

Previously, a data family's kind had to end in `Type`,
and data instances had to list all the type patterns for the
family. However, both of these restrictions were unnecessary:

- A data family's kind can usefully end in a kind variable `k`.
  See examples on #12369.

- A data instance need not list all patterns, much like how a
  GADT-style data declaration need not list all type parameters,
  when a kind signature is in place. This is useful, for example,
  here:

    data family Sing (a :: k)
    data instance Sing :: Bool -> Type where ...

This patch also improved a few error messages, as some error
plumbing had to be moved around.

See new Note [Arity of data families] in FamInstEnv for more
info.

test case: indexed-types/should_compile/T12369

22 months agoFix #12176 by being a bit more careful instantiating.
Richard Eisenberg [Tue, 18 Jul 2017 23:44:17 +0000 (19:44 -0400)] 
Fix #12176 by being a bit more careful instantiating.

Previously, looking up a TyCon that said "no" to mightBeUnsaturated
would then instantiate all of its invisible binders. But this is
wrong for vanilla type synonyms, whose RHS kind might legitimately
start with invisible binders. So a little more care is taken now,
only to instantiate those invisible binders that need to be (so that
the TyCon isn't unsaturated).

22 months agoDocument that type holes kill polymorphic recursion
Richard Eisenberg [Tue, 18 Jul 2017 19:55:21 +0000 (15:55 -0400)] 
Document that type holes kill polymorphic recursion

This "fixes" #11995.