ghc.git
3 years agoTest #11252 in ghci/scripts/T11252
Richard Eisenberg [Sat, 9 Jan 2016 16:26:14 +0000 (11:26 -0500)] 
Test #11252 in ghci/scripts/T11252

This one worked for me out of the box.

3 years agoFix #11355.
Richard Eisenberg [Sat, 9 Jan 2016 16:18:53 +0000 (11:18 -0500)] 
Fix #11355.

Previously, the check for impredicative type applications was
in the wrong spot.

Test case: typecheck/should_fail/T11355

3 years agoExpand type/kind synonyms in TyVars before deriving-related typechecking
RyanGlScott [Fri, 15 Jan 2016 16:42:02 +0000 (17:42 +0100)] 
Expand type/kind synonyms in TyVars before deriving-related typechecking

Before, it was possible to have a datatypes such as

```
type ConstantT a b = a
newtype T (f :: * -> *) (a :: ConstantT * f) = T (f a) deriving Functor

data family TFam (f :: * -> *) (a :: *)
newtype instance TFam f (ConstantT a f) = TFam (f a) deriving Functor
```

fail to eta-reduce because either (1) a TyVar had a kind synonym that
mentioned another TyVar, or (2) an instantiated type was itself a type
synonym that mentioned another TyVar. A little bit of tweaking to
`expandTypeSynonyms` and applying it before the eta-reduction check in
the `deriving` machinery is sufficient to fix this.

Fixes #11416.

Test Plan: ./validate

Reviewers: goldfire, simonpj, austin, bgamari

Reviewed By: simonpj

Subscribers: thomie

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

GHC Trac Issues: #11416

3 years agoAllow pattern synonyms which have several clauses.
Matthew Pickering [Fri, 15 Jan 2016 16:40:51 +0000 (17:40 +0100)] 
Allow pattern synonyms which have several clauses.

But still disallow empty pattern synonym builder declarations. Handling
this incorrectly was the cause of #11367.

Test Plan: ./validate

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #11367

3 years agoconfigure.ac: Export MAKECMD to build system
Karel Gardas [Fri, 15 Jan 2016 16:38:41 +0000 (17:38 +0100)] 
configure.ac: Export MAKECMD to build system

Reviewers: austin, bgamari, thomie

Reviewed By: thomie

Subscribers: angerman, thomie, erikd

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

3 years agoRefactor lookupFixityRn-related code following D1744
RyanGlScott [Fri, 15 Jan 2016 15:37:18 +0000 (16:37 +0100)] 
Refactor lookupFixityRn-related code following D1744

Test Plan: ./validate

Reviewers: goldfire, austin, bgamari, simonpj

Subscribers: simonpj, thomie

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

GHC Trac Issues: #11345

3 years agoDon't output manpage in same directory as source
Ben Gamari [Fri, 15 Jan 2016 15:35:38 +0000 (16:35 +0100)] 
Don't output manpage in same directory as source

Test Plan: Validate

Reviewers: austin, thomie, nomeata

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

GHC Trac Issues: #11433

3 years agoUse XZ compression by default
Ben Gamari [Fri, 15 Jan 2016 14:19:10 +0000 (15:19 +0100)] 
Use XZ compression by default

Resolves #11434.

3 years agoLink command line libs to temp so
Peter Trommler [Fri, 15 Jan 2016 12:25:38 +0000 (13:25 +0100)] 
Link command line libs to temp so

Symbols in libraries specified on the GHCis command line are
not available to compiled modules because shared libraries
are loaded with local scope. So we link all libraries specified
on the command line into each temporary shared library.

Test Plan: validate

Reviewers: simonmar, hvr, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #10458

3 years agousers-guide: Fix cabal version number
Ben Gamari [Fri, 15 Jan 2016 12:16:51 +0000 (13:16 +0100)] 
users-guide: Fix cabal version number

3 years agouser-guide: Note Cabal version limitation
Ben Gamari [Thu, 14 Jan 2016 14:46:31 +0000 (15:46 +0100)] 
user-guide: Note Cabal version limitation

3 years agoANNOUNCE: Mention powerpc code generator
Ben Gamari [Thu, 14 Jan 2016 14:38:49 +0000 (15:38 +0100)] 
ANNOUNCE: Mention powerpc code generator

3 years agoFix #11015 with a nice note.
Edward Z. Yang [Thu, 14 Jan 2016 00:10:11 +0000 (16:10 -0800)] 
Fix #11015 with a nice note.

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

Reviewers: bgamari, austin

Subscribers: thomie

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

GHC Trac Issues: #11015

3 years agoRemove lookup of sections by name instead use the index numbers as offsets
Tamar Christina [Tue, 12 Jan 2016 19:34:25 +0000 (20:34 +0100)] 
Remove lookup of sections by name instead use the index numbers as offsets

Summary:
This patch comes from @awson

{{{
Playing with `-fsplit-sections` on Windows I've found a pile of ancient
(it was borrowed from Hugs interpreter code and I don't even know when
was it created), absolutely redundant and plain wrong code in RTS linker.

Technically it is a bug, but it doesn't break things when used with
current Windows binutils with no special linker scripts involved.

OTOH, it slows down runtime linker on Windows noticeably and thus can
be considered as a performance bug.

The nice side-effect for existing users is that GHCi now loads compiled
object code much faster on Windows.
}}}

More specifically, sections were being looked up by name by doing a loop
over all sections until the section with the given name is found.

The new approach uses the section index and finds the section in O(1) time
based on information gathered when we originally processed the section

Test Plan: ./validate (was run on GHC x86)

Reviewers: austin, awson, erikd, thomie, bgamari

Reviewed By: thomie, bgamari

Subscribers: awson, #ghc_windows_task_force

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

GHC Trac Issues: #11388

3 years agoT11300: Fix test on windows
Tamar Christina [Sun, 10 Jan 2016 06:20:57 +0000 (07:20 +0100)] 
T11300: Fix test on windows

Summary: Fix exit code for Windows to match expected for out-of-memory test

Test Plan: ./validate

Reviewers: simonmar, austin, thomie, bgamari

Reviewed By: thomie, bgamari

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

GHC Trac Issues: #11422

3 years agoAPI Annotations: use AnnValue for (~)
Alan Zimmerman [Thu, 14 Jan 2016 18:46:35 +0000 (20:46 +0200)] 
API Annotations: use AnnValue for (~)

Previously oqtycon used AnnTilde for the location of the RdrName when
parsing (~).

The recent increase in '~' characters in the AST confuses
ghc-exactprint, so this patch treats all RdrNames the same way now,
marking the location of the core name with AnnValue.

3 years agouser-guide: Use ghc-flag for dump formatting flags
Ben Gamari [Thu, 14 Jan 2016 12:49:17 +0000 (13:49 +0100)] 
user-guide: Use ghc-flag for dump formatting flags

And document -dth-dec-file. Not sure how these were missed.

3 years agousers-guide: Add since annotations for language extensions
Ben Gamari [Thu, 14 Jan 2016 11:18:09 +0000 (12:18 +0100)] 
users-guide: Add since annotations for language extensions

Based off of
https://ghc.haskell.org/trac/ghc/wiki/LanguagePragmaHistory.

3 years agousers-guide: Update language extension implications
Ben Gamari [Thu, 14 Jan 2016 11:08:14 +0000 (12:08 +0100)] 
users-guide: Update language extension implications

3 years agoRename InjectiveTypeFamilies to TypeFamilyDependencies
Ben Gamari [Thu, 14 Jan 2016 10:52:10 +0000 (11:52 +0100)] 
Rename InjectiveTypeFamilies to TypeFamilyDependencies

3 years agoINSTALL.md: Mention -j and other wibbles
Ben Gamari [Thu, 14 Jan 2016 10:33:09 +0000 (11:33 +0100)] 
INSTALL.md: Mention -j and other wibbles

3 years agoAdd tests for #11391
Ben Gamari [Thu, 14 Jan 2016 10:27:37 +0000 (11:27 +0100)] 
Add tests for #11391

3 years agoGHC.Generics: Fix documentation
Ben Gamari [Wed, 13 Jan 2016 20:36:51 +0000 (21:36 +0100)] 
GHC.Generics: Fix documentation

Fixes #11417.

3 years agousers-guide: Wibbles
Ben Gamari [Wed, 13 Jan 2016 18:53:01 +0000 (19:53 +0100)] 
users-guide: Wibbles

3 years agoMinor code refactoring
Jan Stolarek [Thu, 14 Jan 2016 08:26:44 +0000 (09:26 +0100)] 
Minor code refactoring

This moves let-bindings right next to their use site.

3 years agoMinor improvement in CoreDump outputs:
Ömer Sinan Ağacan [Wed, 13 Jan 2016 14:16:38 +0000 (09:16 -0500)] 
Minor improvement in CoreDump outputs:

Don't add parens unnecessarily when arguments of the application are all
hidden (because of parameters like -dsuppress-all,
-dsuppress-type-applications etc.)

Reviewers: bgamari, austin

Subscribers: thomie

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

3 years agoHandle over-applied custom type errors too.
Iavor S. Diatchki [Wed, 13 Jan 2016 19:30:40 +0000 (11:30 -0800)] 
Handle over-applied custom type errors too.

Consider

    type family F :: Type -> Type where
       F = TypeError (Text "Error")

Now, if we see something like `F Int` we should still report the custom
type error.

3 years agoPrint a message when loading a .ghci file.
Kwang Yul Seo [Wed, 13 Jan 2016 13:54:33 +0000 (14:54 +0100)] 
Print a message when loading a .ghci file.

Test Plan: ./validate

Reviewers: austin, thomie, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

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

GHC Trac Issues: #11389

3 years agoAdd test for Data.Typeable.typeOf
Ben Gamari [Wed, 13 Jan 2016 13:53:21 +0000 (14:53 +0100)] 
Add test for Data.Typeable.typeOf

Test Plan: Validate

Reviewers: goldfire, austin

Subscribers: thomie

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

GHC Trac Issues: #11120

3 years agoAdd missing type representations
Ben Gamari [Wed, 13 Jan 2016 13:53:02 +0000 (14:53 +0100)] 
Add missing type representations

Previously we were missing `Typeable` representations for several
wired-in types (and their promoted constructors). These include,

 * `Nat`
 * `Symbol`
 * `':`
 * `'[]`

Moreover, some constructors were incorrectly identified as being defined
in `GHC.Types` whereas they were in fact defined in `GHC.Prim`.

Ultimately this is just a temporary band-aid as there is general
agreement that we should eliminate the manual definition of these
representations entirely.

Test Plan: Validate

Reviewers: austin, hvr

Subscribers: thomie

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

GHC Trac Issues: #11120

3 years agoTemplateHaskell: revive isStrict, notStrict and unpacked
Thomas Miedema [Wed, 13 Jan 2016 13:45:21 +0000 (14:45 +0100)] 
TemplateHaskell: revive isStrict, notStrict and unpacked

These 3 functions are useful to keep around a bit longer, to prevent
breaking existing code that uses them.

Related to #10697.

Reviewers: austin, goldfire, RyanGlScott, bgamari

Reviewed By: RyanGlScott, bgamari

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

3 years agoUse implicit CallStacks for ASSERT when available
Bartosz Nitka [Wed, 13 Jan 2016 13:44:58 +0000 (14:44 +0100)] 
Use implicit CallStacks for ASSERT when available

This aids with debugging, since all you have to do to get more
stack frames is add a constraint `(?callStack :: CallStack) =>`.

Old output:
```
ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 8.1.20160107 for x86_64-unknown-linux):
        ASSERT failed!
  file compiler/types/TyCoRep.hs line 1800
  InScope []
  [Xuv :-> n_av5[sk]]
  []
```

New output:
```
ghc-stage2: panic! (the 'impossible' happened)
  (GHC version 8.1.20160107 for x86_64-unknown-linux):
        ASSERT failed!
  CallStack (from ImplicitParams):
  assertPprPanic, called at compiler/types/TyCoRep.hs:1800:95 in
ghc:TyCoRep
  InScope []
  [Xuv :-> n_av5[sk]]
  []
```

Test Plan:
harbormaster
manual testing

Reviewers: austin, gridaphobe, bgamari

Reviewed By: gridaphobe, bgamari

Subscribers: thomie

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

3 years agoA little closer to supporting breakpoints with -fexternal-interpreter
Simon Marlow [Wed, 13 Jan 2016 09:13:14 +0000 (09:13 +0000)] 
A little closer to supporting breakpoints with -fexternal-interpreter

Summary: Moves getIdValFromApStack to the server, and removes one use of wormhole.

Test Plan: validate

Reviewers: bgamari, niteria, austin, hvr, erikd

Subscribers: thomie

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

GHC Trac Issues: #11100

3 years agoAdd -prof stack trace to assert
Simon Marlow [Mon, 11 Jan 2016 18:30:29 +0000 (18:30 +0000)] 
Add -prof stack trace to assert

Summary:
So that assertion failures have full call stack information attached
when using `ghc -fexternal-interpreter -prof`.  Here's one I just
collected by inserting a dummy assert in Happy:

```
*** Exception: Assertion failed
CallStack (from ImplicitParams):
  assert, called at ./First.lhs:37:11 in main:First
CallStack (from -prof):
  First.mkFirst (First.lhs:37:11-27)
  First.mkFirst (First.lhs:37:11-93)
  Main.main2.runParserGen.first (Main.lhs:107:48-56)
  Main.main2.runParserGen.first (Main.lhs:107:27-57)
  Main.main2.runParserGen (Main.lhs:(96,9)-(276,9))
  Main.main2.runParserGen (Main.lhs:(90,9)-(276,10))
  Main.main2.runParserGen (Main.lhs:(86,9)-(276,10))
  Main.main2.runParserGen (Main.lhs:(85,9)-(276,10))
  Main.main2 (Main.lhs:74:20-43)
  Main.main2 (Main.lhs:(64,9)-(78,61))
  Main.main (Main.lhs:57:9-18)
```

Test Plan: validate

Reviewers: erikd, hvr, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #11047

3 years agofix typo causing compilation failure on SPARC (ArchSparc -> ArchSPARC)
Karel Gardas [Tue, 12 Jan 2016 20:58:50 +0000 (21:58 +0100)] 
fix typo causing compilation failure on SPARC (ArchSparc -> ArchSPARC)

3 years agoLinker: Define ELF_64BIT for aarch64_HOST_ARCH
Erik de Castro Lopo [Sun, 10 Jan 2016 21:55:56 +0000 (08:55 +1100)] 
Linker: Define ELF_64BIT for aarch64_HOST_ARCH

Test Plan: Build on x86_64 and AArch64

Reviewers: hvr, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoghc.mk: Use Windows_Target instead of Windows_Host
Erik de Castro Lopo [Sat, 9 Jan 2016 23:28:47 +0000 (09:28 +1000)] 
ghc.mk: Use Windows_Target instead of Windows_Host

This is a step towards building a Linux to Windows cross-compiler.

Test Plan: Build on Linux and Windows

Reviewers: bgamari, hvr, austin, Phyx

Subscribers: thomie

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

GHC Trac Issues: #10070

3 years agoTrieMap: Minor documentation fix
Ömer Sinan Ağacan [Sat, 9 Jan 2016 21:12:42 +0000 (16:12 -0500)] 
TrieMap: Minor documentation fix

3 years agoAdd InjectiveTypeFamilies language extension
Jan Stolarek [Sat, 9 Jan 2016 19:58:52 +0000 (20:58 +0100)] 
Add InjectiveTypeFamilies language extension

Previously injective type families were part of TypeFamilies.
Now they are in a separate language extension.

Test Plan: ./validate

Reviewers: austin, bgamari, goldfire

Reviewed By: bgamari

Subscribers: goldfire, thomie

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

GHC Trac Issues: #11381

3 years agofix -ddump-splices to parenthesize ((\x -> x) a) correctly
Yuri de Wit [Sat, 9 Jan 2016 17:58:30 +0000 (18:58 +0100)] 
fix -ddump-splices to parenthesize ((\x -> x) a) correctly

Test Plan: ./validate

Reviewers: goldfire, austin, bgamari

Subscribers: goldfire, osa1, thomie

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

GHC Trac Issues: #10603

3 years agoAdd failing testcase for #10603
Ben Gamari [Sat, 9 Jan 2016 17:57:40 +0000 (18:57 +0100)] 
Add failing testcase for #10603

3 years agoParser: delete rule numbers + validate shift/reduce conlicts
Thomas Miedema [Mon, 4 Jan 2016 14:48:54 +0000 (15:48 +0100)] 
Parser: delete rule numbers + validate shift/reduce conlicts

Rule numbers tend to go out-of-date, and aren't useful.

And during validate, the actual number of shift/reduce
conflicts is now checked against the number stated in Parser.y.

Reviewed by: bgamari

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

3 years agoReject import declaration with semicolon in GHCi
Rik Steenkamp [Sat, 9 Jan 2016 17:15:45 +0000 (18:15 +0100)] 
Reject import declaration with semicolon in GHCi

Now GHCi rejects input containing an import declaration and semicolon,
and prints an appropriate error message. Before, the stuff after an
import declaration and semicolon got ignored (most of the time), without
telling the user about it. As the default behaviour of GHCi is to reject
multiple commands in a single input, we extend this behaviour to import
commands.

This patch fixes #10663.

(See https://phabricator.haskell.org/D1518 for the introduction of
`is_import` and `is_decl`.)

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #10663

3 years agouser-guide/safe_haskell: Fix typos
Ben Gamari [Sat, 9 Jan 2016 13:35:00 +0000 (14:35 +0100)] 
user-guide/safe_haskell: Fix typos

3 years agouser-guide: More semantic markup
Ben Gamari [Sat, 9 Jan 2016 12:58:27 +0000 (13:58 +0100)] 
user-guide: More semantic markup

3 years agodocs: Fix DeriveAnyClass reference in release notes and ANNOUNCE
Ben Gamari [Sat, 9 Jan 2016 12:48:23 +0000 (13:48 +0100)] 
docs: Fix DeriveAnyClass reference in release notes and ANNOUNCE

3 years agousers-guide: A few fixes
Ben Gamari [Sat, 9 Jan 2016 11:36:07 +0000 (12:36 +0100)] 
users-guide: A few fixes

3 years agousers_guide: Use semantic directive/role for command line options
Ben Gamari [Sat, 9 Jan 2016 03:38:16 +0000 (04:38 +0100)] 
users_guide: Use semantic directive/role for command line options

And GHCi commands. This makes cross-referencing much easier.

Also normalize markup a bit and add some missing flags.

3 years agoFix test for T9367 (Windows)
Rik Steenkamp [Fri, 8 Jan 2016 22:50:24 +0000 (23:50 +0100)] 
Fix test for T9367 (Windows)

See c8c44fd91b509b9eb644c826497ed5268e89363a.

Reviewed By: thomie, bgamari

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

3 years agoBuild system: fix `pwd` issues on Windows
Thomas Miedema [Fri, 8 Jan 2016 19:59:28 +0000 (20:59 +0100)] 
Build system: fix `pwd` issues on Windows

Some parts of the build system require that paths are what msys2 calls
"mixed style":
  * forwards slashes
  * absolute paths starting with a drive letter followed by a colon
    (e.g. "C:")

The removal of ghc-pwd in 4c56ad3 changed $(TOP) from mixed style to
unix style, resulting in a broken Windows build for some.

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

3 years agoDocs for stack traces in GHCi
Simon Marlow [Fri, 8 Jan 2016 16:15:46 +0000 (16:15 +0000)] 
Docs for stack traces in GHCi

3 years agoAdd a pointer to the relevant paper for InScopeSet
Bartosz Nitka [Fri, 8 Jan 2016 14:26:49 +0000 (15:26 +0100)] 
Add a pointer to the relevant paper for InScopeSet

This was non-obvious to me when reading the sources and the
paper provides the motivation and explores the design space.

Test Plan: just a comment

Reviewers: simonpj, austin, ezyang, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

3 years agoRename the test-way prof_h to normal_h
Simon Marlow [Fri, 8 Jan 2016 14:11:03 +0000 (14:11 +0000)] 
Rename the test-way prof_h to normal_h

3 years agoFix +RTS -h when compiling without -prof
Simon Marlow [Thu, 7 Jan 2016 14:23:14 +0000 (06:23 -0800)] 
Fix +RTS -h when compiling without -prof

Summary:
Was broken by ce1f1607ed7f8fedd2f63c8610cafefd59baaf32.  I've added a
test so that hopefully it won't break again.

Test Plan: validate & new test case

Reviewers: bgamari, austin, erikd

Subscribers: thomie

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

GHC Trac Issues: #11304

3 years agoImprove GHC.Event.IntTable performance
Jonas Scholl [Fri, 8 Jan 2016 10:46:42 +0000 (11:46 +0100)] 
Improve GHC.Event.IntTable performance

Speed up GHC.Event.IntTable.lookup by removing the IO context from the
go helper function. This generates a little bit better code as we can
avoid repeating the stack check.

Remove unused parameter from GHC.Event.IntTable.updateWith.go and
directly return a bool instead of a maybe and then checking that whether
it is a Nothing.

Test Plan: validate

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #8793

3 years agoFix Template Haskell's handling of infix GADT constructors
RyanGlScott [Fri, 8 Jan 2016 10:46:10 +0000 (11:46 +0100)] 
Fix Template Haskell's handling of infix GADT constructors

This is the second (and hopefully last) fix needed to make TH handle
GADTs properly (after D1465). This Diff addresses some issues with infix
GADT constructors, specifically:

* Before, you could not determine if a GADT constructor was declared
  infix because TH did not give you the ability to determine if there is
  a //user-specified// fixity declaration for that constructor. The
  return type of `reifyFixity` was changed to `Maybe Fixity` so that it
  yields `Just` the fixity is there is a fixity declaration, and
  `Nothing` otherwise (indicating it has `defaultFixity`).
* `DsMeta`/`Convert` were changed so that infix GADT constructors are
  turned into `GadtC`, not `InfixC` (which should be reserved for
  Haskell98 datatype declarations).
* Some minor fixes to the TH pretty-printer so that infix GADT
  constructors will be parenthesized in GADT signatures.

Fixes #11345.

Test Plan: ./validate

Reviewers: goldfire, austin, bgamari, jstolarek

Reviewed By: jstolarek

Subscribers: thomie

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

GHC Trac Issues: #11345

3 years agoUser's Guide: injective type families section
Jan Stolarek [Fri, 8 Jan 2016 10:44:18 +0000 (11:44 +0100)] 
User's Guide: injective type families section

3 years agoSupport for qRecover in TH with -fexternal-interpreter
Simon Marlow [Thu, 7 Jan 2016 14:53:43 +0000 (14:53 +0000)] 
Support for qRecover in TH with -fexternal-interpreter

Summary: This completes the support for TH with -fexternal-interpreter.

Test Plan: validate

Reviewers: bgamari, ezyang, austin, niteria, goldfire, erikd

Subscribers: thomie

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

GHC Trac Issues: #11100

3 years agoEnable stack traces with ghci -fexternal-interpreter -prof
Simon Marlow [Thu, 7 Jan 2016 11:36:41 +0000 (11:36 +0000)] 
Enable stack traces with ghci -fexternal-interpreter -prof

Summary:
The main goal here is enable stack traces in GHCi.  After this change,
if you start GHCi like this:

  ghci -fexternal-interpreter -prof

(which requires packages to be built for profiling, but not GHC
itself) then the interpreter manages cost-centre stacks during
execution and can produce a stack trace on request.  Call locations
are available for all interpreted code, and any compiled code that was
built with the `-fprof-auto` familiy of flags.

There are a couple of ways to get a stack trace:

* `error`/`undefined` automatically get one attached
* `Debug.Trace.traceStack` can be used anywhere, and prints the current
  stack

Because the interpreter is running in a separate process, only the
interpreted code is running in profiled mode and the compiler itself
isn't slowed down by profiling.

The GHCi debugger still doesn't work with -fexternal-interpreter,
although this patch gets it a step closer.  Most of the functionality
of breakpoints is implemented, but the runtime value introspection is
still not supported.

Along the way I also did some refactoring and added type arguments to
the various remote pointer types in `GHCi.RemotePtr`, so there's
better type safety and documentation in the bridge code between GHC
and ghc-iserv.

Test Plan: validate

Reviewers: bgamari, ezyang, austin, hvr, goldfire, erikd

Subscribers: thomie

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

GHC Trac Issues: #11047, #11100

3 years agoTypos in docs and comments
Gabor Greif [Thu, 7 Jan 2016 10:48:16 +0000 (11:48 +0100)] 
Typos in docs and comments

3 years agoTest Trac #10625
Simon Peyton Jones [Thu, 7 Jan 2016 09:03:29 +0000 (09:03 +0000)] 
Test Trac #10625

3 years agoMake demand analysis understand catch
Simon Peyton Jones [Wed, 6 Jan 2016 17:40:09 +0000 (17:40 +0000)] 
Make demand analysis understand catch

As Trac #11222, and #10712 note, the strictness analyser
needs to be rather careful about exceptions.  Previously
it treated them as identical to divergence, but that
won't quite do.

See Note [Exceptions and strictness] in Demand, which
explains the deal.

Getting more strictness in 'catch' and friends is a
very good thing.  Here is the nofib summary, keeping
only the big ones.

--------------------------------------------------------------------------------
        Program           Size    Allocs   Runtime   Elapsed  TotalMem
--------------------------------------------------------------------------------
          fasta          -0.1%     -6.9%     -3.0%     -3.0%     +0.0%
            hpg          -0.1%     -2.0%     -6.2%     -6.2%     +0.0%
       maillist          -0.1%     -0.3%      0.08      0.09     +1.2%
reverse-complem          -0.1%    -10.9%     -6.0%     -5.9%     +0.0%
         sphere          -0.1%     -4.3%      0.08      0.08     +0.0%
           x2n1          -0.1%     -0.0%      0.00      0.00     +0.0%
--------------------------------------------------------------------------------
            Min          -0.2%    -10.9%    -17.4%    -17.3%     +0.0%
            Max          -0.0%     +0.0%     +4.3%     +4.4%     +1.2%
 Geometric Mean          -0.1%     -0.3%     -2.9%     -3.0%     +0.0%

On the way I did quite a bit of refactoring in Demand.hs

3 years agoTurn AThing into ATcTyCon, in TcTyThing
Simon Peyton Jones [Wed, 6 Jan 2016 17:33:42 +0000 (17:33 +0000)] 
Turn AThing into ATcTyCon, in TcTyThing

This change tidies up and simplifies (a bit) the knot-tying
when kind-checking groups of type and class declarations.

The trouble (shown by Trac #11356) was that we wanted an error message
(a kind-mismatch) that involved a type mentioned a (AThing k), which
blew up.

Since we now seem to have TcTyCons, I decided to use them here.
It's still not great, but it's easier to understand and more robust.

3 years agoUse an Implication in 'deriving' error
Simon Peyton Jones [Wed, 6 Jan 2016 17:22:02 +0000 (17:22 +0000)] 
Use an Implication in 'deriving' error

Trac #11437 showed that erroneous constraints from a 'deriving'
clause need to be wrapped in an Implication to properly scope
their skolems.

The main change is in TcDeriv.simplifyDeriv; the call to
buildImplicationFor is new.

3 years agoRefactor simpl_top
Simon Peyton Jones [Wed, 6 Jan 2016 17:17:11 +0000 (17:17 +0000)] 
Refactor simpl_top

simpl_top was being polluted with Safe Haskell stuff which was only
used in one of its four calls.  This moves the Safe Haskell stuff
to the place it is actually used

3 years agoInline solveTopConstraints
Simon Peyton Jones [Wed, 6 Jan 2016 17:15:47 +0000 (17:15 +0000)] 
Inline solveTopConstraints

It was only called in one place; easier to inline it

3 years agoComment wibble
Simon Peyton Jones [Wed, 6 Jan 2016 17:14:41 +0000 (17:14 +0000)] 
Comment wibble

3 years agoTidy up tidySkolemInfo
Simon Peyton Jones [Wed, 6 Jan 2016 17:11:34 +0000 (17:11 +0000)] 
Tidy up tidySkolemInfo

Previously tidySkolemInfo used tidyOpenType, and returned a new
TidyEnv.  But that's not needed any more, because all the skolems
should be in scope in the constraint tree.

I also removed a (now-unnecessary) field of UnifyForAllSkol

3 years agoSpelling in a comment
Simon Peyton Jones [Wed, 6 Jan 2016 17:04:47 +0000 (17:04 +0000)] 
Spelling in a comment

3 years agoTiny refactor
Simon Peyton Jones [Wed, 6 Jan 2016 08:17:01 +0000 (08:17 +0000)] 
Tiny refactor

3 years agoRemove unused export
Simon Peyton Jones [Wed, 6 Jan 2016 08:16:34 +0000 (08:16 +0000)] 
Remove unused export

3 years agousers guide: Tweak wording of RTS -Nmax description
Ben Gamari [Wed, 6 Jan 2016 23:08:52 +0000 (00:08 +0100)] 
users guide: Tweak wording of RTS -Nmax description

3 years agoRewrite announce file
Ben Gamari [Fri, 17 Jul 2015 17:47:56 +0000 (19:47 +0200)] 
Rewrite announce file

Incredibly enough this hasn't been touched since 6.10.1

3 years agousers guide: Add links to release notes
Ben Gamari [Wed, 6 Jan 2016 22:59:30 +0000 (23:59 +0100)] 
users guide: Add links to release notes

3 years agousers guide: Add documentation for custom compile-time errors
Ben Gamari [Wed, 6 Jan 2016 22:56:44 +0000 (23:56 +0100)] 
users guide: Add documentation for custom compile-time errors

3 years agoFall back on ghc-stage2 when using Windows' GHCi driver
RyanGlScott [Wed, 6 Jan 2016 22:10:54 +0000 (23:10 +0100)] 
Fall back on ghc-stage2 when using Windows' GHCi driver

Reviewers: austin, hvr, bgamari, thomie

Reviewed By: thomie

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

3 years agoAdd a note describing the protocol for adding a language extension
Ben Gamari [Wed, 6 Jan 2016 19:00:16 +0000 (20:00 +0100)] 
Add a note describing the protocol for adding a language extension

Reviewers: hvr, thomie, austin

Reviewed By: austin

Subscribers: duncan

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

GHC Trac Issues: #8176, #4437

3 years agoBump Cabal and Haddock to fix #11308
Ben Gamari [Wed, 6 Jan 2016 13:42:22 +0000 (14:42 +0100)] 
Bump Cabal and Haddock to fix #11308

Bump Cabal and Haddock submodules such that they both support GCC-style
response files on Windows.

3 years agoChange Template Haskell representation of GADTs.
Jan Stolarek [Tue, 5 Jan 2016 18:18:44 +0000 (19:18 +0100)] 
Change Template Haskell representation of GADTs.

Previous representation of GADTs in TH was not expressive enough
to express possible GADT return types. See #11341

Test Plan: ./validate

Reviewers: goldfire, austin, bgamari

Subscribers: thomie, RyanGlScott

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

GHC Trac Issues: #11341

3 years agoRestore old GHC generics behavior vis-à-vis Fixity
RyanGlScott [Wed, 6 Jan 2016 11:05:05 +0000 (12:05 +0100)] 
Restore old GHC generics behavior vis-à-vis Fixity

Phab:D493 accidentally changed the way GHC generics looks up `Fixity`
information when deriving `Generic` or `Generic1`. Before, a `Fixity` of
`Infix` would be given only if a data constructor was declared infix,
but now, `Infix` is given to any data constructor that has a fixity
declaration (not to be confused with being declared infix!). This commit
reverts back to the original behavior for consistency's sake.

Fixes #11358.

Test Plan: ./validate

Reviewers: kosmikus, dreixel, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

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

GHC Trac Issues: #11358

3 years agorelnotes: Note dropped support for Windows XP and earlier
Ben Gamari [Wed, 6 Jan 2016 11:02:32 +0000 (12:02 +0100)] 
relnotes: Note dropped support for Windows XP and earlier

3 years agoExtend ghc environment file features
Duncan Coutts [Tue, 5 Jan 2016 21:13:26 +0000 (22:13 +0100)] 
Extend ghc environment file features

A set of changes to enable local ghc env files to be useful for tools
like cabal. Ultimately it will allow cabal to maintain a ghc env file so
that users can simple run ghc or ghci in a project directory and get the
expected environment of the project.

Change the name of .ghc.environment files to include the platform and
ghc version, e.g. .ghc.environment.x86_64-linux-7.6.3, since their
content is version specific. Strictly speaking this is not backwards
compatible, but we think this feature is not widely used yet.

"Look up" for a local env file, like the behaviour of git/darcs etc. So
you can be anywhere within a project and get the expected environment.

Don't look for local env files when -hide-all-packages is given.

Extend the syntax of env files to allow specifying package dbs too.

Test Plan:
Currently completely untested. Compiles, that is all.
Sorry, have to disappear for the hols.

Reviewers: hvr, ezyang, austin, bgamari

Reviewed By: ezyang, bgamari

Subscribers: thomie

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

GHC Trac Issues: #11268

3 years agoStgCmmForeign: Break up long line
Ben Gamari [Sat, 2 Jan 2016 16:22:11 +0000 (17:22 +0100)] 
StgCmmForeign: Break up long line

3 years agoStgCmmForeign: Push local register creation into code generation
Ben Gamari [Tue, 5 Jan 2016 21:10:28 +0000 (22:10 +0100)] 
StgCmmForeign: Push local register creation into code generation

The interfaces to {save,load}ThreadState were quite messy due to the
need to pass in local registers (produced with draws from a unique
supply) since they were used from both FCode and UniqSM.

This, however, is entirely unnecessary as we already have an
abstraction to capture this effect: MonadUnique. Use it.

This is part of an effort to properly represent stack unwinding
information
for foreign calls.

Test Plan: validate

Reviewers: austin, simonmar

Reviewed By: simonmar

Subscribers: thomie

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

3 years agoAdd Cabal synopses and descriptions
Ben Gamari [Tue, 5 Jan 2016 21:10:01 +0000 (22:10 +0100)] 
Add Cabal synopses and descriptions

Various people (myself included) have complained about the lack of
useful descriptions for the various packages included in GHC's source
tree. Fix this.

Test Plan: Validate

Reviewers: austin, thomie

Reviewed By: thomie

Subscribers: angerman, ezyang

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

3 years agoRemove -Wtoo-many-guards from default flags (fixes #11316)
George Karachalias [Tue, 5 Jan 2016 14:59:49 +0000 (15:59 +0100)] 
Remove -Wtoo-many-guards from default flags (fixes #11316)

Since #11316 indicates that having flag `-Wtoo-many-guards`
enabled by default causes issues, the simplest thing is to
remove it. This patch removes it from the default list, it
updates the docs and removes the suppression flags for
`T783` and `types/OptCoercion.hs`

Test Plan: validate

Reviewers: bgamari, austin, goldfire

Subscribers: thomie

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

GHC Trac Issues: #11316

3 years agoghc.mk: Add reference to Trac #5987
Ben Gamari [Tue, 5 Jan 2016 14:09:57 +0000 (15:09 +0100)] 
ghc.mk: Add reference to Trac #5987

3 years agoRelease notes: Mention remote GHCi
Ben Gamari [Tue, 5 Jan 2016 13:21:01 +0000 (14:21 +0100)] 
Release notes: Mention remote GHCi

3 years agoAdd (failing) test case for #11347
Joachim Breitner [Tue, 5 Jan 2016 09:56:47 +0000 (10:56 +0100)] 
Add (failing) test case for #11347

Unfortunately, I could not add the expected error message, so if someone
accidentally fixes this bug, this test will still be failing (no harm).
But maybe someone stumbles over it then and can update the expected
output.

3 years agoAvoid generating guards for CoPats if possible (Addresses #11276)
George Karachalias [Mon, 4 Jan 2016 20:02:26 +0000 (21:02 +0100)] 
Avoid generating guards for CoPats if possible (Addresses #11276)

When translating a `CoPat` to `PmPat` check whether the wrapper
is just a hole or a cast with refl. In these cases we can safely
drop the wrapper and generate less guard patterns. Fixes T11276.

Test Plan: validate

Reviewers: bgamari, austin

Subscribers: thomie

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

GHC Trac Issues: #11276

3 years agoBuild system: delete ghc-pwd
Thomas Miedema [Mon, 4 Jan 2016 17:29:49 +0000 (18:29 +0100)] 
Build system: delete ghc-pwd

On Windows, with msys2, `pwd` works (as can be seen by the use of `pwd`
that slipped into the validate script), so there is really no need for
`ghc-pwd` anymore.

Test Plan: try it

Reviewers: austin, bgamari, Phyx

Reviewed By: Phyx

Subscribers: Phyx, erikd

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

3 years agousers_guide: Add ghci-cmd directive
Ben Gamari [Mon, 4 Jan 2016 15:43:02 +0000 (16:43 +0100)] 
users_guide: Add ghci-cmd directive

Note only does this make the markup cleaner and more semantic, but it
clears up some warnings and enables proper hyperlinks. Yay Sphinx!

While I was at it I generally cleaned up the markup

Test Plan: Read it

Reviewers: hvr, thomie, austin

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

3 years agoRewrite Haddocks for GHC.Base.const
Ben Gamari [Mon, 4 Jan 2016 15:42:08 +0000 (16:42 +0100)] 
Rewrite Haddocks for GHC.Base.const

Test Plan: Read it

Reviewers: austin, hvr, #core_libraries_committee

Subscribers: thomie

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

GHC Trac Issues: #11314

3 years agoLinker: Move helpers to #ifdef
Ben Gamari [Mon, 4 Jan 2016 15:36:33 +0000 (16:36 +0100)] 
Linker: Move helpers to #ifdef

Otherwise Clang seems to complain about unused static definitions.

3 years agoUpdate .mailmap [skip ci]
Thomas Miedema [Sat, 19 Dec 2015 10:41:44 +0000 (11:41 +0100)] 
Update .mailmap [skip ci]

3 years agoLinker: ARM: Don't change to BLX if jump needed veneer
Ben Gamari [Mon, 4 Jan 2016 00:39:39 +0000 (01:39 +0100)] 
Linker: ARM: Don't change to BLX if jump needed veneer

Since we produce ARM veneer.

3 years agoAdd test for #10379
Thomas Miedema [Sun, 3 Jan 2016 18:57:42 +0000 (19:57 +0100)] 
Add test for #10379

3 years agoOmit TEST=T10697_decided_3 WAY=ghci
Thomas Miedema [Fri, 1 Jan 2016 11:46:37 +0000 (12:46 +0100)] 
Omit TEST=T10697_decided_3 WAY=ghci

3 years agoLinker: Use contiguous mmapping on ARM
Ben Gamari [Sun, 3 Jan 2016 12:21:39 +0000 (13:21 +0100)] 
Linker: Use contiguous mmapping on ARM

ARM has a 24-bit relative jump offset just like PowerPC. Ensure that
symbols don't get too far from their symbol extras.

See #11340.

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

3 years agoLinker: Make debugging output a bit more readable
Ben Gamari [Sun, 3 Jan 2016 12:31:20 +0000 (13:31 +0100)] 
Linker: Make debugging output a bit more readable

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