3 years agoRevert "Cleanup PosixSource.h"
Ben Gamari [Fri, 22 Jul 2016 07:45:36 +0000 (09:45 +0200)] 
Revert "Cleanup PosixSource.h"

This reverts commit cac3fb06f4b282eee21159c364c4d08e8fdedce9.

This breaks OS X and Windows.

3 years agoMore typos in comments
Gabor Greif [Thu, 21 Jul 2016 22:32:28 +0000 (00:32 +0200)] 
More typos in comments

3 years agoCorrect a few mistyped words in prose/comments
Gabor Greif [Thu, 21 Jul 2016 22:10:32 +0000 (00:10 +0200)] 
Correct a few mistyped words in prose/comments

3 years agoFix and document Unique generation for sum TyCon and DataCons
Ömer Sinan Ağacan [Thu, 21 Jul 2016 19:59:05 +0000 (19:59 +0000)] 
Fix and document Unique generation for sum TyCon and DataCons

Test Plan: validate

Reviewers: bgamari, austin

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

3 years agoBump Haddock submodule
Ömer Sinan Ağacan [Thu, 21 Jul 2016 12:26:44 +0000 (12:26 +0000)] 
Bump Haddock submodule

3 years agoComments re ApThunks + small refactor in mkRhsClosure
Simon Peyton Jones [Wed, 20 Jul 2016 14:29:44 +0000 (15:29 +0100)] 
Comments re ApThunks + small refactor in mkRhsClosure

3 years agoComments + tiny refactor of isNullarySrcDataCon
Simon Peyton Jones [Wed, 20 Jul 2016 14:28:37 +0000 (15:28 +0100)] 
Comments + tiny refactor of isNullarySrcDataCon

3 years agoComments only
Simon Peyton Jones [Wed, 20 Jul 2016 14:28:10 +0000 (15:28 +0100)] 
Comments only

3 years agoImplement unboxed sum primitive type
Ömer Sinan Ağacan [Thu, 21 Jul 2016 08:07:41 +0000 (08:07 +0000)] 
Implement unboxed sum primitive type

This patch implements primitive unboxed sum types, as described in

Main changes are:

- Add new syntax for unboxed sums types, terms and patterns. Hidden
  behind `-XUnboxedSums`.

- Add unlifted unboxed sum type constructors and data constructors,
  extend type and pattern checkers and desugarer.

- Add new RuntimeRep for unboxed sums.

- Extend unarise pass to translate unboxed sums to unboxed tuples right
  before code generation.

- Add `StgRubbishArg` to `StgArg`, and a new type `CmmArg` for better
  code generation when sum values are involved.

- Add user manual section for unboxed sums.

Some other changes:

- Generalize `UbxTupleRep` to `MultiRep` and `UbxTupAlt` to
  `MultiValAlt` to be able to use those with both sums and tuples.

- Don't use `tyConPrimRep` in `isVoidTy`: `tyConPrimRep` is really
  wrong, given an `Any` `TyCon`, there's no way to tell what its kind
  is, but `kindPrimRep` and in turn `tyConPrimRep` returns `PtrRep`.

- Fix some bugs on the way: #12375.

Not included in this patch:

- Update Haddock for new the new unboxed sum syntax.

- `TemplateHaskell` support is left as future work.

For reviewers:

- Front-end code is mostly trivial and adapted from unboxed tuple code
  for type checking, pattern checking, renaming, desugaring etc.

- Main translation routines are in `RepType` and `UnariseStg`.
  Documentation in `UnariseStg` should be enough for understanding
  what's going on.


- Johan Tibell wrote the initial front-end and interface file

- Simon Peyton Jones reviewed this patch many times, wrote some code,
  and helped with debugging.

Reviewers: bgamari, alanz, goldfire, RyanGlScott, simonpj, austin,
           simonmar, hvr, erikd

Reviewed By: simonpj

Subscribers: Iceland_jack, ggreif, ezyang, RyanGlScott, goldfire,
             thomie, mpickering

Differential Revision:

3 years agoRevert "Clean up interaction between name cache and built-in syntax"
Ben Gamari [Wed, 20 Jul 2016 17:04:10 +0000 (19:04 +0200)] 
Revert "Clean up interaction between name cache and built-in syntax"

This reverts commit 9513fe6bdeafd35ca1a04e17b5f94732516766aa.

Sadly this broke with -DDEBUG.

3 years agoCompact Regions
Giovanni Campagna [Fri, 15 Jul 2016 18:47:26 +0000 (19:47 +0100)] 
Compact Regions

This brings in initial support for compact regions, as described in the
ICFP 2015 paper "Efficient Communication and Collection with Compact
Normal Forms" (Edward Z. Yang and implemented by Giovanni

Some things may change before the 8.2 release, but I (Simon M.) wanted
to get the main patch committed so that we can iterate.

What documentation there is is in the Data.Compact module in the new
compact package.  We'll need to extend and polish the documentation
before the release.

Test Plan:
(new test cases included)

Reviewers: ezyang, simonmar, hvr, bgamari, austin

Subscribers: vikraman, Yuras, RyanGlScott, qnikst, mboes, facundominguez, rrnewton, thomie, erikd

Differential Revision:

GHC Trac Issues: #11493

3 years agoAdd another testcase for #12082
Ben Gamari [Wed, 20 Jul 2016 15:25:37 +0000 (17:25 +0200)] 
Add another testcase for #12082

Test Plan: Validate, should pass.

Reviewers: austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12082

3 years agotestsuite: Add regression test for #12381
Ben Gamari [Wed, 20 Jul 2016 15:21:35 +0000 (17:21 +0200)] 
testsuite: Add regression test for #12381

Test Plan: Validate

Reviewers: austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12381, #11348

3 years agoClean up interaction between name cache and built-in syntax
Ben Gamari [Wed, 20 Jul 2016 10:34:54 +0000 (12:34 +0200)] 
Clean up interaction between name cache and built-in syntax

This cleans up various aspects of the handling of built-in syntax in the
original name cache (hopefully resulting in a nice reduction in compiler

  * Remove tuple types from original name cache: There is really no
    reason for these to be in the name cache since we already handle
    them specially in interface files to ensure that we can resolve them
    directly to Names, avoiding extraneous name cache lookups.

  * Sadly it's not possible to remove all traces of tuples from the
    name cache, however. Namely we need to keep the tuple type
    representations in since otherwise they would need to be wired-in

  * Remove the special cases for (:), [], and (##) in isBuiltInOcc_maybe
    and rename it to isTupleOcc_maybe

  * Split lookupOrigNameCache into two variants,

     * lookupOrigNameCache': Merely looks up an OccName in the original
       name cache, making no attempt to resolve tuples

     * lookupOrigNameCache: Like the above but handles tuples as well.
       This is given the un-primed name since it does the "obvious"
       thing from the perspective of an API user, who knows nothing of
       our special treatment of tuples.

Arriving at this design took a significant amount of iteration. The
trail of debris leading here can be found in #11357.

Thanks to ezyang and Simon for all of their help in coming to this

Test Plan: Validate

Reviewers: goldfire, simonpj, austin

Reviewed By: simonpj

Subscribers: thomie, ezyang

Differential Revision:

GHC Trac Issues: #11357

3 years agoInstEnv: Ensure that instance visibility check is lazy
Ben Gamari [Wed, 20 Jul 2016 07:56:03 +0000 (09:56 +0200)] 
InstEnv: Ensure that instance visibility check is lazy

Previously instIsVisible had completely broken the laziness of
lookupInstEnv' since it would examine is_dfun_name to check the name of
the defining module (to know whether it is an interactive module). This
resulted in the visibility check drawing in an interface file
unnecessarily. This contributed to the unnecessary regression in
compiler allocations reported in #12367.

Test Plan: Validate, check nofib changes

Reviewers: simonpj, ezyang, austin

Reviewed By: ezyang

Subscribers: thomie, ezyang

Differential Revision:

GHC Trac Issues: #12367

3 years agoUpdate docs for partial type signatures (#12365)
Thomas Winant [Wed, 20 Jul 2016 07:57:04 +0000 (09:57 +0200)] 
Update docs for partial type signatures (#12365)

* Update the sample error messages. The messages have been reworded and
  reformatted since GHC 7.10.

* Mention `TypeApplications` in "Where can they occur?"

* The name of a named wild card is no longer used in the name of a
  resulting type variable. Before: `_foo` => `w_foo`, now: `_foo` => `t`
  or `a`.

Test Plan: generate the users guide

Reviewers: goldfire, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12365

3 years agoData.Either: Add fromLeft and fromRight (#12402)
Dylan Meysmans [Wed, 20 Jul 2016 07:54:55 +0000 (09:54 +0200)] 
Data.Either: Add fromLeft and fromRight (#12402)

Reviewers: austin, hvr, RyanGlScott, bgamari

Reviewed By: RyanGlScott, bgamari

Subscribers: RyanGlScott, thomie

Differential Revision:

GHC Trac Issues: #12402

3 years agoCleanup PosixSource.h
Moritz Angermann [Wed, 20 Jul 2016 07:53:45 +0000 (09:53 +0200)] 
Cleanup PosixSource.h

When trying to build arm64-apple-iso, the build fell over
`strdup`, as the arm64-apple-ios build did not fall into `darwin_HOST_OS`,
and would need `ios_HOST_OS`.

This diff tries to clean up PosixSource.h, instead of layering another
define on top.

As we use `strnlen` in sources that include PosixSource.h, and `strnlen`
is defined in POSIX.1-2008, the `_POSIX_C_SOURCE` and `_XOPEN_SOURCE`
are increased accordingly.

Furthermore the `_DARWIN_C_SOURCE` (required for `u_char`, etc. used in
sysctl.h) define is moved into `OSThreads.h` alongside a similar ifdef
for freebsd.

Test Plan: Build on all supported platforms.

Reviewers: rwbarton, erikd, austin, hvr, simonmar, bgamari

Reviewed By: simonmar, bgamari

Subscribers: thomie

Differential Revision:

3 years agoFix bytecode generator panic
Seraphime Kirkovski [Wed, 20 Jul 2016 07:47:23 +0000 (09:47 +0200)] 
Fix bytecode generator panic

This fixes #12128.

The bug was introduced in 1c9fd3f1c5522372fcaf250c805b959e8090a62c.

Test Plan: ./validate

Reviewers: simonmar, austin, hvr, simonpj, bgamari

Reviewed By: bgamari

Subscribers: simonpj, thomie

Differential Revision:

GHC Trac Issues: #12128

3 years agoTcInteract: Add braces to matchClassInst trace output
Ben Gamari [Mon, 18 Jul 2016 18:17:24 +0000 (20:17 +0200)] 
TcInteract: Add braces to matchClassInst trace output

This allows you to easily move to the result in a well-equipped editor.

3 years agoMake Data.{Bifoldable,Bitraversable} -XSafe
Ryan Scott [Wed, 20 Jul 2016 13:15:56 +0000 (09:15 -0400)] 
Make Data.{Bifoldable,Bitraversable} -XSafe

Test Plan:
Previously, `Data.{Bifoldable,Bitraversable}` were being inferred as
`Unsafe` due to a transitive `Data.Coerce` import from `Data.Functor.Utils`.
This rectifies this unfortunate mistake.

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie, phadej

Differential Revision:

3 years agoSupport SCC pragmas in declaration context
Ömer Sinan Ağacan [Wed, 20 Jul 2016 09:33:43 +0000 (09:33 +0000)] 
Support SCC pragmas in declaration context

Not having SCCs at the top level is becoming annoying real quick. For
simplest cases, it's possible to do this transformation:

    f x y = ...
    f = {-# SCC f #-} \x y -> ...

However, it doesn't work when there's a `where` clause:

    f x y = <t is in scope>
      where t = ...
    f = {-# SCC f #-} \x y -> <t is out of scope>
      where t = ...

Or when we have a "equation style" definition:

    f (C1 ...) = ...
    f (C2 ...) = ...
    f (C3 ...) = ...

(usual solution is to rename `f` to `f'` and define a new `f` with a

This patch implements support for SCC annotations in declaration
contexts. This is now a valid program:

    f x y = ...
        g z = ...
        {-# SCC g #-}
    {-# SCC f #-}

Test Plan: This passes slow validate (no new failures added).

Reviewers: goldfire, mpickering, austin, bgamari, simonmar

Reviewed By: bgamari, simonmar

Subscribers: simonmar, thomie, mpickering

Differential Revision:

3 years agoFix PDF build for the User's Guide.
Gabor Pali [Tue, 19 Jul 2016 16:05:53 +0000 (18:05 +0200)] 
Fix PDF build for the User's Guide.

3 years agoMake okConIdOcc recognize unboxed tuples
Ryan Scott [Mon, 18 Jul 2016 17:51:53 +0000 (13:51 -0400)] 
Make okConIdOcc recognize unboxed tuples

`okConIdOcc`, which validates that a type or constructor name is valid
for splicing using Template Haskell, has a special case for tuples, but
neglects to look for unboxed tuples, causing some sensible Template Haskell
code involving unboxed tuples to be rejected.

Fixes #12407.

Test Plan: make test TEST=T12407

Reviewers: austin, bgamari, hvr, goldfire

Reviewed By: goldfire

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12407

3 years agoFix Template Haskell reification of unboxed tuple types
Ryan Scott [Mon, 18 Jul 2016 13:29:05 +0000 (09:29 -0400)] 
Fix Template Haskell reification of unboxed tuple types

Previously, Template Haskell reified unboxed tuple types as boxed
tuples with twice the appropriate arity.

Fixes #12403.

Test Plan: make test TEST=T12403

Reviewers: hvr, goldfire, austin, bgamari

Reviewed By: goldfire

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12403

3 years agoMake DeriveFunctor work with unboxed tuples
Ryan Scott [Mon, 18 Jul 2016 13:28:42 +0000 (09:28 -0400)] 
Make DeriveFunctor work with unboxed tuples

Unboxed tuples have `RuntimeRep` arguments which `-XDeriveFunctor` was
mistaking for actual data constructor arguments. As a result, a derived
`Functor` instance for a datatype that contained an unboxed tuple would
generate twice as many arguments as it needed for an unboxed tuple pattern
match or expression. The solution is to simply put `dropRuntimeRepArgs` in the
right place.

Fixes #12399.

Test Plan: ./validate

Reviewers: austin, hvr, bgamari

Reviewed By: bgamari

Subscribers: thomie, osa1

Differential Revision:

GHC Trac Issues: #12399

3 years agoFix misspellings of the word "instance" in comments
Ryan Scott [Mon, 18 Jul 2016 13:14:36 +0000 (09:14 -0400)] 
Fix misspellings of the word "instance" in comments

[ci skip]

3 years agohp2ps: fix invalid PostScript for names with parentheses
Ben Gamari [Sat, 16 Jul 2016 22:14:04 +0000 (00:14 +0200)] 
hp2ps: fix invalid PostScript for names with parentheses

The names in the .hp files may contain un-matched opening parentheses,
so escape them.

GHC Trac: #9517

Reviewers: bgamari, austin

Reviewed By: bgamari, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #9517

3 years agoPretty: remove a harmful $! (#12227)
Thomas Miedema [Sat, 16 Jul 2016 22:13:45 +0000 (00:13 +0200)] 
Pretty: remove a harmful $! (#12227)

This is backport of [1] for GHC's copy of Pretty. See Note [Differences
between libraries/pretty and compiler/utils/Pretty.hs].


Reviewers: bgamari, austin

Reviewed By: austin

Differential Revision:

GHC Trac Issues: #12227

3 years agoCodeGen: Way to dump cmm only once (#11717)
Vladimir Trubilov [Sat, 16 Jul 2016 22:13:22 +0000 (00:13 +0200)] 
CodeGen: Way to dump cmm only once (#11717)

The `-ddump-cmm` put all stages of Cmm processing into one output.
This patch changes its behavior and adds two more options to make
Cmm dumping flexible.

- `-ddump-cmm-from-stg` dumps only initial version of  Cmm right after
   STG->Cmm codegen
- `-ddump-cmm` dumps the final result of the Cmm pipeline processing
- `-ddump-cmm-verbose` dumps intermediate output of each Cmm pipeline
- `-ddump-cmm-proc` and `-ddump-cmm-caf` seems were lost. Now enabled

Test Plan: ./validate

Reviewers: thomie, simonmar, austin, bgamari

Reviewed By: thomie, simonmar

Subscribers: simonpj, thomie

Differential Revision:

GHC Trac Issues: #11717

3 years agoBugfix for bug 11632: `readLitChar` should consume null characters
Ben Gamari [Sat, 16 Jul 2016 22:12:52 +0000 (00:12 +0200)] 
Bugfix for bug 11632: `readLitChar` should consume null characters

Test Plan: The tests have been included. This change deals with a
relatively minor edge case and should not break unrelated functionality.

Reviewers: thomie, #core_libraries_committee, ekmett, bgamari

Reviewed By: #core_libraries_committee, ekmett, bgamari

Subscribers: bgamari, ekmett

Differential Revision:

GHC Trac Issues: #11632

3 years agoBinary: Use ByteString's copy in getBS
Ben Gamari [Sat, 16 Jul 2016 21:41:46 +0000 (23:41 +0200)] 
Binary: Use ByteString's copy in getBS

It's unclear how much of an effect on runtime this will have, but if
nothing else the code generation may be a tad better since the system's
`memcpy` will be used.

Test Plan: Validate

Reviewers: simonmar, austin

Subscribers: thomie

Differential Revision:

3 years agoIfaceEnv: Only check for built-in OccNames if mod is GHC.Types
Ben Gamari [Sat, 16 Jul 2016 21:38:51 +0000 (23:38 +0200)] 
IfaceEnv: Only check for built-in OccNames if mod is GHC.Types

This check is not entirely cheap and will not succeed unless we are
looking for something in the module where built-in syntax lives,

Reviewers: simonpj, austin

Subscribers: simonpj, thomie, osa1

Differential Revision:

3 years agoLog heap profiler samples to event log
Ben Gamari [Thu, 16 Jun 2016 13:03:01 +0000 (15:03 +0200)] 
Log heap profiler samples to event log

Test Plan: Try it

Reviewers: hvr, simonmar, austin, erikd

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #11094

3 years agoBring comments in TcGenGenerics up to date
Ryan Scott [Fri, 15 Jul 2016 18:17:24 +0000 (14:17 -0400)] 
Bring comments in TcGenGenerics up to date

[ci skip]

3 years agoAdded type family dependency to Data.Type.Bool.Not
Baldur Blöndal [Thu, 14 Jul 2016 22:09:03 +0000 (18:09 -0400)] 
Added type family dependency to Data.Type.Bool.Not


Signed-off-by: Baldur Blöndal <>
Reviewers: goldfire, RyanGlScott, austin, bgamari, hvr

Reviewed By: RyanGlScott, austin

Subscribers: RyanGlScott, thomie

Differential Revision:

GHC Trac Issues: #12057

3 years agotidyOccNames: Rename variables fairly
Joachim Breitner [Tue, 12 Jul 2016 15:21:07 +0000 (17:21 +0200)] 
tidyOccNames: Rename variables fairly

So that
> :t (id,id,id)
(id,id,id) :: (a3 -> a3, a2 -> a2, a1 -> a1)
instead of
(id,id,id) :: (a2 -> a2, a1 -> a1, a -> a)

Differential Revision:

3 years agotidyType: Rename variables of nested forall at once
Joachim Breitner [Tue, 12 Jul 2016 14:52:42 +0000 (16:52 +0200)] 
tidyType: Rename variables of nested forall at once

this refactoring commit prepares for fixing #12382, which can now be
implemented soley in tidyTyCoVarBndrs.

3 years agoDemand analyser: Implement LetUp rule (#12370)
Joachim Breitner [Wed, 6 Jul 2016 13:44:18 +0000 (15:44 +0200)] 
Demand analyser: Implement LetUp rule (#12370)

This makes the implementation match the description in the paper more
closely: There, a let binding that is not a function has first its body
analised, and then the binding’s RHS. This way, the demand on the bound
variable by the body can be fed into the RHS, yielding more precise

Performance measurements do unfortunately not show significant
improvements or regessions.

Differential Revision:

3 years agoPretty: delete really old changelog
Thomas Miedema [Mon, 11 Jul 2016 15:59:59 +0000 (17:59 +0200)] 
Pretty: delete really old changelog

This changelog is very incomplete, and basically useless. I'm removing
it, because it made it harder to compare this copy of `Pretty.hs` with
the copy in `libraries/pretty` (from which a similar changelog was
deleted some time ago).

3 years agoAdd -package-env to the flags reference
Simon Marlow [Sun, 10 Jul 2016 10:00:06 +0000 (11:00 +0100)] 
Add -package-env to the flags reference

3 years agocheck-api-annotations utility loads by filename
Alan Zimmerman [Sun, 10 Jul 2016 19:38:01 +0000 (21:38 +0200)] 
check-api-annotations utility loads by filename

Previously it loaded by modulename, which prevented loading files with a
Main module.

3 years agoTysWiredIn: Use UniqFM lookup for built-in OccNames
Ben Gamari [Sat, 9 Jul 2016 19:03:46 +0000 (21:03 +0200)] 
TysWiredIn: Use UniqFM lookup for built-in OccNames

Previously we would unpack the OccName into a String, then pattern match
against this string. Due to the implementation of `unpackFS`, this
actually unpacks the entire contents, even though we often only need to
look at the first few characters.

Here we take another approach: build a UniqFM with the known built-in
OccNames, allowing us to use `FastString`'s hash-based comparison

Reviewers: simonpj, austin, simonmar

Reviewed By: simonmar

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12357

3 years agoTestsuite: expose TEST_CC (path to gcc)
Thomas Miedema [Sat, 9 Jul 2016 12:03:51 +0000 (14:03 +0200)] 
Testsuite: expose TEST_CC (path to gcc)

Reviewed by: Phyx

Differential Revision:

3 years agoDsExpr: Remove usage of concatFS in fingerprintName
Ben Gamari [Fri, 8 Jul 2016 20:41:55 +0000 (22:41 +0200)] 
DsExpr: Remove usage of concatFS in fingerprintName

This was the only user of concatFS and really just wants the `String`

Stumbled upon while looking at #12357.

Test Plan: Validate

Reviewers: austin

Reviewed By: austin

Subscribers: thomie

Differential Revision:

3 years agoKill eltsUFM in classifyTyCons
Bartosz Nitka [Fri, 8 Jul 2016 14:40:48 +0000 (07:40 -0700)] 
Kill eltsUFM in classifyTyCons

GHC Trac: #4012

3 years agoOccName: Avoid re-encoding derived OccNames
Ben Gamari [Fri, 8 Jul 2016 13:38:23 +0000 (15:38 +0200)] 
OccName: Avoid re-encoding derived OccNames

Previously we would form derived OccNames by first decoding the name
being derived from, manipulating it in [Char] form, and then
re-encoding. This is all very wasteful as we essentially always just
want to concatenate. Instead we now take care to form the final name
with only one concatFS.

Test Plan: Validate, examing compiler allocations

Reviewers: simonpj, austin

Reviewed By: simonpj

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12357

3 years agoOccName: Implement startsWithUnderscore in terms of headFS
Ben Gamari [Fri, 8 Jul 2016 12:09:36 +0000 (14:09 +0200)] 
OccName: Implement startsWithUnderscore in terms of headFS

This avoids decoding the entire string just to look at the first

Test Plan: Validate

Reviewers: austin

Subscribers: thomie

Differential Revision:

3 years agoFastString: Supply mconcat implementation
Ben Gamari [Fri, 8 Jul 2016 12:09:09 +0000 (14:09 +0200)] 
FastString: Supply mconcat implementation

Test Plan: Validate

Reviewers: austin

Subscribers: thomie

Differential Revision:

3 years agoFastString: Add IsString instance
Ben Gamari [Tue, 5 Jul 2016 10:06:29 +0000 (06:06 -0400)] 
FastString: Add IsString instance

3 years agoFastString: Reduce allocations of concatFS
Ben Gamari [Tue, 5 Jul 2016 00:33:57 +0000 (20:33 -0400)] 
FastString: Reduce allocations of concatFS

Instead of unpacking and then repacking we simply concatenate all of the
individual ByteStrings.

3 years agoGHC.Stack.CCS: Fix typo in Haddocks
Ben Gamari [Thu, 7 Jul 2016 17:42:46 +0000 (19:42 +0200)] 
GHC.Stack.CCS: Fix typo in Haddocks

3 years agoUse UniqDFM for InstEnv
Bartosz Nitka [Thu, 7 Jul 2016 14:56:49 +0000 (07:56 -0700)] 
Use UniqDFM for InstEnv

Rationale in the comment.
Also updates submodule array with test output changes.

GHC Trac: #4012

3 years agoUtils: Fix `lengthIs` and `lengthExceeds` for negative args
Ömer Sinan Ağacan [Thu, 7 Jul 2016 20:01:47 +0000 (20:01 +0000)] 
Utils: Fix `lengthIs` and `lengthExceeds` for negative args

Credits goes to SPJ for finding this.

3 years agoAdd Note [FamInstEnv determinism]
Bartosz Nitka [Thu, 7 Jul 2016 15:12:05 +0000 (08:12 -0700)] 
Add Note [FamInstEnv determinism]

I'm just turning previous commit message into a Note

GHC Trac: #4012

3 years agoCorrect the message displayed for syntax error (#12146)
Aditya [Sat, 25 Jun 2016 14:21:36 +0000 (19:51 +0530)] 
Correct the message displayed for syntax error (#12146)

3 years agoUse deterministic maps for FamInstEnv
Bartosz Nitka [Thu, 7 Jul 2016 11:02:20 +0000 (04:02 -0700)] 
Use deterministic maps for FamInstEnv

We turn FamInstEnvs into lists in some places which
don't directly affect the ABI. That happens in
family consistency checks and when producing output
for `:info`. Unfortunately that nondeterminism
is nonlocal and it's hard to tell locally what it
affects. Furthermore the envs should be relatively
small, so it should be free to use deterministic
maps here. Testing with nofib and ./validate detected
no difference between UniqFM and UniqDFM.

GHC Trac: #4012

3 years agoDocument some codegen nondeterminism
Bartosz Nitka [Thu, 7 Jul 2016 10:07:20 +0000 (03:07 -0700)] 
Document some codegen nondeterminism

Bit-for-bit reproducible binaries are not a goal for now,
so this is just marking places that could be a problem.
Doing this will allow eltsUFM to be removed and will
leave only nonDetEltsUFM.

GHC Trac: #4012

3 years agoStyle changes for UniqFM
Bartosz Nitka [Thu, 7 Jul 2016 09:31:51 +0000 (02:31 -0700)] 
Style changes for UniqFM

This file used the old style with type signatures
separated from the code. As far as I understand
the idea was to generate PostScript files from
the source. I think the idea was abandoned and
this more modern style is more common in the

Test Plan: it still compiles

Reviewers: austin, simonmar, bgamari

Reviewed By: simonmar, bgamari

Subscribers: thomie

Differential Revision:

3 years ago--without-libcharset disables the use of libcharset
Simon Marlow [Wed, 6 Jul 2016 12:47:22 +0000 (05:47 -0700)] 
--without-libcharset disables the use of libcharset

3 years agoShow testcase where demand analysis abortion code fails
Joachim Breitner [Thu, 7 Jul 2016 08:41:38 +0000 (10:41 +0200)] 
Show testcase where demand analysis abortion code fails

By making it believe that some deeply nested value is absent when it
really isn't. See #12368.

3 years agoSwitch to LLVM version 3.8
Erik de Castro Lopo [Wed, 6 Jul 2016 19:38:14 +0000 (05:38 +1000)] 
Switch to LLVM version 3.8

LLVM 3.8 was released a couple of months ago.

Test Plan: Build and test on x86_64/linux (perf-llvm) and armhf/linux.

Reviewers: austin, hvr, rwbarton, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

3 years agoMention addModFinalizer changes in release notes.
Facundo Domínguez [Wed, 6 Jul 2016 14:18:58 +0000 (11:18 -0300)] 
Mention addModFinalizer changes in release notes.

3 years agoHave addModFinalizer expose the local type environment.
Facundo Domínguez [Wed, 6 Jul 2016 09:48:27 +0000 (06:48 -0300)] 
Have addModFinalizer expose the local type environment.

This annotates the splice point with 'HsSpliced ref e' where 'e' is the
result of the splice. 'ref' is a reference that the typechecker will fill with
the local type environment.

The finalizer then reads the ref and uses the local type environment, which
causes 'reify' to find local variables when run in the finalizer.

Test Plan: ./validate

Reviewers: simonpj, simonmar, bgamari, austin, goldfire

Reviewed By: goldfire

Subscribers: simonmar, thomie, mboes

Differential Revision:

GHC Trac Issues: #11832

3 years agoAdds x86_64-apple-darwin14 target.
Moritz Angermann [Tue, 5 Jul 2016 18:32:22 +0000 (20:32 +0200)] 
Adds x86_64-apple-darwin14 target.

x86_64-apple-darwin14, is the target for the 64bit simulator.
Ideally, we'd have (i386|armv7|arm64|x64_86)-apple-ios, yet,
many #ifdefs depend on `darwin`, notably libffi. Hence, this only adds
x86_64-apple-darwin14 as a target. This also updates the comment to
add the `-S` flag, and dump the output to stdout; and adjusts the
`datalayout` and `triple` values, as obtained through the method
mentioned in the comment.

Reviewers: hvr, erikd, austin, bgamari, simonmar

Reviewed By: simonmar

Subscribers: thomie

Differential Revision:

3 years agoFix GetTime.c on Darwin with clock_gettime
Misty De Meo [Wed, 15 Jun 2016 22:02:13 +0000 (15:02 -0700)] 
Fix GetTime.c on Darwin with clock_gettime

On Darwin versions with clock_gettime, #ifdefs will prevent the
mach-specific time functions from being used in most places, and
the mach time headers won't be included; however, this section
was guarded incorrectly and would still try to use them.

Fixes #12195.

3 years agoRemove varEnvElts
Bartosz Nitka [Tue, 5 Jul 2016 16:50:02 +0000 (09:50 -0700)] 
Remove varEnvElts

varEnvElts can introduce unnecessary nondeterminism
and we can finally remove it, so that no one will use
it by accident. If someone wants to use varEnvElts they
should either use DVarEnv or use nonDetEltsUFM and document
why it doesn't introduce nondeterminism.

GHC Trac: #4012

3 years agoKill varEnvElts in zonkEnvIds
Bartosz Nitka [Tue, 5 Jul 2016 16:01:34 +0000 (09:01 -0700)] 
Kill varEnvElts in zonkEnvIds

This localizes the nondeterminism that varEnvElts could
have introduced, so that it's obvious that it's benign.

Test Plan: ./validate

Reviewers: simonpj, austin, bgamari

Subscribers: thomie, simonmar

Differential Revision:

GHC Trac Issues: #4012

3 years agoDocument codegen nondeterminism
Bartosz Nitka [Tue, 5 Jul 2016 16:42:44 +0000 (09:42 -0700)] 
Document codegen nondeterminism

We don't care about bit-for-bit reproducibility, so
I'm just documenting this as a possible source.

GHC Trac: #4012

3 years agoTest Trac #12133
Simon Peyton Jones [Tue, 5 Jul 2016 15:23:01 +0000 (16:23 +0100)] 
Test Trac #12133

3 years agoWhite space only
Simon Peyton Jones [Tue, 5 Jul 2016 15:22:17 +0000 (16:22 +0100)] 
White space only

3 years agoTidy up tidying
Simon Peyton Jones [Tue, 5 Jul 2016 12:49:02 +0000 (13:49 +0100)] 
Tidy up tidying

This is a tiny refactor, replacing an ad-hoc local function
(TidyPgm.loookup_aux_id) with a solid global one (tidyVarOcc).

3 years agoMake unique auxiliary function names in deriving
Simon Peyton Jones [Tue, 5 Jul 2016 12:46:29 +0000 (13:46 +0100)] 
Make unique auxiliary function names in deriving

In deriving for Data, we make some auxiliary functions, but they
didn't always get distinct names (Trac #12245).  This patch fixes
it by using the same mechanism as for dictionary functions, namely

Some assocated refactoring came along for the ride.

3 years agoDelete out-of-date comment
Simon Peyton Jones [Mon, 4 Jul 2016 14:11:21 +0000 (15:11 +0100)] 
Delete out-of-date comment

3 years agoUse DVarEnv for vectInfoVar
Bartosz Nitka [Tue, 5 Jul 2016 13:23:54 +0000 (06:23 -0700)] 
Use DVarEnv for vectInfoVar

This makes sure that we don't introduce unnecessary
nondeterminism from vectorization.

Also updates dph submodule to reflect the change in types.

GHC Trac: #4012

3 years agoExtra ASSERTs for nameModule
Simon Peyton Jones [Mon, 4 Jul 2016 17:34:12 +0000 (18:34 +0100)] 
Extra ASSERTs for nameModule

3 years agoCheck generic-default method for ambiguity
Simon Peyton Jones [Fri, 1 Jul 2016 21:33:33 +0000 (22:33 +0100)] 
Check generic-default method for ambiguity

Fixes Trac #7497 and #12151.   In some earlier upheaval I introduced
a bug in the ambiguity check for genreric-default method.

This patch fixes it.  But in fixing it I realised that the
sourc-location of any such error message was bogus, so I fixed
that too, which involved a slightly wider change; see the
comments with TcMethInfo.

3 years agoKill some varEnvElts
Bartosz Nitka [Tue, 5 Jul 2016 10:37:06 +0000 (03:37 -0700)] 
Kill some varEnvElts

I was able to hide the nondeterminism in some specialized
function, which I believe will be useful in other places.

GHC Trac: #4012

3 years agoRevert "Linker: some extra debugging / logging"
Simon Marlow [Tue, 5 Jul 2016 07:41:14 +0000 (08:41 +0100)] 
Revert "Linker: some extra debugging / logging"

This reverts commit 6377757918c1e7f63638d6f258cad8d5f02bb6a7.

3 years agoRevert "Fix 32-bit build failures"
Simon Marlow [Tue, 5 Jul 2016 07:40:52 +0000 (08:40 +0100)] 
Revert "Fix 32-bit build failures"

This reverts commit 01f449f4ffd2c4f23bfe5698b9f1b98a86276900.

3 years agoEnum: Ensure that operations on Word fuse
Ben Gamari [Mon, 4 Jul 2016 12:36:44 +0000 (14:36 +0200)] 
Enum: Ensure that operations on Word fuse

Test Plan: Validate, verify fusion

Reviewers: austin, hvr

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12354

3 years agoCallArity: Use not . null instead of length > 0
Ben Gamari [Mon, 4 Jul 2016 12:36:24 +0000 (14:36 +0200)] 
CallArity: Use not . null instead of length > 0

Test Plan: Validate

Reviewers: austin

Subscribers: thomie

Differential Revision:

3 years agousers-guide: Remove static field type from rts-flag
Ben Gamari [Fri, 1 Jul 2016 12:56:01 +0000 (14:56 +0200)] 
users-guide: Remove static field type from rts-flag

This was introduced by a cut-and-paste error.

3 years agoTreat duplicate pattern synonym signatures as an error
Seraphime Kirkovski [Fri, 1 Jul 2016 12:30:10 +0000 (14:30 +0200)] 
Treat duplicate pattern synonym signatures as an error

Fixes issue T12165 by banning duplicate pattern synonyms
signatures. This seems to me the best solution because:

   1) it is coherent with the way we treat other duplicate signatures

   2) the typechecker currently doesn't try to apply a second
       signature to a pattern to see if it matches, probably because
       it assumes there is no more than one signature per object.

Test Plan: ./validate

Reviewers: goldfire, austin, mpickering, bgamari

Reviewed By: mpickering, bgamari

Subscribers: mpickering, thomie

Differential Revision:

GHC Trac Issues: #12165

3 years agotestsuite: Add testcase for #12355
Ben Gamari [Fri, 1 Jul 2016 12:29:54 +0000 (14:29 +0200)] 
testsuite: Add testcase for #12355

Test Plan: Validate

Reviewers: austin, osa1

Reviewed By: osa1

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12355

3 years agousers-guide: Note multiple pattern signature change in relnotes
Ben Gamari [Fri, 1 Jul 2016 12:27:00 +0000 (14:27 +0200)] 
users-guide: Note multiple pattern signature change in relnotes

3 years agobase: Add release date to changelog
Ben Gamari [Sat, 7 May 2016 07:30:20 +0000 (09:30 +0200)] 
base: Add release date to changelog

3 years agoMkCore: Fix some note names
Ömer Sinan Ağacan [Mon, 4 Jul 2016 13:51:27 +0000 (13:51 +0000)] 
MkCore: Fix some note names

3 years agoFix 32-bit build failures
Simon Marlow [Mon, 4 Jul 2016 09:56:04 +0000 (10:56 +0100)] 
Fix 32-bit build failures

3 years agoKill varEnvElts in seqDmdEnv
Bartosz Nitka [Fri, 1 Jul 2016 13:50:55 +0000 (06:50 -0700)] 
Kill varEnvElts in seqDmdEnv

GHC Trac: #4012

3 years agoDocument some benign nondeterminism
Bartosz Nitka [Fri, 1 Jul 2016 14:29:08 +0000 (07:29 -0700)] 
Document some benign nondeterminism

3 years agoRemove uniqSetToList
Bartosz Nitka [Fri, 1 Jul 2016 11:58:39 +0000 (04:58 -0700)] 
Remove uniqSetToList

This documents nondeterminism in code generation and removes
the nondeterministic ufmToList function. In the future someone
will have to use nonDetEltsUFM (with proper explanation)
or pprUFM.

3 years agoLinker: some extra debugging / logging
Simon Marlow [Wed, 29 Jun 2016 20:50:18 +0000 (21:50 +0100)] 
Linker: some extra debugging / logging

3 years agoRemove unused oc->isImportLib (#12230)
Simon Marlow [Wed, 29 Jun 2016 20:48:43 +0000 (21:48 +0100)] 
Remove unused oc->isImportLib (#12230)

This field is never set, but it was being tested and used to decide
whether to resolve an object or not.  This caused non-deterministic
crashes when using the RTS linker (see #12230).

I suspect this is not the correct fix, but putting it up so that Phyx
can tell us what the right fix should be.

Test Plan: validate

Reviewers: austin, Phyx, bgamari, erikd

Subscribers: erikd, thomie, ezyang

Differential Revision:

GHC Trac Issues: #12230

3 years agorules/ stop xelatex on error
Markus Rothe [Sun, 26 Jun 2016 09:28:36 +0000 (11:28 +0200)] 
rules/ stop xelatex on error

This avoids the interactive prompt of xelatex on error.

3 years agoAllow one type signature for multiple pattern synonyms
Matthew Pickering [Thu, 30 Jun 2016 23:15:01 +0000 (01:15 +0200)] 
Allow one type signature for multiple pattern synonyms

This makes pattern synonym signatures more consistent with normal
type signatures.

Updates haddock submodule.

Differential Revision:

3 years agoAdd NamedThing (GenLocated l e) instance
Ben Gamari [Fri, 1 Jul 2016 10:23:27 +0000 (12:23 +0200)] 
Add NamedThing (GenLocated l e) instance

3 years agousers-guide: Fix markup in release notes
Ben Gamari [Thu, 30 Jun 2016 18:07:41 +0000 (20:07 +0200)] 
users-guide: Fix markup in release notes

3 years agoTestsuite: be less strict about topHandler03's stderr
Thomas Miedema [Fri, 1 Jul 2016 09:16:08 +0000 (11:16 +0200)] 
Testsuite: be less strict about topHandler03's stderr

Fixes #12343.

3 years agoFix check_uniques in non-unicode locale
Thomas Miedema [Thu, 30 Jun 2016 08:32:00 +0000 (10:32 +0200)] 
Fix check_uniques in non-unicode locale

Testcase: `LC_ALL=C make -C utils/checkUniques`. Works with python2 and

Reviewed by: bgamari

Differential Revision: