3 years agoTestsuite: delete T5054 and T5054_2 (#5054)
Thomas Miedema [Mon, 25 Apr 2016 15:22:55 +0000 (17:22 +0200)] 
Testsuite: delete T5054 and T5054_2 (#5054)

These tests no longer compile, because the hmatrix api has completely
changed. Even if we managed to fix the tests, I don't think they would
provided much value, since the ghc/llvm bug from #5054 was not
reproducible in the first place.

Reviewed by: bgamari

Differential Revision:

3 years agoTestsuite: delete -fesc tests
Thomas Miedema [Mon, 25 Apr 2016 18:28:23 +0000 (20:28 +0200)] 
Testsuite: delete -fesc tests

The -fesc flag does not exist, and has never existed.

Also delete now unused config.compiler_tags, and 'Project version' never
contains a '-'.

Reviewed by: bgamari

Differential Revision:

3 years agoKill mapUniqSet
Bartosz Nitka [Thu, 28 Apr 2016 20:35:14 +0000 (13:35 -0700)] 
Kill mapUniqSet

Note [Unsound mapUniqSet] explains why it got removed.

Test Plan: build ghc

Reviewers: simonpj, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, simonmar

Differential Revision:

3 years agoAdd uniqSetAny and uniqSetAll and use them
Bartosz Nitka [Thu, 28 Apr 2016 20:32:39 +0000 (13:32 -0700)] 
Add uniqSetAny and uniqSetAll and use them

There are couple of places where we do `foldUniqSet` just to
compute `any` or `all`. `foldUniqSet` is non-deterministic in the
general case and `any` and `all` also read nicer.

Test Plan: ./validate

Reviewers: simonmar, goldfire, simonpj, bgamari, austin

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012

3 years agoTestsuite: benign test fixes
Thomas Miedema [Thu, 28 Apr 2016 15:08:53 +0000 (17:08 +0200)] 
Testsuite: benign test fixes

3 years agoTestsuite: fix T11223_simple_(unused_)duplicate_lib
Thomas Miedema [Thu, 28 Apr 2016 09:55:40 +0000 (11:55 +0200)] 
Testsuite: fix T11223_simple_(unused_)duplicate_lib

These tests were failing on Travis when run independently from

3 years agoTestsuite: add -ignore-dot-ghci to some ghci tests [skip ci]
Thomas Miedema [Thu, 28 Apr 2016 09:49:02 +0000 (11:49 +0200)] 
Testsuite: add -ignore-dot-ghci to some ghci tests [skip ci]

3 years agoTestsuite: delete accidentally committed .stderr.normalised file
Thomas Miedema [Wed, 27 Apr 2016 15:11:31 +0000 (17:11 +0200)] 
Testsuite: delete accidentally committed .stderr.normalised file

[skip ci]

3 years agoKill unused foldOccSet
Bartosz Nitka [Thu, 28 Apr 2016 16:51:56 +0000 (09:51 -0700)] 
Kill unused foldOccSet

foldOccSet if used would be a potential source of nondeterminism.
Since it's not used we can just remove it.

3 years agoRevert "Use __builtin_clz() to implement log_2()"
Simon Peyton Jones [Thu, 28 Apr 2016 14:20:43 +0000 (15:20 +0100)] 
Revert "Use __builtin_clz() to implement log_2()"

This reverts commit 24864ba5587c1a0447beabae90529e8bb4fa117a.

3 years agoFix debug-only check in CoreLint
Simon Peyton Jones [Thu, 28 Apr 2016 16:27:02 +0000 (17:27 +0100)] 
Fix debug-only check in CoreLint

3 years agoBetter documentation of -XConstrainedClassMethods
Simon Peyton Jones [Thu, 28 Apr 2016 14:56:09 +0000 (15:56 +0100)] 
Better documentation of -XConstrainedClassMethods

3 years agoRefactor RecordPatSynField, FieldLabel
Simon Peyton Jones [Thu, 28 Apr 2016 14:52:29 +0000 (15:52 +0100)] 
Refactor RecordPatSynField, FieldLabel

This patch uses the named fields of
 * FieldLabel
 * RecordPatSynField
in construction and pattern matching. The fields
existed before, but we were often using positional notation.

Also a minor refactor of the API of mkPatSynRecSelBinds

No change in functionality

3 years agoAdd missing solveEqualities
Simon Peyton Jones [Mon, 25 Apr 2016 15:17:34 +0000 (16:17 +0100)] 
Add missing solveEqualities

I'd missed a call to solveEqualities in the partial-type-sig case
of TcBinds.tcUserTypeSig.

Also the checkValidType test done there best done after inference,
in checkInferredPolyId (and is already done there).

Fixes Trac #11976

3 years agoRemove unused unifyType_
Simon Peyton Jones [Mon, 25 Apr 2016 15:17:07 +0000 (16:17 +0100)] 
Remove unused unifyType_

3 years agoComments only
Simon Peyton Jones [Mon, 25 Apr 2016 15:16:49 +0000 (16:16 +0100)] 
Comments only

3 years agoMinor improvement to error message
Simon Peyton Jones [Mon, 25 Apr 2016 15:16:04 +0000 (16:16 +0100)] 
Minor improvement to error message

"One fewer arguments to ..." rather than
"One fewer argument to ..."

3 years agoComments only
Simon Peyton Jones [Mon, 25 Apr 2016 15:13:38 +0000 (16:13 +0100)] 
Comments only

3 years agoKill varSetElems in injImproveEqns
Bartosz Nitka [Thu, 28 Apr 2016 12:40:39 +0000 (05:40 -0700)] 
Kill varSetElems in injImproveEqns

We want to remove varSetElems at the source level because it
might be a source of nondeterminism. I don't think it introduces
nondeterminism here, but it's easy to do the same thing
deterministically for the same price.

instFlexiTcS :: [TKVar] -> TcS (TCvSubst, [TcType])
instFlexiTcS currently gives the range of the produced substitution
as the second element of the tuple, but it's not used anywhere
right now. If it started to be used in the code I'm modifying
it would cause nondeterminism problems.

Test Plan: ./validate

Reviewers: austin, goldfire, bgamari, simonmar, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012

3 years agoExpand the comment on pprVarSet
Bartosz Nitka [Thu, 28 Apr 2016 12:35:31 +0000 (05:35 -0700)] 
Expand the comment on pprVarSet

3 years agoUpdate nofib submodule to nofib master
Joachim Breitner [Thu, 28 Apr 2016 10:59:12 +0000 (12:59 +0200)] 
Update nofib submodule to nofib master

with changes to nofib-analyse:
 * up-to-date parsing of output lines with recent GHC under
 * a few reporting improvements.

3 years agoRecommend more reliable recourse for broken nm
Ben Gamari [Thu, 28 Apr 2016 08:11:13 +0000 (10:11 +0200)] 
Recommend more reliable recourse for broken nm

xcrun --find seems like the appropriate choice here. Thanks to Brandon
Allbery for suggesting this.

3 years agoDocument -fmax-pmcheck-iterations a bit better
Ben Gamari [Wed, 27 Apr 2016 07:57:41 +0000 (09:57 +0200)] 
Document -fmax-pmcheck-iterations a bit better

3 years agoImplement the state hack without modifiyng OneShotInfo
Joachim Breitner [Wed, 20 Apr 2016 08:46:41 +0000 (10:46 +0200)] 
Implement the state hack without modifiyng OneShotInfo

Previously, the state hack would be implemented in mkLocalId, by looking
at the type, and setting the OneShot flag accordingly.

This patch changes this so that the OneShot flag faithfully represents
what our various analyses found out, and the State Hack is implemented
by adjusting the accessors, in particular isOneShotBndr and
idStateHackOneShotInfo. This makes it easier to understand what's going
on in the analyses, and de-clutters core dumps and interface files.

I don’t expect any change in behaviour, at least not in non-fringe

3 years agoKill varSetElems in markNominal
Bartosz Nitka [Tue, 26 Apr 2016 20:04:08 +0000 (13:04 -0700)] 
Kill varSetElems in markNominal

varSetElems introduces unnecessary nondeterminism and it was
straighforward to just get a deterministic list.

Test Plan: ./validate

Reviewers: austin, goldfire, bgamari, simonmar, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012

3 years agoKill varSetElems try_tyvar_defaulting
Bartosz Nitka [Tue, 26 Apr 2016 16:51:26 +0000 (09:51 -0700)] 
Kill varSetElems try_tyvar_defaulting

`varSetElems` introduces unnecessary nondeterminism and we can do
the same thing deterministically for the same price.

Test Plan: ./validate

Reviewers: goldfire, austin, simonmar, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012

3 years agoKill varSetElems in TcErrors
Bartosz Nitka [Tue, 26 Apr 2016 15:47:21 +0000 (08:47 -0700)] 
Kill varSetElems in TcErrors

The uses of varSetElems in these places are unnecessary and while it
doesn't intruduce non-determinism in the ABI the plan is to get
rid of all varSetElems to get some compile time guarantees.

Test Plan: ./validate

Reviewers: austin, simonmar, bgamari, goldfire, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012

3 years agoJust comments & reformatting
Simon Marlow [Sun, 24 Apr 2016 20:14:43 +0000 (21:14 +0100)] 
Just comments & reformatting

3 years agoUse __builtin_clz() to implement log_2()
Simon Marlow [Sat, 23 Apr 2016 21:14:43 +0000 (22:14 +0100)] 
Use __builtin_clz() to implement log_2()

A microoptimisation in the block allocator.

3 years agoDoc improvement for ApplicativeDo
Simon Marlow [Fri, 15 Apr 2016 23:24:59 +0000 (16:24 -0700)] 
Doc improvement for ApplicativeDo

Make it clearer that the final statement should be exactly
"(return|pure) E".

3 years agoGHCi: use real time instead of CPU time for :set -s
Simon Marlow [Fri, 15 Apr 2016 23:21:56 +0000 (16:21 -0700)] 
GHCi: use real time instead of CPU time for :set -s

CPU time is never very accurate, and it broke completely with
-fexternal-interpreter which runs the interpreted computations in a
separate process.

3 years agoRTS: Add setInCallCapability()
Simon Marlow [Tue, 18 Nov 2014 15:44:14 +0000 (15:44 +0000)] 
RTS: Add setInCallCapability()

This allows an OS thread to specify which capability it should run on
when it makes a call into Haskell.  It is intended for a fairly
specialised use case, when the client wants to have tighter control over
the mapping between OS threads and Capabilities - perhaps 1:1
correspondence, for example.

3 years agoKill varSetElemsWellScoped in quantifyTyVars
Bartosz Nitka [Tue, 26 Apr 2016 12:58:24 +0000 (05:58 -0700)] 
Kill varSetElemsWellScoped in quantifyTyVars

varSetElemsWellScoped introduces unnecessary non-determinism in
inferred type signatures.
Removing this instance required changing the representation of
TcDepVars to use deterministic sets.
This is the last occurence of varSetElemsWellScoped, allowing me to
finally remove it.

Test Plan:
I will update the expected outputs when commiting, some reordering
of type variables in types is expected.

Reviewers: goldfire, simonpj, austin, bgamari

Reviewed By: simonpj

Subscribers: thomie, simonmar

Differential Revision:

GHC Trac Issues: #4012

3 years agoTestsuite: delete unused concurrent/prog002/FileIO.hs
Thomas Miedema [Mon, 25 Apr 2016 15:54:51 +0000 (17:54 +0200)] 
Testsuite: delete unused concurrent/prog002/FileIO.hs

3 years agoTestsuite: delete Roles9.stderr
Thomas Miedema [Mon, 25 Apr 2016 15:03:20 +0000 (17:03 +0200)] 
Testsuite: delete Roles9.stderr

In 99cd277c181dfb346d5f2d5fc9475379229037d0, goldfire deleted the Roles9
test, but not its stderr file.

3 years agoTestsuite: fixup lots of tests
Thomas Miedema [Mon, 25 Apr 2016 14:58:34 +0000 (16:58 +0200)] 
Testsuite: fixup lots of tests

These aren't run very often, because they require external libraries.

maessen-hashtab still doesn't compile, QuickCheck api changed.

Update submodule hpc.

3 years agoTestsuite: Delete test for deprecated "packedstring"
Thomas Miedema [Mon, 25 Apr 2016 12:55:38 +0000 (14:55 +0200)] 
Testsuite: Delete test for deprecated "packedstring"

3 years agoderiveConstants: Fix nm-classic error message
Ben Gamari [Sun, 24 Apr 2016 09:31:51 +0000 (11:31 +0200)] 
deriveConstants: Fix nm-classic error message

Thanks to George Colpitts for the suggestion.

3 years agoGet rid of varSetElemsWellScoped in abstractFloats
Bartosz Nitka [Fri, 22 Apr 2016 16:47:30 +0000 (09:47 -0700)] 
Get rid of varSetElemsWellScoped in abstractFloats

It's possible to get rid of this use site in a local way
and it introduces unneccessary nondeterminism.

Test Plan: ./validate

Reviewers: simonmar, goldfire, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012

3 years agoMake benign non-determinism in pretty-printing more obvious
Bartosz Nitka [Mon, 18 Apr 2016 14:32:03 +0000 (07:32 -0700)] 
Make benign non-determinism in pretty-printing more obvious

This change takes us one step closer to being able to remove
`varSetElemsWellScoped`. The end goal is to make every source
of non-determinism obvious at the source level, so that when
we achieve determinism it doesn't get broken accidentally.

Test Plan: compile GHC

Reviewers: simonmar, goldfire, simonpj, austin, bgamari

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012

3 years agoRemove unused tyCoVarsOfTelescope
Bartosz Nitka [Fri, 22 Apr 2016 12:51:36 +0000 (05:51 -0700)] 
Remove unused tyCoVarsOfTelescope

Grepping reveals that it's not used. I suspect that it isn't useful

Test Plan: grep

Reviewers: goldfire, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie, simonmar

Differential Revision:

3 years agoTypo: veraibles -> variables
Bartosz Nitka [Fri, 22 Apr 2016 12:20:54 +0000 (05:20 -0700)] 
Typo: veraibles -> variables

3 years agoFix typos: alpah -> alpha
Bartosz Nitka [Fri, 22 Apr 2016 11:02:08 +0000 (04:02 -0700)] 
Fix typos: alpah -> alpha

3 years agoRefactor free tyvars on LHS of rules
Simon Peyton Jones [Fri, 22 Apr 2016 09:47:14 +0000 (10:47 +0100)] 
Refactor free tyvars on LHS of rules

A RULE can have unbound meta-tyvars on the LHS.  Consider
  data T a = C

  foo :: T a -> Int
  foo C = 1

  {-# RULES "myrule"  foo C = 1 #-}

After type checking the LHS becomes (foo alpha (C alpah)) and we do
not want to zap the unbound meta-tyvar 'alpha' to Any, because that
limits the applicability of the rule.  Instead, we want to quantify
over it!

Previously there was a rather clunky implementation of this
quantification, buried in the zonker in TcHsSyn (zonkTvCollecting).

This patch refactors it so that the zonker just turns the meta-tyvar
into a skolem, and the desugarer adds the quantification.  See DsBinds
Note [Free tyvars on rule LHS]. As it happened, the desugarer was
already doing something similar for dictionaries. See DsBinds
Note [Free dictionaries on rule LHS]

No change in functionality, but less cruft.

3 years agoSimplify defaultKindVar and friends
Simon Peyton Jones [Thu, 21 Apr 2016 13:52:16 +0000 (14:52 +0100)] 
Simplify defaultKindVar and friends

I found zonkQuantifiedTyVar rather complicated, especially the two
places where we defaulted RuntimeRep variables. This simplifies and
modularises the story.

Refactoring only.

3 years agoAvoid double error on out-of-scope identifier
Simon Peyton Jones [Thu, 21 Apr 2016 13:34:07 +0000 (14:34 +0100)] 
Avoid double error on out-of-scope identifier

Trac #11941 demonstrated a case where an out-of-scope error also
gave rise to a (bogus and confusing) stage restriction message.

It's caused by the fact that out-of-scope errors do not stop
renaming, but rather return an "unbound name".  We need to
detect this in the stage-restriction test to avoid the double
error.  Easy fix.

3 years agoA little more debug tracing
Simon Peyton Jones [Thu, 21 Apr 2016 13:30:36 +0000 (14:30 +0100)] 
A little more debug tracing

3 years agowibble to simplifiable
Simon Peyton Jones [Thu, 21 Apr 2016 13:29:39 +0000 (14:29 +0100)] 
wibble to simplifiable

3 years agoTest Trac #3990
Simon Peyton Jones [Thu, 21 Apr 2016 12:29:37 +0000 (13:29 +0100)] 
Test Trac #3990

3 years agoWarn about simplifiable class constraints
Simon Peyton Jones [Thu, 21 Apr 2016 12:06:54 +0000 (13:06 +0100)] 
Warn about simplifiable class constraints

Provoked by Trac #11948, this patch adds a new warning to GHC


It warns if you write a class constraint in a type signature that
can be simplified by an existing instance declaration.  Almost always
this means you should simplify it right now; type inference is very
fragile without it, as #11948 shows.

I've put the warning as on-by-default, but I suppose that if there are
howls of protest we can move it out (as happened for -Wredundant-constraints.

It actually found an example of an over-complicated context in CmmNode.

Quite a few tests use these weird contexts to trigger something else,
so I had to suppress the warning in those.

The 'haskeline' library has a few occurrences of the warning (which
I think should be fixed), so I switched it off for that library in

The warning itself is done in TcValidity.check_class_pred.

HOWEVER, when type inference fails we get a type error; and the error
suppresses the (informative) warning.  So as things stand, the warning
only happens when it doesn't cause a problem.  Not sure what to do
about this, but this patch takes us forward, I think.

3 years agoDo not use defaulting in ambiguity check
Simon Peyton Jones [Thu, 21 Apr 2016 12:03:29 +0000 (13:03 +0100)] 
Do not use defaulting in ambiguity check

This fixes Trac #11947.  See TcSimplify
Note [No defaulting in the ambiguity check]

3 years agoImprove the behaviour of warnIf
Simon Peyton Jones [Thu, 21 Apr 2016 11:58:52 +0000 (12:58 +0100)] 
Improve the behaviour of warnIf

Now that warnIf takes a "reason", we can test the reason
in warnIf rather than in the caller.  Less code, and less
risk of getting the test and the reason out of sync.

3 years agotestsuite: Bump max bytes used of T4029
Ben Gamari [Thu, 21 Apr 2016 15:07:20 +0000 (17:07 +0200)] 
testsuite: Bump max bytes used of T4029

3 years agoRemove mysterious varSetElemsWellScoped in tidyFreeTyCoVars
Bartosz Nitka [Thu, 21 Apr 2016 10:49:30 +0000 (03:49 -0700)] 
Remove mysterious varSetElemsWellScoped in tidyFreeTyCoVars

Richard isn't sure why it's there and removing it didn't change

3 years agoPoint to note about FV eta-expansion performance
Bartosz Nitka [Wed, 20 Apr 2016 22:31:14 +0000 (15:31 -0700)] 
Point to note about FV eta-expansion performance

3 years agoRename FV related functions
Bartosz Nitka [Wed, 20 Apr 2016 16:51:05 +0000 (09:51 -0700)] 
Rename FV related functions

This is from Simon's suggestion:

* `tyCoVarsOfTypesAcc` is a terrible name for a function with a
  perfectly decent type `[Type] -> FV`. Maybe `tyCoFVsOfTypes`?
  Similarly others

* `runFVList` is also terrible, but also has a decent type.
  Maybe just `fvVarList` (and `fvVarSet` for `runFVSet`).

* `someVars` could be `mkFVs :: [Var] -> FV`.

3 years agoAccept tcrun045 output
Simon Peyton Jones [Wed, 20 Apr 2016 15:22:30 +0000 (16:22 +0100)] 
Accept tcrun045 output

My validate didn't catch this one; it is fallout
(actually an improvement) from
  353d8a SCC analysis for instances as well as types/classes

3 years agoBuild a correct substitution in dataConInstPat
Bartosz Nitka [Wed, 20 Apr 2016 16:35:47 +0000 (09:35 -0700)] 
Build a correct substitution in dataConInstPat

This adds the tyvars of the domain of the substitution into the in-scope
set as well.
What I'm not sure here is if the kinds can have any free vars that
should be in the in-scope set as well.

Test Plan: ./validate

Reviewers: goldfire, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie, simonmar

Differential Revision:

GHC Trac Issues: #11371

3 years agoKill unnecessary varSetElemsWellScoped in deriveTyData
Bartosz Nitka [Wed, 20 Apr 2016 15:54:10 +0000 (08:54 -0700)] 
Kill unnecessary varSetElemsWellScoped in deriveTyData

varSetElemsWellScoped introduces unnecessary non-determinism and it's possible
to do the same thing deterministically for the same price.

Test Plan: ./validate

Reviewers: austin, simonmar, bgamari, simonpj

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #4012

3 years agoTighten up imports on TcTyClsDecls
Simon Peyton Jones [Wed, 20 Apr 2016 15:02:10 +0000 (16:02 +0100)] 
Tighten up imports on TcTyClsDecls

3 years agoFix two buglets in 17eb241 noticed by Richard
Simon Peyton Jones [Wed, 20 Apr 2016 14:56:44 +0000 (15:56 +0100)] 
Fix two buglets in 17eb241 noticed by Richard

These are corner cases in
   17eb241 Refactor computing dependent type vars
and I couldn't even come up with a test case

* In TcSimplify.simplifyInfer, in the promotion step, be sure
  to promote kind variables as well as type variables.

* In TcType.spiltDepVarsOfTypes, the CoercionTy case, be sure
  to get the free coercion variables too.

3 years agoSCC analysis for instances as well as types/classes
Simon Peyton Jones [Wed, 20 Apr 2016 11:56:40 +0000 (12:56 +0100)] 
SCC analysis for instances as well as types/classes

This big patch is in pursuit of Trac #11348.

It is largely the work of Alex Veith (thank you!), with some
follow-up simplification and refactoring from Simon PJ.

The main payload is described in RnSource
  Note [Dependency analysis of type, class, and instance decls]
which is pretty detailed.

* There is a new data type HsDecls.TyClGroup, for a strongly
  connected component of type/class/instance/role decls.

  The hs_instds field of HsGroup disappears, in consequence

  This forces some knock-on changes, including a minor
  haddock submodule update

Smaller, weakly-related things

* I found that both the renamer and typechecker were building an
  identical env for RoleAnnots, so I put common code for
  RoleAnnotEnv in RnEnv.

* I found that tcInstDecls1 had very clumsy error handling, so I
  put it together into TcInstDcls.doClsInstErrorChecks

3 years agoTighten up imports, white space
Simon Peyton Jones [Wed, 20 Apr 2016 11:39:19 +0000 (12:39 +0100)] 
Tighten up imports, white space

3 years agoDefine NameSet.intersectFVs
Simon Peyton Jones [Wed, 20 Apr 2016 11:31:01 +0000 (12:31 +0100)] 
Define NameSet.intersectFVs

I want it for subsequent commits

3 years agoReduce use of instances in hs-boot files
Simon Peyton Jones [Wed, 20 Apr 2016 11:26:03 +0000 (12:26 +0100)] 
Reduce use of instances in hs-boot files

Several things here

* GHC no longer allows user-written Typeable instances,
  so remove them from hs-boot files.

* Generally, reduce the use of instances in hs-boot files. They are
  hard to track.  Mainly this involves using pprType, pprKind etc
  instead of just ppr.  There were a lot of instances in hs-boot
  files that weren't needed at all.

* Take TyThing out of Eq; it was used in exactly one place (in
  InteractiveEval), and equality is too big a hammer for that.

3 years agoBump haddock submodule
Ben Gamari [Wed, 20 Apr 2016 08:59:32 +0000 (10:59 +0200)] 
Bump haddock submodule

Install files necessary for --hyperlinked-source. Fixes #11949.

3 years agoUpdate unix submodule to v2.7.2.0 release
Herbert Valerio Riedel [Tue, 19 Apr 2016 21:40:52 +0000 (23:40 +0200)] 
Update unix submodule to v2.7.2.0 release

3 years agoUpdate `pretty` submodule to v1.1.3.3 release
Herbert Valerio Riedel [Tue, 19 Apr 2016 21:09:15 +0000 (23:09 +0200)] 
Update `pretty` submodule to v1.1.3.3 release

3 years agoUpdate binary submodule to release
Herbert Valerio Riedel [Tue, 19 Apr 2016 20:33:58 +0000 (22:33 +0200)] 
Update binary submodule to release

3 years agoUpdate deepseq submodule to latest snapshot
Herbert Valerio Riedel [Tue, 19 Apr 2016 17:16:01 +0000 (19:16 +0200)] 
Update deepseq submodule to latest snapshot

NB: this needs 91ee5090f1e3f43e9e803cf7005a7f3357e58377

3 years agoMark GHC.Stack.Types Trustworthy
Herbert Valerio Riedel [Tue, 19 Apr 2016 16:32:29 +0000 (18:32 +0200)] 
Mark GHC.Stack.Types Trustworthy

GHC can't infer this module safe due to the `GHC.Types (Char, Int)`
and the  (dummy) `GHC.Integer ()` import.

If only `GHC.Types` was marked Trustworthy or Safe...

3 years agoUpdate hsc2hs submodule
Herbert Valerio Riedel [Tue, 19 Apr 2016 11:56:54 +0000 (13:56 +0200)] 
Update hsc2hs submodule

This bumps the hsc2hs version to 0.68

3 years agoKill dead TauTvFlavour, and move code around
Simon Peyton Jones [Mon, 18 Apr 2016 14:20:00 +0000 (15:20 +0100)] 
Kill dead TauTvFlavour, and move code around

This is just tidying up.

3 years agoTighten checking for associated type instances
Simon Peyton Jones [Mon, 18 Apr 2016 14:14:40 +0000 (15:14 +0100)] 
Tighten checking for associated type instances

This patch finishes off Trac #11450.  Following debate on that ticket,
the patch tightens up the rules for what the instances of an
associated type can look like.  Now they must match the instance
header exactly. Eg

   class C a b where
    type T a x b

With this class decl, if we have an instance decl
  instance C ty1 ty2 where ...
then the type instance must look like
     type T ty1 v ty2 = ...
with exactly
  - 'ty1' for 'a'
  -  'ty2' for 'b', and
  - a variable for 'x'

For example:

  instance C [p] Int
    type T [p] y Int = (p,y,y)

Previously we allowed multiple instance equations and now, in effect,
we don't since they would all overlap.  If you want multiple cases,
use an auxiliary type family.

This is consistent with the treatment of generic-default instances,
and the user manual always said "WARNING: this facility (multiple
instance equations may be withdrawn in the future".

I also improved error messages, and did other minor refactoring.

3 years agoRefactor computing dependent type vars
Simon Peyton Jones [Mon, 18 Apr 2016 14:01:13 +0000 (15:01 +0100)] 
Refactor computing dependent type vars

There should be no change in behaviour here

* Move splitDepVarsOfType(s) from Type to TcType

* Define data type TcType.TcDepVars, document what it means,
  and use it where appropriate, notably in splitDepVarsOfType(s)

* Use it in TcMType.quantifyTyVars and friends

3 years agoDefine TyCoRep.ppSuggestExplicitKinds, and use it
Simon Peyton Jones [Mon, 18 Apr 2016 13:54:03 +0000 (14:54 +0100)] 
Define TyCoRep.ppSuggestExplicitKinds, and use it

This just defines a useful helper function that was being
duplicated in several places

3 years agoRemove unused import of emptyNameEnv
Simon Peyton Jones [Mon, 18 Apr 2016 13:51:30 +0000 (14:51 +0100)] 
Remove unused import of emptyNameEnv

3 years agoUpdate `directory` submodule to v1.2.6.2 release
Herbert Valerio Riedel [Tue, 19 Apr 2016 07:00:54 +0000 (09:00 +0200)] 
Update `directory` submodule to v1.2.6.2 release

The v1.2.6.1 release uploaded to Hackage is broken, we don't
want to bundle a release that's non-installable from Hackage

3 years agorts: Don't use strndup
Ben Gamari [Mon, 18 Apr 2016 20:32:59 +0000 (22:32 +0200)] 
rts: Don't use strndup

Reviewers: austin

Subscribers: thomie

Differential Revision:

3 years agorts: Limit maximum backtrace depth
Ben Gamari [Sun, 10 Apr 2016 22:49:06 +0000 (00:49 +0200)] 
rts: Limit maximum backtrace depth

This prevents us from entering an infinite loop in the event of a
hitting bad unwinding information.

3 years agoRemove obsolete/redundant FLEXIBLE_ARRAY macro
Herbert Valerio Riedel [Mon, 18 Apr 2016 20:26:02 +0000 (22:26 +0200)] 
Remove obsolete/redundant FLEXIBLE_ARRAY macro

This macro is doubly redundant, first off all, ancient GCCs prior to
version 3.0 are not supported anymore, but more importantly, we require
a ISO C99 compliant compiler, so we can use the proper ISO C syntax
without worrying about compatibility.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: carter, thomie

Differential Revision:

3 years agoUse stdint types to define SIZEOF and ALIGNMENT of INTx/WORDx
Tomas Carnecky [Mon, 18 Apr 2016 20:11:53 +0000 (22:11 +0200)] 
Use stdint types to define SIZEOF and ALIGNMENT of INTx/WORDx

Saves us a CPP #if in MachDeps.h since we now can always rely on a
64-bit type being available.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, erikd

Differential Revision:

3 years agorelnotes: Add note about #11744 and workaround
Ben Gamari [Mon, 18 Apr 2016 13:13:41 +0000 (15:13 +0200)] 
relnotes: Add note about #11744 and workaround

Test Plan: Read it

Reviewers: hvr, austin

Subscribers: carter, thomie

Differential Revision:

GHC Trac Issues: #11744

3 years agoMake it easy to get hyperlinked sources
Bartosz Nitka [Mon, 18 Apr 2016 13:29:37 +0000 (06:29 -0700)] 
Make it easy to get hyperlinked sources

The version of `haddock` that ghc has as a submodule has an option
for generating linkified sources. I don't think it hurts to have this
and they are great for exploring the codebase.

I'd be nice if harbormaster or travis published them somewhere, but
I don't know how to do that yet.

Test Plan:
uncomment, run `make` and look at the
nicely linkified sources in `compiler/stage2/doc/html/ghc/`

Reviewers: hvr, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie, simonmar

Differential Revision:

3 years agoUpdate haskeline submodule to release
Herbert Valerio Riedel [Sun, 17 Apr 2016 18:42:43 +0000 (20:42 +0200)] 
Update haskeline submodule to release

3 years agoSilence unused-import warning introduced by 93d85af9fec968b
Herbert Valerio Riedel [Sun, 17 Apr 2016 16:39:36 +0000 (18:39 +0200)] 
Silence unused-import warning introduced by 93d85af9fec968b

3 years agoUpdate `directory` submodule to v1.2.6.1 release
Herbert Valerio Riedel [Sun, 17 Apr 2016 15:39:13 +0000 (17:39 +0200)] 
Update `directory` submodule to v1.2.6.1 release

This fixes a build-failure on OSX

3 years agoResolve symlinks when attempting to find GHC's lib folder on Windows
Tamar Christina [Sun, 17 Apr 2016 15:11:02 +0000 (17:11 +0200)] 
Resolve symlinks when attempting to find GHC's lib folder on Windows

Systools makes some pretty hard assumptions about where GHC is on Windows.
One of these is that ghc be in a folder named `bin` and that `../lib` exists.

This pattern doesn't hold for symlinks as a link `C:\ghc-bin\`
pointing to `C:\ghc\ghc-7.10.3\bin` will break this assumption.

This patch resolves symlinks by finding where they point to and uses that location
as the base for GHC.

This uses an API that's been introduced in Vista. For older systems it falls back to
the current behavior of not resolving symlinks.

Test Plan:
1) Create symlink to GHC's bin folder.
2) Run GHC from that folder.

Reviewers: austin, bgamari

Reviewed By: austin

Subscribers: #ghc_windows_task_force, thomie

Differential Revision:

GHC Trac Issues: #11759

3 years agoLinker: Clean up #if USE_MMAP usage
Erik de Castro Lopo [Sun, 17 Apr 2016 12:44:38 +0000 (14:44 +0200)] 
Linker: Clean up #if USE_MMAP usage

Test Plan:
 - Run tests on x86_64/linux, x86_64/darwin and powerpc/linux
 - Cross compile rts/Linker.c with the i686-w64-mingw32-gcc and
   x86_64-w64-mingw32-gcc Linux to Windows cross-compilers.

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

Reviewed By: Phyx

Subscribers: thomie

Differential Revision:

3 years agoCheck CCS tree for pointers into shared object during checkUnload
Andrew Farmer [Sun, 17 Apr 2016 12:43:24 +0000 (14:43 +0200)] 
Check CCS tree for pointers into shared object during checkUnload

Prevent shared objects from being unloaded if cost centre stacks point
at the object. This will prevent segfault in #11776, but also prevents
objects from ever being unloaded when profiling. Pruning CCS tree will
enable that in another diff.

Test Plan: make TEST=linker_profiled, examine

Reviewers: austin, simonmar, bgamari

Reviewed By: simonmar, bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11776

3 years agoAdd flag to control number of missing patterns in warnings
David Luposchainsky [Sun, 17 Apr 2016 12:41:33 +0000 (14:41 +0200)] 
Add flag to control number of missing patterns in warnings

Non-exhaustive pattern warnings had their number of patterns to
show hardcoded in the past. This patch implements the TODO remark
that this should be made a command line flag.


can now be used to influence the number of patterns to be shown.

Reviewers: hvr, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

3 years agovalidate: Note existence of config_args variable
Ben Gamari [Sun, 17 Apr 2016 11:25:05 +0000 (13:25 +0200)] 
validate: Note existence of config_args variable

3 years agousers-guide: Fix typo
Ben Gamari [Sun, 17 Apr 2016 11:21:07 +0000 (13:21 +0200)] 
users-guide: Fix typo

3 years agoTH: Tweak Haddock language
Ben Gamari [Sun, 17 Apr 2016 10:58:24 +0000 (12:58 +0200)] 
TH: Tweak Haddock language

3 years agoAdd TemplateHaskell support for Overlapping pragmas
Iavor S. Diatchki [Sun, 17 Apr 2016 10:56:31 +0000 (12:56 +0200)] 
Add TemplateHaskell support for Overlapping pragmas

Reviewers: hvr, goldfire, austin, RyanGlScott, bgamari

Reviewed By: RyanGlScott, bgamari

Subscribers: RyanGlScott, thomie

Differential Revision:

3 years agoAdd Windows import library support to the Runtime Linker
Tamar Christina [Sun, 17 Apr 2016 11:03:17 +0000 (13:03 +0200)] 
Add Windows import library support to the Runtime Linker

Import libraries are files ending in `.dll.a` and `.lib` depending on which
compiler creates them (GCC, vs MSVC).

Import Libraries are standard `archive` files that contain object files.
These object files can have two different formats:

1) The normal COFF Object format for object files
    (contains all ascii data and very little program code, so do not
     try to execute.)
2) "short import" format which just contains a symbol name and
   the dll in which the symbol can be found.

Import Libraries are useful for two things:

1) Allowing applications that don't support dynamic linking to
   link against the import lib (non-short format) which then
   makes calls into the DLL by loading it at runtime.

2) Allow linking of mutually recursive dlls. if `A.DLL` requires
   `B.DLL` and vice versa, import libs can be used to break the cycle
   as they can be created from the expected exports of the DLLs.

A side effect of having these two capabilities is that Import libs are often
used to hide specific versions of DLLs behind a non-versioned import lib.

e.g. GCC_S.a (non-conventional import lib) will point to the correct
`libGCC` DLL. With this support Windows Haskell files can now just link
to `-lGCC_S` and not have to worry about what the actual name of libGCC is.

Also third party libraries such as `icuuc` use import libs to forward to
versioned DLLs. e.g. `icuuc.lib` points to `icuuc51.dll` etc.

Test Plan:

Two new tests added T11072gcc T11072msvc

Two binary files have been added to the test folder because the "short"
import library format doesn't seem to be creatable via `dlltool`
and requires Microsoft's `lib.exe`.

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

Reviewed By: RyanGlScott, erikd

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11072

3 years agoUpdate array submodule to v0.5.1.1 release tag
Herbert Valerio Riedel [Sun, 17 Apr 2016 09:10:24 +0000 (11:10 +0200)] 
Update array submodule to v0.5.1.1 release tag

3 years agoUpdate `directory` submodule to v1.2.6.0 release
Herbert Valerio Riedel [Sat, 16 Apr 2016 19:17:03 +0000 (21:17 +0200)] 
Update `directory` submodule to v1.2.6.0 release

3 years agoRework CC/CC_STAGE0 handling in ``
Herbert Valerio Riedel [Sat, 16 Apr 2016 16:12:09 +0000 (18:12 +0200)] 
Rework CC/CC_STAGE0 handling in ``

Rather than using the non-standard/idiomatic `--with-{gcc,clang}=...`
scheme use the `CC=...` style scheme.

The basic idea is to have Autoconf's CC/CFLAG/CPPFLAG apply to
stage{1,2,3}, while having a separate _STAGE0 set of env-vars
denote the bootstrap-toolchain flags/programs.

This should be simpler, less confusing, and somewhat more in line with
Autoconf's idioms (allowing us to reuse more of Autoconf rather than
(re)inventing our own confusing non-standard m4 macros to do stuff that
Autoconf could almost do already for us)

Morever, expose CC_STAGE0 as a so-called "precious" variable.

So now we can better control which bootstrapping gcc is used
(by default the one used by the stage0 ghc, unless CC_STAGE0 is

Some influential environment variables:
  CC_STAGE0   C compiler command (bootstrap)
  CC          C compiler command
  CFLAGS      C compiler flags

Use these variables to override the choices made by `configure' or to
help it to find libraries and programs with nonstandard names/locations.

Test Plan: I've tested that cross-compiling with
`--target=powerpc-linux-gnu` still works, and tried a few variants of
settting `CC=` and `CC_STAGE0=`; `./validate` passed as well

Reviewers: erikd, austin, bgamari, simonmar

Reviewed By: simonmar

Subscribers: Phyx, thomie

Differential Revision:

3 years agoBump haddock submodule
Ben Gamari [Sat, 16 Apr 2016 15:53:08 +0000 (17:53 +0200)] 
Bump haddock submodule