| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: bgamari, alanz
Reviewed By: bgamari
Subscribers: sgraf, mpickering, rwbarton, thomie, carter
GHC Trac Issues: #13600
Differential Revision: https://phabricator.haskell.org/D5040
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The behavior previously enabled by this flag is as been the default
since 8.6.1.
Reviewers: simonmar
Subscribers: rwbarton, carter
Differential Revision: https://phabricator.haskell.org/D5193
|
|
|
|
| |
PR: https://github.com/ghc/ghc/pull/201/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
According to the deprecation schedule in the accepted proposal,
the first step is to include `-fwarn-star-is-type` in `-Wcompat`.
Test Plan: Validate
Reviewers: bgamari
Reviewed By: bgamari
Subscribers: rwbarton, carter
GHC Trac Issues: #15476
Differential Revision: https://phabricator.haskell.org/D5044
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit allows backpack signatures to enforce constraints like
KnownNat
on data types. Thus it fixes #15379. There were two important
differences in the
way GHC used to handle classes like KnowNat
1. Hand crafted instances of `KnownNat` were forbidden, and
2. The dictionary for an instance `KnownNat T` was generated on the
fly.
For supporting backpack both these points have to be revisited.
Disallowing instances of KnownNat
--------------------------------------------
Users were disallowed to declare instances of certain builtin classes
like KnownNat for obvious safety reasons --- when we use the
constraint like `KnownNat T`, we want T to be associated to a natural
number. However, due to the reuse of this code while processing backpack
signatures, `instance KnownNat T` were being disallowed even in module
signature files.
There is an important difference when it comes to instance declarations
in a signature file. Consider the signature `Abstract` given below
```
signature Abstract where
data T :: Nat
instance KnownNat T
```
Inside a signature like `Abstract`, the `instance Known T` is not really
creating an instance but rather demanding any module that implements
this signature to enforce the constraint `KnownNat` on its type
T. While hand crafted KnownNat instances continued to be prohibited in
modules,
this commit ensures that it is not forbidden while handling signatures.
Resolving Dictionaries
----------------------------
Normally GHC expects any instance `T` of class `KnownNat` to eventually
resolve
to an integer and hence used to generate the evidence/dictionary for
such instances
on the fly as in when it is required. However, when backpack module and
signatures are involved
It is not always possible to resolve the type to a concrete integer
utill the mixin stage. To illustrate
consider again the signature `Abstract`
> signature Abstract where
> data T :: Nat
> instance KnownNat T
and a module `Util` that depends on it:
> module Util where
> import Abstract
> printT :: IO ()
> printT = do print $ natVal (Proxy :: Proxy T)
Clearly, we need to "use" the dictionary associated with `KnownNat T`
in the module `Util`, but it is too early for the compiler to produce
a real dictionary as we still have not fixed what `T` is. Only when we
mixin a concrete module
> module Concrete where
> type T = 42
do we really get hold of the underlying integer.
In this commit, we make the following changes in the resolution of
instance dictionary
for constraints like `KnownNat T`
1. If T is indeed available as a type alias for an integer constant,
generate the dictionary on the fly as before, failing which
2. Do not give up as before but look up the type class environment for
the evidence.
This was enough to make the resolution of `KnownNat` dictionaries work
in the setting of Backpack as
when actual code is generated, the signature Abstract (due to the
`import Abstract` ) in `Util` gets
replaced by an actual module like Concrete, and resolution happens as
before.
Everything that we said for `KnownNat` is applicable for `KnownSymbol`
as well.
Reviewers: bgamari, ezyang, goldfire, simonpj
Reviewed By: simonpj
Subscribers: simonpj, ezyang, rwbarton, thomie, carter
GHC Trac Issues: #15379
Differential Revision: https://phabricator.haskell.org/D4988
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
We have more and more users of GHC as a library, for example the
Haskell-to-WebAssembly-compiler https://github.com/tweag/asterius.
These need to make different decisions about various aspects of
code generation than the host compiler, and ideally GHC-the-library
allows them to set the `DynFlags` as needed.
This patch adds a new `DynFlag` that configures which `integer`
library to use. This flag is initialized by `cIntegerLibraryType`
(as before), and is only used in `CorePrep` to decide whether to
use `S#` or not.
The other code paths that were varying based on `cIntegerLibraryType`
are no now longer varying: The trick is to use `integer-wired-in`
as the `-this-unit-id` when compiling either `integer-gmp` or
`integer-simple`.
Test Plan: Validate is happy.
Reviewers: hvr, bgamari
Reviewed By: bgamari
Subscribers: TerrorJack, adamse, simonpj, rwbarton, carter
GHC Trac Issues: #13477
Differential Revision: https://phabricator.haskell.org/D5079
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
GHC 8.6.1 is out, so now GHC's support window only extends
back to GHC 8.4. This means we can delete gobs of code that were
only used for GHC 8.2 support. Hooray!
Test Plan: ./validate
Reviewers: bgamari, Phyx, erikd
Reviewed By: bgamari, Phyx
Subscribers: rwbarton, erikd, carter
Differential Revision: https://phabricator.haskell.org/D5192
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: See the new T12005 test case for an example of this.
Test Plan: make TEST=T12005
Reviewers: bgamari, osa1
Reviewed By: osa1
Subscribers: osa1, rwbarton, carter
GHC Trac Issues: #12005
Differential Revision: https://phabricator.haskell.org/D5182
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
I noticed while playing around with
https://github.com/fbsamples/ghc-hotswap/ that the main binary needs to
have a custom main function to set `config.keep_cafs = true` when
initialising the runtime. This is pretty annoying, it means an extra
C file with some cryptic incantations in it, and a `-no-hs-main` flag.
So I've replaced this with a link-time flag to GHC, `-fkeep-cafs` that
does the same thing.
Test Plan:
New unit test that tests for the RTS's GC'd CAFs assertion, and also
the -keep-cafs flag.
Reviewers: bgamari, osa1, erikd, noamz
Reviewed By: osa1
Subscribers: rwbarton, carter
Differential Revision: https://phabricator.haskell.org/D5183
|
|
|
|
| |
PR: https://github.com/ghc/ghc/pull/199/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace the error message
`Use -v to see a list of the files searched for.`
with
`Use -v (or :set -v` in ghci) to see a list of the files searched for.`
Reviewers: bgamari, monoidal, thomie, osa1
Subscribers: rwbarton, carter
GHC Trac Issues: #13862
Differential Revision: https://phabricator.haskell.org/D5122
|
|
|
|
|
|
|
|
| |
While we now support use of StaticPointers in modules loaded via the
REPL (e.g. via `:load`), we currently do not support use of
StaticPointers on the REPL itself.
This reverts commit 9400a5c6b308fbb5b3a73690610736ca3b5eb0b3.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This removes the last direct import from simplCore/
to typechecker/.
Test Plan: validate
Reviewers: nomeata, simonpj, bgamari
Reviewed By: simonpj
Subscribers: rwbarton, carter
GHC Trac Issues: #14391
Differential Revision: https://phabricator.haskell.org/D5139
|
|
|
|
|
| |
Support for StaticPointers was added in #12356 but I apparently
neglected to remove the warning.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Having direct access to this field is going to enable Haddock to
compute in batch which modules to load before looking up instances
of external packages.
Reviewers: bgamari, monoidal
Reviewed By: monoidal
Subscribers: rwbarton, carter
Differential Revision: https://phabricator.haskell.org/D5100
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: After a parse error in OPTIONS_GHC issue an error message instead of a compiler panic.
Test Plan: make test TEST=T15053
Reviewers: Phyx, thomie, bgamari, monoidal, osa1
Reviewed By: Phyx, monoidal, osa1
Subscribers: tdammers, osa1, rwbarton, carter
GHC Trac Issues: #15053
Differential Revision: https://phabricator.haskell.org/D5093
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
GHC 8.4 corresponds to 804, not 840.
Found by Gabor Greif.
Test Plan: Harbormaster
Reviewers: ggreif, bgamari, mpickering
Reviewed By: ggreif
Subscribers: rwbarton, carter
Differential Revision: https://phabricator.haskell.org/D5064
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
PrefixPred and AnySuffixPred are not used
since static flags were removed in bbd3c399939.
Test Plan: validate
Reviewers: bgamari, tdammers
Reviewed By: tdammers
Subscribers: rwbarton, carter
Differential Revision: https://phabricator.haskell.org/D5111
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This completes the work started in D4227 by using just 'getExecutablePath'
in ghc and ghc-pkg when building with base >= 4.11.0.
On the long term, we will be able to simply kill the existing code that
follows (or not) symlinks and just get this behaviour for free from
getExecutable. For now we however have to require base >= 4.11.0 to be able
to just use getExecutablePath under Windows, and use the current code when
building with an older base.
Original code by @alpmestan commandeering since patch has been stale
and bug remains open.
Test Plan: Validate
Reviewers: angerman, bgamari, erikd, alpmestan
Reviewed By: bgamari
Subscribers: carter, rwbarton, thomie
GHC Trac Issues: #14483
Differential Revision: https://phabricator.haskell.org/D4229
|
|
|
|
|
| |
Provoked by discussion on Phab:D5097 (Trac #15546), I'm adding
a big Note explaing the strategy of pretty-printing via IfaceSyn
|
|
|
|
|
|
|
|
| |
This reverts commit 1cc9061fce4270739677d475190fd6e890e8b1f9.
This appears to break a clean build with certain versions of
`ld.gold`. See
https://phabricator.haskell.org/rGHC1cc9061fce42#132967.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Calculating which modules to load based on the InteractiveContext means
maintaining a potentially very large GblRdrEnv.
In Haddock's case, it is much cheaper (from a memory perspective) to
just keep track of which modules interfaces we want loaded then hand
these off explicitly to 'getNameToInstancesIndex'.
Bumps haddock submodule.
Reviewers: alexbiehl, bgamari
Reviewed By: alexbiehl
Subscribers: rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D5003
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: `make test=T10869`
Reviewers: mpickering, thomie, ezyang, bgamari
Reviewed By: thomie, bgamari
Subscribers: rwbarton, carter
GHC Trac Issues: #10869
Differential Revision: https://phabricator.haskell.org/D4861
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds foldl' to GhcPrelude and changes must occurences
of foldl to foldl'. This leads to better performance especially
for quick builds where GHC does not perform strictness analysis.
It does change strictness behaviour when we use foldl' to turn
a argument list into function applications. But this is only a
drawback if code looks ONLY at the last argument but not at the first.
And as the benchmarks show leads to fewer allocations in practice
at O2.
Compiler performance for Nofib:
O2 Allocations:
-1 s.d. ----- -0.0%
+1 s.d. ----- -0.0%
Average ----- -0.0%
O2 Compile Time:
-1 s.d. ----- -2.8%
+1 s.d. ----- +1.3%
Average ----- -0.8%
O0 Allocations:
-1 s.d. ----- -0.2%
+1 s.d. ----- -0.1%
Average ----- -0.2%
Test Plan: ci
Reviewers: goldfire, bgamari, simonmar, tdammers, monoidal
Reviewed By: bgamari, monoidal
Subscribers: tdammers, rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4929
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In https://github.com/gentoo-haskell/gentoo-haskell/issues/704
user explicitly uses -Wl,--relax for most built binaries.
Most of the time this works fine except for capi haskell code
similar to the following:
```haskell
{-# LANGUAGE CApiFFI #-}
module Z where
import Foreign.C
foreign import capi "unistd.h close" c_close :: CInt -> IO CInt
```
In this case compilation fails as:
```
$ inplace/bin/ghc-stage2 -c Z.hs -optl-Wl,--relax -fforce-recomp
ld: --relax and -r may not be used together
```
GHC's driver already disables relaxation on sparc as there relaxation
is already a default mode.
This change disables relaxation on partial linking for all platforms
where linker is binutils linker.
Reported-by: wmyrda
Bug: https://github.com/gentoo-haskell/gentoo-haskell/issues/704
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: pass -optl-Wl,--relax in test above
Reviewers: bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4888
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This contains two commits:
----
Make GHC's code-base compatible w/ `MonadFail`
There were a couple of use-sites which implicitly used pattern-matches
in `do`-notation even though the underlying `Monad` didn't explicitly
support `fail`
This refactoring turns those use-sites into explicit case
discrimations and adds an `MonadFail` instance for `UniqSM`
(`UniqSM` was the worst offender so this has been postponed for a
follow-up refactoring)
---
Turn on MonadFail desugaring by default
This finally implements the phase scheduled for GHC 8.6 according to
https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail#Transitionalstrategy
This also preserves some tests that assumed MonadFail desugaring to be
active; all ghc boot libs were already made compatible with this
`MonadFail` long ago, so no changes were needed there.
Test Plan: Locally performed ./validate --fast
Reviewers: bgamari, simonmar, jrtc27, RyanGlScott
Reviewed By: bgamari
Subscribers: bgamari, RyanGlScott, rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D5028
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: make TEST=T12625
Reviewers: jstolarek, austin, bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #12625
Differential Revision: https://phabricator.haskell.org/D5030
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We need to store the used plugins so that we recompile
a module when a plugin that it uses is recompiled.
However, storing the `ModuleName`s of the plugins used by a
module in the `dep_mods` field made the rest of GHC think
that they belong in the HPT, causing at least the issues
reported in #15234
We therefor store the `ModuleName`s of the plugins in a
new field, `dep_plgins`, which is only used the the
recompilation logic.
Reviewers: mpickering, bgamari
Reviewed By: mpickering, bgamari
Subscribers: alpmestan, rwbarton, thomie, carter
GHC Trac Issues: #15234
Differential Revision: https://phabricator.haskell.org/D4937
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: All the work was done by Moritz Angermann.
Test Plan: validate
Reviewers: angerman, RyanGlScott, bgamari
Reviewed By: angerman
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #15396
Differential Revision: https://phabricator.haskell.org/D5013
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change was previously part of
[D4904](https://phabricator.haskell.org/D4904), but is being split off
to aid in getting this reviewed and merged.
* The compiler code is built with `NoImplicitPrelude`, but GHCi's
modules are incompatible with it. So, this adds the pragma to all GHCi
modules that didn't have it, and adds imports of Prelude.
* In order to run GHC within itself, a `call of 'initGCStatistics`
needed to be skipped. This uses CPP to skip it when
`-DGHC_LOADED_INTO_GHCI` is set.
* There is an environment variable workaround suggested by Ben Gamari
[1], where `_GHC_TOP_DIR` can be used to specify GHC's top dir if `-B`
isn't provided. This can be used to solve a problem where the GHC being
run within GHCi attempts to look in `inplace/lib/lib/` instead of
`inplace/lib/`.
[1]: https://phabricator.haskell.org/D4904#135438
Reviewers: goldfire, bgamari, erikd, alpmestan
Reviewed By: alpmestan
Subscribers: alpmestan, lelf, rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4986
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The constraint (~) used to be (effectively):
class a ~~ b => (a :: k) ~ (b :: k)
but, with this patch, it is now defined uniformly with
(~~) and Coercible like this:
class a ~# b => (a :: k) ~ (b :: k)
Result:
* One less superclass selection when goinng from (~) to (~#)
Better for compile time and better for debugging with -ddump-simpl
* The code for (~), (~~), and Coercible looks uniform, and appears
together, e.g. in TysWiredIn and ClsInst.matchGlobalInst.
Previously the code for (~) was different, and unique.
Not only is this simpler, but it also makes the compiler a bit faster;
T12227: 9% less allocation
T12545: 7% less allocation
This patch fixes Trac #15421
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
While working on [D904](https://phabricator.haskell.org/D4904), I noticed that
'findTopDir' was being invoked three times. This isn't a big problem, because
it is usually very cheap. On windows, it does require some involved logic,
though, so to me it would make sense to only run it once.
Reviewers: bgamari, monoidal
Reviewed By: monoidal
Subscribers: rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4987
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* All the tests in tests/ghci.debugger now pass with
-fexternal-interpreter. These tests are now run with the ghci-ext way
in addition to the normal way so we won't break it in the future.
* I removed all the unsafeCoerce# calls from RtClosureInspect. Yay!
The main changes are:
* New messages: GetClosure and Seq. GetClosure is a remote interface to
GHC.Exts.Heap.getClosureData, which required Binary instances for
various datatypes. Fortunately this wasn't too painful thanks to
DeriveGeneric.
* No cheating by unsafeCoercing values when printing them. Now we have
to turn the Closure representation back into the native representation
when printing Int, Float, Double, Integer and Char. Of these, Integer
was the most painful - we now have a dependency on integer-gmp due to
needing access to the representation.
* Fixed a bug in rts/Heap.c - it was bogusly returning stack content as
pointers for an AP_STACK closure.
Test Plan:
* `cd testsuite/tests/ghci.debugger && make`
* validate
Reviewers: bgamari, patrickdoc, nomeata, angerman, hvr, erikd, goldfire
Subscribers: alpmestan, snowleopard, rwbarton, thomie, carter
GHC Trac Issues: #13184
Differential Revision: https://phabricator.haskell.org/D4955
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implementation of the "Embrace TypeInType" proposal was done according
to the spec, which specified that TypeOperators must imply NoStarIsType.
This implication was meant to prevent breakage and to be removed in 2
releases. However, compiling head.hackage has shown that this
implication only magnified the breakage, so there is no reason to have
it in the first place.
To remain in compliance with the three-release policy, we add a
workaround to define the (*) type operator even when -XStarIsType is on.
Test Plan: ./validate
Reviewers: bgamari, RyanGlScott, goldfire, phadej, hvr
Reviewed By: bgamari, RyanGlScott
Subscribers: harpocrates, rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4865
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Trac #15338 is yet another example where -Bsymbolic breaks
semantics of a C program: global variable duplication happens
and unsafePerformIO creates two stdout copies.
When -Bsymbolic is not used both C compiler and linker agree
on how global variables are handled. In case of sh4 it consists
on a few assertions:
1. global variable is exported from shared library
2. code is referred to this variable via GOT-like mechanism to allow
interposition
3. global variable is present .bss section on an executable
(as an R_*_COPY relocation: symbol contents is copied at executable
startup time)
4. and symbol in executable interposes symbol in shared library.
This way both code in shared library and code in executable refer
to a copy of global variable in .bss section of an executable.
Unfortunately -Bsymbolic option breaks assumption [2.] and generates
direct references to the symbol. This causes mismatch between
values seen from executable and values seen from shared library code.
This change disables '-Bsymbolic' for unregisterised targets.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: test 'ghc-pkg --version | cat' to emit data
Reviewers: simonmar, bgamari, jrtc27
Reviewed By: jrtc27
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #15338
Differential Revision: https://phabricator.haskell.org/D4959
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
All these were detected by -fghci-leak-check when GHC was
compiled *without* optimisation (e.g. using the "quick" build flavour).
Unfortunately I don't know of a good way to keep this working. I'd like
to just disable the -fghci-leak-check flag when the compiler is built
without optimisation, but it doesn't look like we have an easy way to do
that. And even if we could, it would be fragile anyway,
Test Plan: `cd testsuite/tests/ghci; make`
Reviewers: bgamari, hvr, erikd, tdammers
Subscribers: tdammers, rwbarton, thomie, carter
GHC Trac Issues: #15246
Differential Revision: https://phabricator.haskell.org/D4872
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows modification of each `HsGroup` after it has been renamed.
The old behaviour of keeping the renamed source until later can be
recovered if desired by using the `keepRenamedSource` plugin but it
shouldn't really be necessary as it can be inspected in the `TcGblEnv`.
Reviewers: nboldi, bgamari, alpmestan
Reviewed By: nboldi, alpmestan
Subscribers: alpmestan, rwbarton, thomie, carter
GHC Trac Issues: #15315
Differential Revision: https://phabricator.haskell.org/D4947
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
One issue with valid hole fits is that the function names can often be
opaque for the uninitiated, such as `($)`. This diff adds a new flag,
`-fshow-docs-of-hole-fits` that adds the documentation of the identifier
in question to the message, using the same mechanism as the `:doc`
command.
As an example, with this flag enabled, the valid hole fits for `_ ::
[Int] -> Int` will include:
```
Valid hole fits include
head :: forall a. [a] -> a
{-^ Extract the first element of a list, which must be non-empty.-}
with head @Int
(imported from ‘Prelude’ (and originally defined in ‘GHC.List’))
```
And one of the refinement hole fits, `($) _`, will read:
```
Valid refinement hole fits include
...
($) (_ :: [Int] -> Int)
where ($) :: forall a b. (a -> b) -> a -> b
{-^ Application operator. This operator is redundant, since ordinary
application @(f x)@ means the same as @(f '$' x)@. However, '$' has
low, right-associative binding precedence, so it sometimes allows
parentheses to be omitted; for example:
> f $ g $ h x = f (g (h x))
It is also useful in higher-order situations, such as @'map' ('$' 0) xs@,
or @'Data.List.zipWith' ('$') fs xs@.
Note that @($)@ is levity-polymorphic in its result type, so that
foo $ True where foo :: Bool -> Int#
is well-typed-}
with ($) @'GHC.Types.LiftedRep @[Int] @Int
(imported from ‘Prelude’ (and originally defined in ‘GHC.Base’))
```
Another example of where documentation can come in very handy, is when
working with the `lens` library.
When you compile
```
{-# OPTIONS_GHC -fno-show-provenance-of-hole-fits -fshow-docs-of-hole-fits #-}
module LensDemo where
import Control.Lens
import Control.Monad.State
newtype Test = Test { _value :: Int } deriving (Show)
value :: Lens' Test Int
value f (Test i) = Test <$> f i
updTest :: Test -> Test
updTest t = t &~ do
_ value (1 :: Int)
```
You get:
```
Valid hole fits include
(#=) :: forall s (m :: * -> *) a b.
MonadState s m =>
ALens s s a b -> b -> m ()
{-^ A version of ('Control.Lens.Setter..=') that works on 'ALens'.-}
with (#=) @Test @(StateT Test Identity) @Int @Int
(<#=) :: forall s (m :: * -> *) a b.
MonadState s m =>
ALens s s a b -> b -> m b
{-^ A version of ('Control.Lens.Setter.<.=') that works on 'ALens'.-}
with (<#=) @Test @(StateT Test Identity) @Int @Int
(<*=) :: forall s (m :: * -> *) a.
(MonadState s m, Num a) =>
LensLike' ((,) a) s a -> a -> m a
{-^ Multiply the target of a numerically valued 'Lens' into your 'Monad''s
state and return the result.
When you do not need the result of the multiplication,
('Control.Lens.Setter.*=') is more flexible.
@
('<*=') :: ('MonadState' s m, 'Num' a) => 'Lens'' s a -> a -> m a
('<*=') :: ('MonadState' s m, 'Num' a) => 'Control.Lens.Iso.Iso'' s a -> a -> m a
@-}
with (<*=) @Test @(StateT Test Identity) @Int
(<+=) :: forall s (m :: * -> *) a.
(MonadState s m, Num a) =>
LensLike' ((,) a) s a -> a -> m a
{-^ Add to the target of a numerically valued 'Lens' into your 'Monad''s state
and return the result.
When you do not need the result of the addition,
('Control.Lens.Setter.+=') is more flexible.
@
('<+=') :: ('MonadState' s m, 'Num' a) => 'Lens'' s a -> a -> m a
('<+=') :: ('MonadState' s m, 'Num' a) => 'Control.Lens.Iso.Iso'' s a -> a -> m a
@-}
with (<+=) @Test @(StateT Test Identity) @Int
(<-=) :: forall s (m :: * -> *) a.
(MonadState s m, Num a) =>
LensLike' ((,) a) s a -> a -> m a
{-^ Subtract from the target of a numerically valued 'Lens' into your 'Monad''s
state and return the result.
When you do not need the result of the subtraction,
('Control.Lens.Setter.-=') is more flexible.
@
('<-=') :: ('MonadState' s m, 'Num' a) => 'Lens'' s a -> a -> m a
('<-=') :: ('MonadState' s m, 'Num' a) => 'Control.Lens.Iso.Iso'' s a -> a -> m a
@-}
with (<-=) @Test @(StateT Test Identity) @Int
(<<*=) :: forall s (m :: * -> *) a.
(MonadState s m, Num a) =>
LensLike' ((,) a) s a -> a -> m a
{-^ Modify the target of a 'Lens' into your 'Monad''s state by multipling a value
and return the /old/ value that was replaced.
When you do not need the result of the operation,
('Control.Lens.Setter.*=') is more flexible.
@
('<<*=') :: ('MonadState' s m, 'Num' a) => 'Lens'' s a -> a -> m a
('<<*=') :: ('MonadState' s m, 'Num' a) => 'Iso'' s a -> a -> m a
@-}
with (<<*=) @Test @(StateT Test Identity) @Int
(Some hole fits suppressed; use -fmax-valid-hole-fits=N or -fno-max-valid-hole-fits)
```
Which allows you to see at a glance what opaque operators like `(<<*=)`
and `(<#=)` do.
Reviewers: bgamari, sjakobi
Reviewed By: sjakobi
Subscribers: sjakobi, alexbiehl, rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4848
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: validate
Reviewers: bgamari, alpmestan
Reviewed By: alpmestan
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #15342
Differential Revision: https://phabricator.haskell.org/D4933
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test Plan: "ghc -Wamp XXX.hs" should give "unrecognised warning flag"
Reviewers: bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #11477
Differential Revision: https://phabricator.haskell.org/D4785
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When GHC links binaries on windows, we pass a -L and -l flag
to gcc for each dependency in the transitive dependency
closure. As this will usually overflow the command argument
limit on windows, we use response files to pass all arguments
to gcc. gcc however internally passes only the -l flags via
a response file to the collect2 command, but puts the -L flags
on the command line. As such if we pass enough -L flags to
gcc--even via a response file--we will eventually overflow the
command line argument length limit due to gcc passing them
to collect2 without resorting to a response file.
To prevent this from happening we move all lirbaries into a
shared temporary folder, and only need to pass a single -L
flag to gcc. Ideally however this was fixed in gcc.
Reviewers: bgamari, Phyx
Reviewed By: bgamari
Subscribers: erikd, rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4762
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a flag `-Werror=compat` to GHC which has the effect of `-Werror=x
-Werror=y ...`, where `x, y, ...` are warnings from the `-Wcompat`
option group.
Test Plan: ./validate
Reviewers: bgamari
Reviewed By: bgamari
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #15278
Differential Revision: https://phabricator.haskell.org/D4860
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a module cannot be found because it is ignored or from an unusable
package, report this to the user and the reason it is unusable.
Currently, GHC displays the standard "Cannot find module error". For
example:
```
<no location info>: error:
Could not find module ‘Control.Monad.Random’
Perhaps you meant
Control.Monad.Reader (from mtl-2.2.2)
Control.Monad.Cont (from mtl-2.2.2)
Control.Monad.Error (from mtl-2.2.2)
```
GHC does, however, indicate unusable/ignored packages with the -v flag:
```
package MonadRandom-0.5.1-1421RgpXdhC8e8UI7D3emA is unusable due to
missing dependencies:
fail-4.9.0.0-BAHmj60kS5K7NVhhKpm9J5
```
With this change, I took that message and added it to the output of the
"Cannot find module" message.
Reviewers: bgamari, dfeuer
Reviewed By: bgamari
Subscribers: Phyx, dfeuer, rwbarton, thomie, carter
GHC Trac Issues: #4806
Differential Revision: https://phabricator.haskell.org/D4783
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
According to an accepted proposal
https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/002
4-no-kind-vars.rst
With -Wcompat, warn if a kind variable is brought into scope
implicitly in a type with an explicit forall. This applies to type
signatures and to other contexts that allow a forall with the
forall-or-nothing rule in effect (for example, class instances).
Test Plan: Validate
Reviewers: goldfire, hvr, bgamari, RyanGlScott
Reviewed By: goldfire
Subscribers: RyanGlScott, rwbarton, thomie, carter
GHC Trac Issues: #15264
Differential Revision: https://phabricator.haskell.org/D4834
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Until now GHC only supported basic constant folding (lit op lit, expr op
0, etc.).
This patch uses laws of +/-/* (associativity, commutativity,
distributivity) to support some constant folding into nested
expressions.
Examples of new transformations:
- simple nesting: (10 + x) + 10 becomes 20 + x
- deep nesting: 5 + x + (y + (z + (t + 5))) becomes 10 + (x + (y + (z + t)))
- distribution: (5 + x) * 6 becomes 30 + 6*x
- simple factorization: 5 + x + (x + (x + (x + 5))) becomes 10 + (4 *x)
- siblings: (5 + 4*x) - (3*x + 2) becomes 3 + x
Test Plan: validate
Reviewers: simonpj, austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
GHC Trac Issues: #9136
Differential Revision: https://phabricator.haskell.org/D2858
(cherry picked from commit fea04defa64871caab6339ff3fc5511a272f37c7)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add support for built-in Natural literals in Core.
- Replace MachInt,MachWord, LitInteger, etc. with a single LitNumber
constructor with a LitNumType field
- Support built-in Natural literals
- Add desugar warning for negative literals
- Move Maybe(..) from GHC.Base to GHC.Maybe for module dependency
reasons
This patch introduces only a few rules for Natural literals (compared
to Integer's rules). Factorization of the built-in rules for numeric
literals will be done in another patch as this one is already big to
review.
Test Plan:
validate
test build with integer-simple
Reviewers: hvr, bgamari, goldfire, Bodigrim, simonmar
Reviewed By: bgamari
Subscribers: phadej, simonpj, RyanGlScott, carter, hsyl20, rwbarton,
thomie
GHC Trac Issues: #14170, #14465
Differential Revision: https://phabricator.haskell.org/D4212
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Implement the "Embrace Type :: Type" GHC proposal,
.../ghc-proposals/blob/master/proposals/0020-no-type-in-type.rst
GHC 8.0 included a major change to GHC's type system: the Type :: Type
axiom. Though casual users were protected from this by hiding its
features behind the -XTypeInType extension, all programs written in GHC
8+ have the axiom behind the scenes. In order to preserve backward
compatibility, various legacy features were left unchanged. For example,
with -XDataKinds but not -XTypeInType, GADTs could not be used in types.
Now these restrictions are lifted and -XTypeInType becomes a redundant
flag that will be eventually deprecated.
* Incorporate the features currently in -XTypeInType into the
-XPolyKinds and -XDataKinds extensions.
* Introduce a new extension -XStarIsType to control how to parse * in
code and whether to print it in error messages.
Test Plan: Validate
Reviewers: goldfire, hvr, bgamari, alanz, simonpj
Reviewed By: goldfire, simonpj
Subscribers: rwbarton, thomie, mpickering, carter
GHC Trac Issues: #15195
Differential Revision: https://phabricator.haskell.org/D4748
|