Simon Peyton Jones [Fri, 25 Aug 2017 08:00:31 +0000 (09:00 +0100)]
Bottoming expressions should not be expandable
This patch changes isExpandableApp and isWorkFreeApp to respond
False to bottoming applications. I found that if we had
x = undefined <dict-expr>
then prepareRhs was ANF'ing it to
d = <dict-expr>
x = undefined d
which is stupid (no gain); and worse it made the simplifier iterate
indefinitely. It showed up when I started marking 'x' as a bottoming
Id more aggresssively than before; but it's been a lurking bug for
ages.
It was convenient to make isWorkFreeApp also return False for
bottoming applications, and I see no reason not to do so.
That leaves isCheapApp. It currently replies True to bottoming
applications, but I don't see why that's good.. Something to try
later.
Simon Peyton Jones [Tue, 22 Aug 2017 12:34:31 +0000 (13:34 +0100)]
Restrict exprOkForSpeculation/case to unlifted types
Consider
case x of y
DEFAULT -> let v::Int# = case y of
True -> e1
False -> e2
in ...
Previously this would have been ok-for-speculation because
y is evaluated. But the binder-swap done
by SetLevels would transform the inner alternative to
DEFAULT -> let v::Int# = case x of { ... }
in ...)
which does /not/ satisfy the let/app invariant, because x is
not evaluated.
I don't know why this has never bitten us before, but it began
to bite when I did upcoming refactoring of the Simplifier.
So this patch narrows exprOkForSpeculation to only work for
/unlifted/ cases.
To make this work I had to make exprOkForSpeculation non-polymorphic
in the binder type, which has a little knock-on for is use in
SetLevels.
(It's annoying that we need to handle cases at all, but see
Note [exprOkForSpeculation: case expressions])
Ben Gamari [Fri, 25 Aug 2017 01:55:27 +0000 (21:55 -0400)]
CNF: Implement compaction for small pointer arrays
Test Plan: Validate
Reviewers: austin, erikd, simonmar, dfeuer
Reviewed By: dfeuer
Subscribers: rwbarton, andrewthad, thomie, dfeuer
GHC Trac Issues: #13860, #13857
Differential Revision: https://phabricator.haskell.org/D3888
Simon Peyton Jones [Wed, 23 Aug 2017 12:58:51 +0000 (13:58 +0100)]
Remove typeKind from Type.hs-boot
Simple refactoring, reducing unncessary module loops
Simon Peyton Jones [Wed, 23 Aug 2017 12:55:33 +0000 (13:55 +0100)]
Fix defer-out-of-scope-variables
In the hacky code in TcUnify.buildImplication we'd failed to account
for -fdefer-out-of-scope-variables. See the new function
TcUnify.implicationNeeded.
Fixes Trac #14149
Simon Peyton Jones [Wed, 23 Aug 2017 12:48:07 +0000 (13:48 +0100)]
Better pretty-printing for CHoleCan
Debug-only; no change in mainstream behaviour
Gabor Greif [Thu, 24 Aug 2017 10:07:36 +0000 (12:07 +0200)]
Typo fixed
and update to the 'nofib' submodule
Ben Gamari [Tue, 22 Aug 2017 15:51:54 +0000 (11:51 -0400)]
users-guide: Better error messages on incomplete ghc-flag directives
Ben Gamari [Tue, 22 Aug 2017 15:41:47 +0000 (11:41 -0400)]
Add support for producing position-independent executables
Previously due to #12759 we disabled PIE support entirely. However, this
breaks the user's ability to produce PIEs. Add an explicit flag, -fPIE,
allowing the user to build PIEs.
Test Plan: Validate
Reviewers: rwbarton, austin, simonmar
Subscribers: trommler, simonmar, trofi, jrtc27, thomie
GHC Trac Issues: #12759, #13702
Differential Revision: https://phabricator.haskell.org/D3589
Ben Gamari [Tue, 22 Aug 2017 15:40:51 +0000 (11:40 -0400)]
DynFlags: Add inverse of -dno-debug-output
Reviewers: austin
Subscribers: rwbarton, thomie
GHC Trac Issues: #14142
Differential Revision: https://phabricator.haskell.org/D3876
Benjamin Hodgson [Tue, 22 Aug 2017 12:11:43 +0000 (13:11 +0100)]
Fixed a typo in template-haskell documentation
The documentation for `Type`'s `ForallT` constructor had a typo (pun not
intended). `ctxt` is separated from `type` in the surface syntax by a fat
arrow (`=>`), not a thin arrow (`->`).
Chris Martin [Sat, 19 Aug 2017 22:33:11 +0000 (18:33 -0400)]
fix typo (expreesions -> expressions)
Ben Gamari [Tue, 22 Aug 2017 12:47:33 +0000 (08:47 -0400)]
Bump haddock submodule
Alain O'Dea [Tue, 22 Aug 2017 12:47:07 +0000 (08:47 -0400)]
Make law for Foldable.length explicit
Test Plan: Documentation only. Not necessary.
Reviewers: austin, hvr, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3878
Ben Gamari [Tue, 22 Aug 2017 12:44:47 +0000 (08:44 -0400)]
StgLint: Allow join point bindings of unlifted type
As described in `Note [CoreSyn let/app invariant]` this is allowed.
Fixes #14117.
Test Plan: Build GHC with BuildFlavour=devel2 with -dstg-lint
Reviewers: austin, simonpj
Reviewed By: simonpj
Subscribers: rwbarton, thomie
GHC Trac Issues: #14117
Differential Revision: https://phabricator.haskell.org/D3857
Edward Z. Yang [Tue, 22 Aug 2017 12:44:25 +0000 (08:44 -0400)]
Fix incorrect retypecheck loop in -j (#14075)
The parallel codepath was incorrectly retypechecking the
hs-boot ModIface prior to typechecking the hs file,
which was inconsistent with the non-parallel case. The
non-parallel case gets it right: you don't want to retypecheck
the hs-boot file itself (forwarding its declarations to hs)
because you need it to be consistently knot-tied with itself
when you compare the interfaces.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: bgamari, simonpj, austin
Reviewed By: bgamari
Subscribers: duog, rwbarton, thomie
GHC Trac Issues: #14075
Differential Revision: https://phabricator.haskell.org/D3815
Douglas Wilson [Tue, 22 Aug 2017 12:44:00 +0000 (08:44 -0400)]
Move validate cleaning from distclean to clean
This bit me today: I was in validate mode without realising it and "make
clean" didn't help. I don't see a reason for this to be in distclean, as
it isn't generated by ./configure, which is the rule described in
https://ghc.haskell.org/trac/ghc/wiki/Building/Using
Test Plan: Is there a reason for this to be in distclean?
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3814
Ryan Scott [Tue, 22 Aug 2017 13:29:07 +0000 (09:29 -0400)]
Make the Read instance for Proxy (and friends) ignore precedence
Summary:
The `Read` instance for `Proxy`, as well as a handful of other data
types in `base` which only have a single constructor, are doing something
skeevy: they're requiring that they be surrounded by parentheses if the parsing
precedence is sufficiently high. This means that `"Thing (Proxy)"` would parse,
but not `"Thing Proxy"`. But the latter really ought to parse, since there's no
need to surround a single constructor with parentheses. Indeed, that's the
output of `show (Thing Proxy)`, so the current `Read` instance for `Proxy`
violates `read . show = id`.
The simple solution is to change `readParen (d > 10)` to `readParen False` in
the `Read` instance for `Proxy`. But given that a derived `Read` instance would
essentially accomplish the same thing, but with even fewer characters, I've
opted to just replace the hand-rolled `Read` instance with a derived one.
Test Plan: make test TEST=T12874
Reviewers: ekmett, austin, hvr, goldfire, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #12874
Differential Revision: https://phabricator.haskell.org/D3871
Ryan Scott [Tue, 22 Aug 2017 13:29:01 +0000 (09:29 -0400)]
Revise function arity mismatch errors involving TypeApplications
Summary:
Currently, whenever you apply a function to too many arguments and
some of those arguments happen to be visible type applications, the error
message that GHC gives is rather confusing. Consider the message you receive
when typechecking `id @Int 1 2`:
```
The function `id` is applied to three arguments,
but its type `Int -> Int` has only one
```
This is baffling, since the two lines treat the visible type argument `@Int`
differently. The top line ("applied to three arguments") includes `@Int`,
whereas the bottom line ("has only one") excludes `@Int` from consideration.
There are multiple ways one could fix this, which I explain in an addendum to
`Note [Herald for matchExpectedFunTys]`. The approach adopted here is to change
the herald of this error message to include visible type arguments, and to
avoid counting them in the "applied to n arguments" part of the error. The end
result is that the new error message for `id @Int 1 2` is now:
```
The expression `id @Int` is applied to two arguments,
but its type `Int -> Int` has only one
```
Test Plan: make test TEST=T13902
Reviewers: goldfire, austin, bgamari
Reviewed By: goldfire
Subscribers: rwbarton, thomie
GHC Trac Issues: #13902
Differential Revision: https://phabricator.haskell.org/D3868
Ryan Scott [Tue, 22 Aug 2017 13:28:56 +0000 (09:28 -0400)]
Fix #13885 by freshening reified GADT constructors' universal tyvars
Summary:
When reifying GADTs with Template Haskell, the universally quantified
type variables were being reused across both the data type head and the
constructors' type signatures. This had the annoying effect of causing sets
of differently scoped variables to have the same uniques. To avoid this, we
now freshen the universal tyvars before reifying the constructors so as to
ensure they have distinct uniques.
Test Plan: make test TEST=T13885
Reviewers: goldfire, austin, bgamari, simonpj
Reviewed By: simonpj
Subscribers: rwbarton, thomie
GHC Trac Issues: #13885
Differential Revision: https://phabricator.haskell.org/D3867
Ryan Scott [Tue, 22 Aug 2017 13:28:49 +0000 (09:28 -0400)]
Fix #14114 by checking for duplicate vars on pattern synonym RHSes
Summary:
Because we weren't checking for duplicate variables on the right-hand
sides of pattern synonyms, bogus definitions like this one passed the renamer:
```lang=haskell
pattern Foo a <- (a,a)
```
Luckily, the fix is simple.
Test Plan: make test TEST=T14114
Reviewers: mpickering, austin, bgamari, simonpj
Reviewed By: simonpj
Subscribers: simonpj, rwbarton, thomie
GHC Trac Issues: #14114
Differential Revision: https://phabricator.haskell.org/D3866
Ryan Scott [Tue, 22 Aug 2017 13:28:43 +0000 (09:28 -0400)]
Fix #14125 by normalizing data family instances more aggressively
Summary:
Commit
3540d1e1a23926ce0a8a6ae83a36f5f6b2497ccf inadvertently broke
the ability for newtype instances to be used as marshallable types in FFI
declarations. The reason is a bit silly: an extra check was added for type
synonyms with no type families on the RHS in `normalise_tc_app`, but this check
would only skip over type families, not //data// families, since the predicate
being used was `not . isTypeFamilyCon`.
The fix is simple: just use `not . isFamilyCon` instead so that data families
are also skipped by this check.
Test Plan: make test TEST=T14125
Reviewers: goldfire, simonpj, austin, bgamari
Reviewed By: simonpj
Subscribers: rwbarton, thomie
GHC Trac Issues: #14125
Differential Revision: https://phabricator.haskell.org/D3865
Sergey Vinokurov [Sun, 20 Aug 2017 21:40:08 +0000 (00:40 +0300)]
Fix loading of dlls on 32bit windows
The point of fix is to handle case when loaded dll loads no
other dlls, i.e. it's import table is empty.
GHC Trac Issues: #14081
Ben Gamari [Sat, 19 Aug 2017 11:44:13 +0000 (07:44 -0400)]
Revert "Add strict variant of iterate"
This was not ready to commit.
This reverts commit
8e5b6ec6566da57d15b0810a07902d9eac85cb79.
Tamar Christina [Sat, 19 Aug 2017 07:31:34 +0000 (08:31 +0100)]
Correct incorrect free in PE linker
Summary:
The big-obj support (D3523) had introduced an early free on
the info structure. Because the pointer is not NULL'd
and the default of all the utility functions was to the
standard object format, it all kept working.
The one big-obj test that exists was subjected to a timing issue.
usually the test ran quickly enough that the allocator hasn't
had time to reclaim the memory yet, so it still passed.
This corrects it. Also as it so happens, static LLVM libraries
from mingw-w64 are compiled using big-obj.
Test Plan: ./validate
Reviewers: austin, bgamari, erikd, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #13815, #13093
Differential Revision: https://phabricator.haskell.org/D3862
Ben Gamari [Fri, 18 Aug 2017 14:24:58 +0000 (10:24 -0400)]
Add strict variant of iterate
This closes the nearly-eight-year-old #3474.
Patrick Dougherty [Fri, 18 Aug 2017 13:20:07 +0000 (09:20 -0400)]
users_guide: Convert mkUserGuidePart generation to a Sphinx extension
This removes all dependencies the users guide had on `mkUserGuidePart`.
The generation of the flag reference table and the various pieces of the
man page is now entirely contained within the Spinx extension
`flags.py`. You can see the man page generation on the orphan page
https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghc.html
The extension works by collecting all of the meta-data attached to the
`ghc-flag` directives and then formatting and displaying it at
`flag-print` directives. There is a single printing directive that can
be customized with two options, what format to display (table, list, or
block of flags) and an optional category to limit the output to
(verbosity, warnings, codegen, etc.).
New display formats can be added by creating a function
`generate_flag_xxx` (where `xxx` is a description of the format) which
takes a list of flags and a category and returns a new `xxx`. Then just
add a reference in the dispatch table `handlers`. That display can now
be run by passing `:type: xxx` to the `flag-print` directive.
`flags.py` contains two maps of settings that can be adjusted. The first
is a canonical list of flag categories, and the second sets default
categories for files.
The only functionality that Sphinx could not replace was the
`what_glasgow_exts_does.gen.rst` file. `mkUserGuidePart` actually just
reads the list of flags from `compiler/main/DynFlags.hs` which Sphinx
cannot do. As the flag is deprecated, I added the list as a static file
which can be updated manually.
Additionally, this patch updates every single documented flag with the
data from `mkUserGuidePart` to generate the reference table.
Fixes #11654 and, incidentally, #12155.
Reviewers: austin, bgamari
Subscribers: rwbarton, thomie
GHC Trac Issues: #11654, #12155
Differential Revision: https://phabricator.haskell.org/D3839
Ben Gamari [Fri, 18 Aug 2017 12:37:14 +0000 (08:37 -0400)]
Enable -Wcpp-undef for GHC and runtime system
This gets us much of the benefit of enabling it globally, which avoiding
(at least for now) the pain of making the core libraries build as well.
See #13636.
Test Plan: Validate
Reviewers: erikd, austin
Subscribers: rwbarton, thomie
GHC Trac Issues: #13636
Differential Revision: https://phabricator.haskell.org/D3517
David Luposchainsky [Fri, 11 Aug 2017 08:37:55 +0000 (10:37 +0200)]
Doctests for Data.Tuple
Simon Peyton Jones [Fri, 18 Aug 2017 13:50:57 +0000 (14:50 +0100)]
Test Trac #14110
Simon Peyton Jones [Fri, 18 Aug 2017 08:02:13 +0000 (09:02 +0100)]
Comments only
Simon Peyton Jones [Wed, 2 Aug 2017 14:56:32 +0000 (15:56 +0100)]
Tracing in OccAnal (commented out)
Simon Peyton Jones [Wed, 2 Aug 2017 08:48:58 +0000 (09:48 +0100)]
Restrict Lint's complaints about recursive INLINEs somewhat
This patch makes the Lint warning about recursive functions with an
INLINE only apply if there is a stable unfolding. If not (e.g. some
other pass took it out) we don't need to worry. Not a big deal.
Simon Peyton Jones [Tue, 1 Aug 2017 11:07:34 +0000 (12:07 +0100)]
Comments about GlobalRdrEnv shadowing
Provoked by Trac #14052
Joachim Breitner [Fri, 18 Aug 2017 12:14:19 +0000 (14:14 +0200)]
CSE.cseOneExpr: Set InScopeSet correctly
because this is a convenience function for API users, calculate the
in-scope set from `exprFreeVars`.
Ben Gamari [Thu, 17 Aug 2017 14:32:58 +0000 (10:32 -0400)]
testsuite: Add test for #13916
Reviewers: austin
Subscribers: rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3764
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
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
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
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
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
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
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.
superfunc [Mon, 14 Aug 2017 00:20:47 +0000 (20:20 -0400)]
Add missing initial version for extension doc.
David Luposchainsky [Fri, 11 Aug 2017 12:25:57 +0000 (14:25 +0200)]
Loads of doc(test)s
David Luposchainsky [Fri, 11 Aug 2017 11:46:13 +0000 (13:46 +0200)]
Convert documentation examples to doctests for ReadP module
David Luposchainsky [Fri, 11 Aug 2017 10:56:32 +0000 (12:56 +0200)]
Mention the category laws explicitly
David Luposchainsky [Fri, 11 Aug 2017 10:50:13 +0000 (12:50 +0200)]
Add some Monoid doctests
David Luposchainsky [Fri, 11 Aug 2017 10:31:23 +0000 (12:31 +0200)]
Insert missing blank line to fix Applicative doc
David Luposchainsky [Fri, 11 Aug 2017 09:26:52 +0000 (11:26 +0200)]
Sections with undefined operators have non-standard behavior
David Luposchainsky [Fri, 11 Aug 2017 08:38:24 +0000 (10:38 +0200)]
Doctest for Void.absurd
Alexander Biehl [Fri, 11 Aug 2017 06:29:23 +0000 (08:29 +0200)]
Handle ListPat in isStrictPattern
This fixes #14105.
Chris Martin [Thu, 10 Aug 2017 23:37:02 +0000 (19:37 -0400)]
Remove extra ` from "kind-indexed GADTs" doc
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
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
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
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
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
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.
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.
Ben Gamari [Tue, 15 Aug 2017 00:52:57 +0000 (20:52 -0400)]
Bump nofib submodule
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
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
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
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
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
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
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
Ben Gamari [Tue, 8 Aug 2017 03:40:51 +0000 (23:40 -0400)]
Point to FunDeps documentation on Haskell wiki
Ryan Scott [Sat, 12 Aug 2017 20:24:19 +0000 (16:24 -0400)]
Add test for #14101
I forgot to do this in
0bb1e84034a12d7f700b48fca6710c01bd08f397.
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
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
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
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
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
Cyd Parser [Mon, 7 Aug 2017 05:23:23 +0000 (22:23 -0700)]
Fix EmptyCase documentation
David Luposchainsky [Sun, 6 Aug 2017 11:32:52 +0000 (13:32 +0200)]
Convert examples to doctests, and add a handful of new ones
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
Oleg Grenrus [Fri, 4 Aug 2017 15:07:14 +0000 (18:07 +0300)]
Add forgotten > in Control.Applicative
As reported by tabaqui on `#hackage`
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
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
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
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
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
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.
Ben Gamari [Tue, 1 Aug 2017 20:51:41 +0000 (16:51 -0400)]
Add .gitmodules entries for text, parsec, mtl submodules
Ben Gamari [Tue, 1 Aug 2017 15:10:46 +0000 (11:10 -0400)]
Bump unix submodule
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
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
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
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
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
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
Gabor Greif [Tue, 1 Aug 2017 12:14:31 +0000 (14:14 +0200)]
Typofixes [ci skip]
Gabor Greif [Mon, 31 Jul 2017 15:34:43 +0000 (17:34 +0200)]
A bunch of typofixes
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.
Simon Peyton Jones [Mon, 31 Jul 2017 12:25:17 +0000 (13:25 +0100)]
Remove redundant goop
See comment:22 in Trac #13594
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
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.
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