3 years agouser-guide: Delete errant fragment
Ben Gamari [Mon, 18 Jan 2016 22:13:29 +0000 (23:13 +0100)] 
user-guide: Delete errant fragment

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision:

3 years agoHide derived OccNames from user
Ben Gamari [Mon, 18 Jan 2016 22:12:51 +0000 (23:12 +0100)] 
Hide derived OccNames from user

This hides derived OccNames from the Names returned from
runDeclsWithLocation and clarifies the documentation. This is done to
ensure that these names (originating from, e.g., derived Generic
instances and type representation bindings) don't show up in ghci output
when run with `:set +t`. This fixes #11051.

Test Plan: Validate with included tests

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, hvr

Differential Revision:

GHC Trac Issues: #11051

3 years agoghci: Kill global macros list
Ben Gamari [Mon, 18 Jan 2016 22:12:34 +0000 (23:12 +0100)] 
ghci: Kill global macros list

Test Plan: Validate

Reviewers: simonmar, thomie, austin

Reviewed By: austin

Subscribers: alanz

Differential Revision:

3 years agoSwitch from -this-package-key to -this-unit-id.
Edward Z. Yang [Mon, 18 Jan 2016 16:32:27 +0000 (17:32 +0100)] 
Switch from -this-package-key to -this-unit-id.

A small cosmetic change, but we have to do a bit of work to
actually support it:

    - Cabal submodule update, so that Cabal passes us
      -this-unit-id when we ask for it.  This includes
      a Cabal renaming to be consistent with Unit ID, which
      makes ghc-pkg a bit more scrutable.

    - Build system is updated to use -this-unit-id rather than
      -this-package-key, to avoid deprecation warnings.  Needs
      a version test so I resurrected the old test we had
      (sorry rwbarton!)

    - I've *undeprecated* -package-name, so that we are in the same
      state as GHC 7.10, since the "correct" flag will have only
      entered circulation in GHC 8.0.

    - I removed -package-key.  Since we didn't deprecate -package-id
      I think this should not cause any problems for users; they
      can just change their code to use -package-id.

    - The package database is indexed by UNIT IDs, not component IDs.
      I updated the naming here.

    - I dropped the signatures field from ExposedModule; nothing
      was using it, and instantiatedWith from the package database

    - ghc-pkg was updated to use unit ID nomenclature, I removed
      the -package-key flags but I decided not to add any new flags
      for now.

Signed-off-by: Edward Z. Yang <>
Test Plan: validate

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: 23Skidoo, thomie, erikd

Differential Revision:

3 years agoReplace calls to `ptext . sLit` with `text`
Jan Stolarek [Fri, 15 Jan 2016 17:24:14 +0000 (18:24 +0100)] 
Replace calls to `ptext . sLit` with `text`

In the past the canonical way for constructing an SDoc string literal was the
composition `ptext . sLit`.  But for some time now we have function `text` that
does the same.  Plus it has some rules that optimize its runtime behaviour.
This patch takes all uses of `ptext . sLit` in the compiler and replaces them
with calls to `text`.  The main benefits of this patch are clener (shorter) code
and less dependencies between module, because many modules now do not need to
import `FastString`.  I don't expect any performance benefits - we mostly use
SDocs to report errors and it seems there is little to be gained here.

Test Plan: ./validate

Reviewers: bgamari, austin, goldfire, hvr, alanz

Subscribers: goldfire, thomie, mpickering

Differential Revision:

3 years agoFixes to "make clean" for the iserv dir
Simon Marlow [Mon, 18 Jan 2016 14:41:19 +0000 (06:41 -0800)] 
Fixes to "make clean" for the iserv dir

3 years agoTypo in comment
Simon Peyton Jones [Mon, 18 Jan 2016 11:55:20 +0000 (11:55 +0000)] 
Typo in comment

3 years agoTest Trac #11379
Simon Peyton Jones [Mon, 18 Jan 2016 11:53:05 +0000 (11:53 +0000)] 
Test Trac #11379

3 years agoImplement scoped type variables in pattern synonyms
Simon Peyton Jones [Fri, 15 Jan 2016 17:45:02 +0000 (17:45 +0000)] 
Implement scoped type variables in pattern synonyms

This fixes Trac #11351.   The implementation is pretty
simple, happily.

I took the opportunity to re-order the prov/req context
in builder-ids, which was confusingly backwards.

3 years agoAdd Trac #11427 to Note [Recursive superclasses]
Simon Peyton Jones [Fri, 15 Jan 2016 17:33:35 +0000 (17:33 +0000)] 
Add Trac #11427 to Note [Recursive superclasses]

3 years agoRefactoring on IdInfo and system derived names
Simon Peyton Jones [Fri, 15 Jan 2016 17:30:30 +0000 (17:30 +0000)] 
Refactoring on IdInfo and system derived names

Some modest refactoring, triggered in part by Trac #11051

* Kill off PatSynId, ReflectionId in IdDetails
  They were barely used, and only for pretty-printing

* Add helper function Id.mkExportedVanillaId, and use it

* Polish up OccName.isDerivedOccName, as a predicate for
  definitions generated internally by GHC, which we
  might not want to show to the user.

* Kill off unused OccName.mkDerivedTyConOcc

* Shorten the derived OccNames for newtype and data
  instance axioms

* A bit of related refactoring around newFamInstAxiomName

3 years agoImprove debug printing/warnings
Simon Peyton Jones [Mon, 11 Jan 2016 09:02:25 +0000 (09:02 +0000)] 
Improve debug printing/warnings

3 years agoWhite space only
Simon Peyton Jones [Mon, 11 Jan 2016 09:02:01 +0000 (09:02 +0000)] 
White space only

3 years agoFix typecheck of default associated type decls
Simon Peyton Jones [Mon, 18 Jan 2016 10:43:47 +0000 (10:43 +0000)] 
Fix typecheck of default associated type decls

This bug was thrown up by Trac #11361, but I found that the
problem was deeper: GHC was allowing

  class C a where
    type F (a :: k) :: *
    type F (x :: *) = x    -- Not right!

(Which is now indexed-types/should_compile/T11361a.)

Anyway the fix is relatively simple; use tcMatchTys in

Merge to 8.0 branch.

3 years agoLayout only
Simon Peyton Jones [Mon, 18 Jan 2016 10:37:09 +0000 (10:37 +0000)] 
Layout only

3 years agoSimplify API to tcMatchTys
Simon Peyton Jones [Mon, 18 Jan 2016 10:34:48 +0000 (10:34 +0000)] 
Simplify API to tcMatchTys

Previously tcMatchTys took a set of "template type variables" to
bind.  But all the calls are top-level, and we always want to
bind all variables in the template.  So I simplified the API
by omitting that argument.

There should be no change in behaviour.

Feel free to merge to 8.0 if it helps in merging other patches

3 years agoun-wire-in error, undefined, CallStack, and IP
Eric Seidel [Mon, 18 Jan 2016 08:45:23 +0000 (09:45 +0100)] 
un-wire-in error, undefined, CallStack, and IP

I missed a crucial step in the wiring-in process of `CallStack` in D861,
the bit where you actually wire-in the Name... This led to a nasty bug
where GHC thought `CallStack` was not wired-in and tried to fingerprint
it, which failed because the defining module was not loaded.

But we don't need `CallStack` to be wired-in anymore since `error` and
`undefined` no longer need to be wired-in. So we just remove them all.

Updates haddock submodule.

Test Plan: `./validate` and `make slowtest TEST=tc198`

Reviewers: simonpj, goldfire, austin, hvr, bgamari

Reviewed By: simonpj, bgamari

Subscribers: goldfire, thomie

Projects: #ghc

Differential Revision:

GHC Trac Issues: #11331

3 years agovalidate: Use gz compression during bindist check
Ben Gamari [Sun, 17 Jan 2016 23:16:35 +0000 (00:16 +0100)] 
validate: Use gz compression during bindist check

Test Plan: validate, check that gz is used

Reviewers: hvr, austin, thomie

Reviewed By: thomie

Differential Revision:

GHC Trac Issues: #11434

3 years agoAdd testcase for #11414
Ben Gamari [Sun, 17 Jan 2016 22:26:43 +0000 (23:26 +0100)] 
Add testcase for #11414

Reviewers: austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11414

3 years agoShow TYPE 'Lifted/TYPE 'Unlifted as */# in Show TypeRep instance
RyanGlScott [Sun, 17 Jan 2016 18:28:10 +0000 (19:28 +0100)] 
Show TYPE 'Lifted/TYPE 'Unlifted as */# in Show TypeRep instance

Kind equalities changed how `*`/`#` are represented internally, which
means that showing a `TypeRep` that contains either of those kinds
produces a rather gross-looking result, e.g.,

> typeOf (Proxy :: Proxy 'Just)
Proxy (TYPE 'Lifted -> Maybe (TYPE 'Lifted)) 'Just

We can at least special-case the `Show` instance for `TypeRep` so that
it prints `*` to represent `TYPE 'Lifted` and `#` to represent `TYPE

Addresses one of the issues uncovered in #11334.

Test Plan: ./validate

Reviewers: simonpj, hvr, austin, goldfire, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11334

3 years agoComplete operators properly
Arthur Fayzrakhmanov (Артур Файзрахманов) [Sun, 17 Jan 2016 18:27:12 +0000 (19:27 +0100)] 
Complete operators properly

Fix operator completions: list of suitable completions only rather than
everything from imported modules.

Signed-off-by: Arthur Fayzrakhmanov (Артур Файзрахманов) <>
ghc: fix operator completions

Reviewers: austin, hvr, thomie, bgamari

Reviewed By: thomie, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10576

3 years agousers-guide: Clean manpage build artifacts and fix usage of clean-target
Ben Gamari [Sun, 17 Jan 2016 18:26:03 +0000 (19:26 +0100)] 
users-guide: Clean manpage build artifacts and fix usage of clean-target

Test Plan: Build then clean

Reviewers: austin, thomie

Reviewed By: thomie

Differential Revision:

GHC Trac Issues: #11433

3 years agorts/posix: Fail with HEAPOVERFLOW when out of memory during mmap
Ben Gamari [Sun, 17 Jan 2016 18:24:50 +0000 (19:24 +0100)] 
rts/posix: Fail with HEAPOVERFLOW when out of memory during mmap

Test Plan: Validate

Reviewers: simonmar, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11300

3 years agoAdd missing T11408.hs
Simon Peyton Jones [Sat, 16 Jan 2016 23:51:42 +0000 (23:51 +0000)] 
Add missing T11408.hs

3 years agoFix a number of subtle solver bugs
Simon Peyton Jones [Sat, 16 Jan 2016 00:37:15 +0000 (00:37 +0000)] 
Fix a number of subtle solver bugs

As a result of some other unrelated changes I found that
IndTypesPerf was failing, and opened Trac #11408.  There's
a test in indexed-types/should-compile/T11408.

The bug was that a type like
 forall t. (MT (UL t) (UR t) ~ t) => UL t -> UR t -> Int
is in fact unambiguous, but it's a bit subtle to prove
that it is unambiguous.

In investigating, Dimitrios and I found several subtle
bugs in the constraint solver, fixed by this patch

* canRewrite was missing a Derived/Derived case.  This was
  lost by accident in Richard's big kind-equality patch.

* Interact.interactTyVarEq would discard [D] a ~ ty if there
  was a [W] a ~ ty in the inert set.  But that is wrong because
  the former can rewrite things that the latter cannot.
  Fix: a new function eqCanDischarge

* In TcSMonad.addInertEq, the process was outright wrong for
  a Given/Wanted in the (GWModel) case.  We were adding a new
  Derived without kicking out things that it could rewrite.
  Now the code is simpler (no special GWModel case), and works

* The special case in kickOutRewritable for [W] fsk ~ ty,
  turns out not to be needed.  (We emit a [D] fsk ~ ty which
  will do the job.

I improved comments and documentation, esp in TcSMonad.

3 years agoWork SourceText in for all integer literals
Alan Zimmerman [Thu, 14 Jan 2016 22:03:58 +0000 (00:03 +0200)] 
Work SourceText in for all integer literals

Certain syntactic elements have integers in them, such as fixity
specifications, SPECIALISE pragmas and so on.

The lexer will accept mult-radix literals, with arbitrary leading zeros
in these.

Bring in a SourceText field to each affected AST element to capture the
original literal text for use with API Annotations.

Affected hsSyn elements are

     -- See note [Pragma source text]
     data Activation = NeverActive
                     | AlwaysActive
                     | ActiveBefore SourceText PhaseNum
                          -- Active only *strictly before* this phase
                     | ActiveAfter SourceText PhaseNum
                           -- Active in this phase and later
                     deriving( Eq, Data, Typeable )
                               -- Eq used in comparing rules in HsDecls

     data Fixity = Fixity SourceText Int FixityDirection
       -- Note [Pragma source text]
       deriving (Data, Typeable)


      | HsTickPragma         -- A pragma introduced tick
         SourceText           -- Note [Pragma source text] in BasicTypes
                                          -- external span for this tick
            -- Source text for the four integers used in the span.
            -- See note [Pragma source text] in BasicTypes
         (LHsExpr id)

Updates haddock submodule

Test Plan: ./validate

Reviewers: goldfire, bgamari, austin

Reviewed By: bgamari

Subscribers: thomie, mpickering

Differential Revision:

GHC Trac Issues: #11430

3 years agoFix some typos
Rik Steenkamp [Sat, 16 Jan 2016 12:18:53 +0000 (13:18 +0100)] 
Fix some typos

Differential Revision:

3 years agoFix #11405.
Richard Eisenberg [Thu, 14 Jan 2016 22:48:42 +0000 (17:48 -0500)] 
Fix #11405.

This adds a new variant of AbsBinds that is used solely for bindings
with a type signature. This allows for a simpler desugaring that
does not produce the bogus output that tripped up Core Lint in
ticket #11405. Should make other desugarings simpler, too.

3 years agoFix typo in error message (#11409)
Richard Eisenberg [Tue, 12 Jan 2016 02:29:23 +0000 (21:29 -0500)] 
Fix typo in error message (#11409)

3 years agoTiny refactoring in TcUnify
Richard Eisenberg [Tue, 12 Jan 2016 02:28:24 +0000 (21:28 -0500)] 
Tiny refactoring in TcUnify

3 years agoFix #11404
Richard Eisenberg [Mon, 11 Jan 2016 21:47:22 +0000 (16:47 -0500)] 
Fix #11404

We now check for unused variables one at a time, instead of
all at the top.

Test: dependent/should_compile/T11405

3 years agoConstrained types have kind * in validity check.
Richard Eisenberg [Mon, 11 Jan 2016 20:28:48 +0000 (15:28 -0500)] 
Constrained types have kind * in validity check.

This addresses #11405, but a deeper problem lurks.
Try test dependent/should_compile/T11405 and see comment:3
on the ticket.

3 years agoFix #11254.
Richard Eisenberg [Mon, 11 Jan 2016 19:47:49 +0000 (14:47 -0500)] 
Fix #11254.

This moves the call to tcSubType into the context of the
checkInstConstraints call, allowing the deferred type error
somewhere to hang its hat.

3 years agoClarify topological sorting of spec vars in manual
Richard Eisenberg [Mon, 11 Jan 2016 00:10:03 +0000 (19:10 -0500)] 
Clarify topological sorting of spec vars in manual

This is mentioned in #11376.

3 years agoFix #11311
Richard Eisenberg [Mon, 11 Jan 2016 22:03:47 +0000 (17:03 -0500)] 
Fix #11311

All things of kind *, including * itself, need to have a PtrRep.

Test: dependent/should_compile/T11311

3 years agoFix #10872.
Richard Eisenberg [Sat, 9 Jan 2016 21:59:05 +0000 (16:59 -0500)] 
Fix #10872.

This moves the duplicate-unique check from knownKeyNames (which omits
TH) to allKnownKeyNames (which includes TH).

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:

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:

GHC Trac Issues: #11367

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

Reviewers: austin, bgamari, thomie

Reviewed By: thomie

Subscribers: angerman, thomie, erikd

Differential Revision:

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:

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:

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:

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 <>
Test Plan: doc only

Reviewers: bgamari, austin

Subscribers: thomie

Differential Revision:

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

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:

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:

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

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 Mention -j and other wibbles
Ben Gamari [Thu, 14 Jan 2016 10:33:09 +0000 (11:33 +0100)] 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:

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.


    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:

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:

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:

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:

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
  InScope []
  [Xuv :-> n_av5[sk]]

Test Plan:
manual testing

Reviewers: austin, gridaphobe, bgamari

Reviewed By: gridaphobe, bgamari

Subscribers: thomie

Differential Revision:

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:

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

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:

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:

3 years Use Windows_Target instead of Windows_Host
Erik de Castro Lopo [Sat, 9 Jan 2016 23:28:47 +0000 (09:28 +1000)] 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:

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:

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:

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:

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

This patch fixes #10663.

(See for the introduction of
`is_import` and `is_decl`.)

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

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:

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:

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:

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

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:

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:

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:

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:

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

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

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:

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.