summaryrefslogtreecommitdiff
path: root/utils
Commit message (Collapse)AuthorAgeFilesLines
* Add kind equalities to GHC.Richard Eisenberg2015-12-112-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements the ideas originally put forward in "System FC with Explicit Kind Equality" (ICFP'13). There are several noteworthy changes with this patch: * We now have casts in types. These change the kind of a type. See new constructor `CastTy`. * All types and all constructors can be promoted. This includes GADT constructors. GADT pattern matches take place in type family equations. In Core, types can now be applied to coercions via the `CoercionTy` constructor. * Coercions can now be heterogeneous, relating types of different kinds. A coercion proving `t1 :: k1 ~ t2 :: k2` proves both that `t1` and `t2` are the same and also that `k1` and `k2` are the same. * The `Coercion` type has been significantly enhanced. The documentation in `docs/core-spec/core-spec.pdf` reflects the new reality. * The type of `*` is now `*`. No more `BOX`. * Users can write explicit kind variables in their code, anywhere they can write type variables. For backward compatibility, automatic inference of kind-variable binding is still permitted. * The new extension `TypeInType` turns on the new user-facing features. * Type families and synonyms are now promoted to kinds. This causes trouble with parsing `*`, leading to the somewhat awkward new `HsAppsTy` constructor for `HsType`. This is dispatched with in the renamer, where the kind `*` can be told apart from a type-level multiplication operator. Without `-XTypeInType` the old behavior persists. With `-XTypeInType`, you need to import `Data.Kind` to get `*`, also known as `Type`. * The kind-checking algorithms in TcHsType have been significantly rewritten to allow for enhanced kinds. * The new features are still quite experimental and may be in flux. * TODO: Several open tickets: #11195, #11196, #11197, #11198, #11203. * TODO: Update user manual. Tickets addressed: #9017, #9173, #7961, #10524, #8566, #11142. Updates Haddock submodule.
* Removed colon append operation (fixes #10785)Ben Gamari2015-12-111-3/+3
| | | | | | | | | | | | Reviewers: jgertm, austin, thomie Reviewed By: thomie Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1164 GHC Trac Issues: #10785
* Rename s/7.12.1/8.0.1/ two minor occurencesHerbert Valerio Riedel2015-12-081-1/+1
| | | | [skip ci]
* ghc-pkg: don't sort packages unnecessarilyThomas Miedema2015-12-071-7/+3
| | | | | | | | | | | | | | | | | | The packages in the package database are already sorted alphabetically by this point (see db_stack_sorted). This is a better fix for #8245, commit 021b1f8. Test Plan: look at output of './inplace/bin/ghc-pkg list [--simple-output]' Reviewers: austin, bgamari, psibi Reviewed By: psibi Differential Revision: https://phabricator.haskell.org/D1579 GHC Trac Issues: #8245
* Refactor ConDeclAlan Zimmerman2015-12-071-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ConDecl type in HsDecls is an uneasy compromise. For the most part, HsSyn directly reflects the syntax written by the programmer; and that gives just the right "pegs" on which to hang Alan's API annotations. But ConDecl doesn't properly reflect the syntax of Haskell-98 and GADT-style data type declarations. To be concrete, here's a draft new data type ```lang=hs data ConDecl name | ConDeclGADT { con_names :: [Located name] , con_type :: LHsSigType name -- The type after the ‘::’ , con_doc :: Maybe LHsDocString } | ConDeclH98 { con_name :: Located name , con_qvars :: Maybe (LHsQTyVars name) -- User-written forall (if any), and its implicit -- kind variables -- Non-Nothing needs -XExistentialQuantification , con_cxt :: Maybe (LHsContext name) -- ^ User-written context (if any) , con_details :: HsConDeclDetails name -- ^ Arguments , con_doc :: Maybe LHsDocString -- ^ A possible Haddock comment. } deriving (Typeable) ``` Note that For GADTs, just keep a type. That's what the user writes. NB:HsType can represent records on the LHS of an arrow: { x:Int,y:Bool} -> T con_qvars and con_cxt are both Maybe because they are both optional (the forall and the context of an existential data type For ConDeclGADT the type variables of the data type do not scope over the con_type; whereas for ConDeclH98 they do scope over con_cxt and con_details. Updates haddock submodule. Test Plan: ./validate Reviewers: simonpj, erikd, hvr, goldfire, austin, bgamari Subscribers: erikd, goldfire, thomie, mpickering Differential Revision: https://phabricator.haskell.org/D1558 GHC Trac Issues: #11028
* ghc-pkg: Restore old behavior in colored version; fixes 6119Sibi Prabakaran2015-12-071-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | The behavior is changed to this: ``` ghc-pkg list blahblah /home/sibi/ghc/inplace/lib/package.conf.d (no packages) ``` instead of: ``` ghc-pkg list blahblah /home/sibi/ghc/inplace/lib/package.conf.d ``` Reviewers: austin, thomie, bgamari Reviewed By: thomie, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1575 GHC Trac Issues: #6119
* Implement new `-fwarn-noncanonical-monoid-instances`Herbert Valerio Riedel2015-12-061-0/+8
| | | | | | | | | | | | | | | | This is similiar to the `-fwarn-noncanonical-monad-instances` warning implemented via #11128, but applies to `Semigroup`/`Monoid` instead and the `(<>)`/`mappend` methods (of which `mappend` is planned to move out of `Monoid` at some point in the future being redundant and thus error-prone). This warning is contained in `-Wcompat` but not in `-Wall`. This addresses #11150 Reviewed By: quchen Differential Revision: https://phabricator.haskell.org/D1553
* ghc.mk: fix docs re-rebuildingSergei Trofimovich2015-12-051-2/+1
| | | | | | | | | | | | | | | | | | | | | The problem: $ make <watch sphinx rebuilds docs> # no changes in sources $ make <watch sphinx rebuilds docs again> The problem was due to wrong assumption about what files exactly are generated by mkUserGuidePart. Build system expected the following files to be created: docs/man/all-flags.gen.rst flags-recompilating-checking.gen.rst but mkUserGuidePart generated: docs/users_guide/all-flags.gen.rst flags-recompilation-checking.gen.rst Signed-off-by: Sergei Trofimovich <siarheit@google.com>
* ghc.mk: don't run mkUserGuidePart more than onceSergei Trofimovich2015-12-051-3/+39
| | | | | | | | | | | When building 'html' and 'man' manuals build system reports mkUserGuide is ran more than once (up to 3 times in parallel). See Note [Blessed make target file] for more details. Signed-off-by: Sergei Trofimovich <siarheit@google.com>
* ghc.mk: cleanup: use tab consistentlySergei Trofimovich2015-12-051-1/+1
| | | | Signed-off-by: Sergei Trofimovich <siarheit@google.com>
* Enable non-canonical Monad instance warnings for stage1/2Herbert Valerio Riedel2015-12-051-0/+0
| | | | | | | | | | | | | | This makes use of the new facility introduced via 14d0f7f1221db758cd06a69f53803d9d0150164a which allows to have certain flags passed only to the non-bootstrapping GHC. This is needed because sometimes we can't assume the existence of a certain flag in the bootstrapping compiler which was only added recently to GHC HEAD. This also updates the haddock submodule to fix a few remaining noncanonical instance definitions. Differential Revision: https://phabricator.haskell.org/D1571
* Refactor treatment of wildcardsSimon Peyton Jones2015-12-011-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch began as a modest refactoring of HsType and friends, to clarify and tidy up exactly where quantification takes place in types. Although initially driven by making the implementation of wildcards more tidy (and fixing a number of bugs), I gradually got drawn into a pretty big process, which I've been doing on and off for quite a long time. There is one compiler performance regression as a result of all this, in perf/compiler/T3064. I still need to look into that. * The principal driving change is described in Note [HsType binders] in HsType. Well worth reading! * Those data type changes drive almost everything else. In particular we now statically know where (a) implicit quantification only (LHsSigType), e.g. in instance declaratios and SPECIALISE signatures (b) implicit quantification and wildcards (LHsSigWcType) can appear, e.g. in function type signatures * As part of this change, HsForAllTy is (a) simplified (no wildcards) and (b) split into HsForAllTy and HsQualTy. The two contructors appear when and only when the correponding user-level construct appears. Again see Note [HsType binders]. HsExplicitFlag disappears altogether. * Other simplifications - ExprWithTySig no longer needs an ExprWithTySigOut variant - TypeSig no longer needs a PostRn name [name] field for wildcards - PatSynSig records a LHsSigType rather than the decomposed pieces - The mysterious 'GenericSig' is now 'ClassOpSig' * Renamed LHsTyVarBndrs to LHsQTyVars * There are some uninteresting knock-on changes in Haddock, because of the HsSyn changes I also did a bunch of loosely-related changes: * We already had type synonyms CoercionN/CoercionR for nominal and representational coercions. I've added similar treatment for TcCoercionN/TcCoercionR mkWpCastN/mkWpCastN All just type synonyms but jolly useful. * I record-ised ForeignImport and ForeignExport * I improved the (poor) fix to Trac #10896, by making TcTyClsDecls.checkValidTyCl recover from errors, but adding a harmless, abstract TyCon to the envt if so. * I did some significant refactoring in RnEnv.lookupSubBndrOcc, for reasons that I have (embarrassingly) now totally forgotten. It had to do with something to do with import and export Updates haddock submodule.
* Fix warning about unused pattern variableGabor Greif2015-12-011-1/+1
|
* Build system: Add stage specific SRC_HC_(WARNING_)OPTSThomas Miedema2015-12-011-5/+0
| | | | | | | | | | | | | | | | | | * Add stage specific versions of SRC_HC_OPTS. These are currently only used for -Werror. The previous combination of GhcStage2HcOpts and GhcLibHcOpts didn't apply to utils/*. * Add stage specific versions of SRC_HC_WARNING_OPTS. These will later be used for new warning supression flags that should not be passed to the bootstrap compiler. * Move -Wall (and -Werror) related code back to mk/warnings.mk, where it was before 987d54274. Now all warning related code is nicely together. Include mk/warnings.mk after mk/custom-settings.mk to make this work. Reviewed By: bgamari, hvr Differential Revision: https://phabricator.haskell.org/D1536
* Implement warnings for Semigroups as parent of MonoidDavid Luposchainsky2015-11-291-2/+9
| | | | | | | | | | | | | | | | | | | | | This patch is similar to the AMP patch (#8004), which offered two functions: 1. Warn when an instance of a class has been given, but the type does not have a certain superclass instance 2. Warn when top-level definitions conflict with future Prelude names These warnings are issued as part of the new `-Wcompat` warning group. Reviewers: hvr, ekmett, austin, bgamari Reviewed By: hvr, ekmett, bgamari Subscribers: ekmett, thomie Differential Revision: https://phabricator.haskell.org/D1539 GHC Trac Issues: #11139
* ghc-pkg: print version when verboseAdam Sandberg Eriksson2015-11-291-24/+26
| | | | | | | | | | Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1534
* Implement new -XTemplateHaskellQuotes pragmaHerbert Valerio Riedel2015-11-291-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Since f16ddcee0c64a92ab911a7841a8cf64e3ac671fd / D876, `ghc-stage1` supports a subset of `-XTemplateHaskell`, but since we need Cabal to be able detect (so `.cabal` files can be specified accordingly, see also GHC #11102 which omits `TemplateHaskell` from `--supported-extensions`) whether GHC provides full or only partial `-XTemplateHaskell` support, the proper way to accomplish this is to split off the quotation/non-splicing `TemplateHaskell` feature-subset into a new language pragma `TemplateHaskellQuotes`. Moreover, `-XTemplateHaskellQuotes` is considered safe under SafeHaskell This addresses #11121 Reviewers: goldfire, ezyang, dterei, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1511 GHC Trac Issues: #11121
* Rewrite checkUniques and incorporate into validateBen Gamari2015-11-243-124/+51
| | | | | | | | | | | | | | | This should catch duplicate uniques in the future before Bad Things happen. Test Plan: Introduce a duplicate unique and validate Reviewers: austin, hvr, thomie Reviewed By: hvr, thomie Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1521
* Add -Wcompat warning flag groupDavid Luposchainsky2015-11-241-0/+7
| | | | | | | | | | | | Reviewers: hvr, austin, thomie, bgamari Reviewed By: hvr, austin, thomie, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1495 GHC Trac Issues: #11000
* Implement new `-fwarn-noncanonical-monad-instances`Herbert Valerio Riedel2015-11-241-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Warn about incoherent/non-canonical 'Applicative'/'Monad' instance declarations. Specifically the following invariants are checked: In 'Monad' instances declarations warn if the any of the following conditions does not hold: * If `return` is overridden it must be canonical (i.e. `return = pure`). * If `(>>)` is overridden it must be canonical (i.e. `(>>) = (*>)`). In 'Applicative' instance declarations: * Warn if 'pure' is defined backwards (i.e. `pure = return`). * Warn if '(*>)' is defined backwards (i.e. `(*>) = (>>)`). NB, this warning flag is not enabled via `-Wall` nor `-Wcompat`. This addresses #11128 Reviewers: quchen, austin, bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D1516
* Support multiple debug output levelsBen Gamari2015-11-231-0/+7
| | | | | | | | | We now only strip block information from DebugBlocks when compiling with `-g1`, intended to be used when only minimal debug information is desired. `-g2` is assumed when `-g` is passed without any integer argument. Differential Revision: https://phabricator.haskell.org/D1281
* ApiAnnotations: Make all RdrName occurences LocatedAlan Zimmerman2015-11-232-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment the API Annotations can only be used on the ParsedSource, as there are changes made to the RenamedSource that prevent it from being used to round trip source code. It is possible to build a map from every Located Name in the RenamedSource from its location to the Name, which can then be used when resolved names are required when changing the ParsedSource. However, there are instances where the identifier is not located, specifically (GHC.VarPat name) (GHC.HsVar name) (GHC.UserTyVar name) (GHC.HsTyVar name) Replace each of the name types above with (Located name) Updates the haddock submodule. Test Plan: ./validate Reviewers: austin, goldfire, bgamari Reviewed By: bgamari Subscribers: goldfire, thomie, mpickering Differential Revision: https://phabricator.haskell.org/D1512 GHC Trac Issues: #11019
* derivedConstants: Add support for AIXHerbert Valerio Riedel2015-11-191-2/+26
| | | | | | | | | | | | | | | On IBM AIX `nm` doesn't support reporting symbol sizes, so we need to resort to `objdump` instead, which has a peculiar output format on AIX. depends on D1499 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: kgardas, thomie Differential Revision: https://phabricator.haskell.org/D1500
* Make `derivedConstants` more crosscompile-friendlyHerbert Valerio Riedel2015-11-191-13/+27
| | | | | | | | | | | | | | | | | | `derivedConstants` currently uses `System.Info.os` for decisions (which doesn't necessarily reflect the build-target), as well as hardcoding "/usr/bin/objdump" for openbsd. This patch auto-detects `objdump` similiar to how `nm` is detected via Autoconf as well as passing the target-os into `derivedConstants` via commandline. Reviewers: austin, kgardas, erikd, bgamari Reviewed By: kgardas, erikd, bgamari Subscribers: kgardas, thomie, erikd Differential Revision: https://phabricator.haskell.org/D1499
* Add -fwarn-missing-monadfail-instance to mkUserGuidePartBen Gamari2015-11-181-0/+7
|
* Disable failed specialisation warnings by default & update documentation.Ben Gamari2015-11-181-0/+12
| | | | | | | | | | | | | | | | | | These were far too noisy to enable by default. In the future we will hopefully have a more variant of -Wall targetted at these sorts of diagnostics. In the interim I've pointed out the existence of these options in the release notes in hopes that people will discover them. Test Plan: Validate Reviewers: hvr, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1492
* Revert "Unify hsig and hs-boot; add preliminary "hs-boot" merging."Edward Z. Yang2015-11-162-4/+3
| | | | | | | | | | | | | | | Summary: This reverts commit 06d46b1e4507e09eb2a7a04998a92610c8dc6277. This also has a Haddock submodule update. Test Plan: validate Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1475
* Implement function-sections for Haskell code, #8405Simon Brenner2015-11-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a flag -split-sections that does similar things to -split-objs, but using sections in single object files instead of relying on the Satanic Splitter and other abominations. This is very similar to the GCC flags -ffunction-sections and -fdata-sections. The --gc-sections linker flag, which allows unused sections to actually be removed, is added to all link commands (if the linker supports it) so that space savings from having base compiled with sections can be realized. Supported both in LLVM and the native code-gen, in theory for all architectures, but really tested on x86 only. In the GHC build, a new SplitSections variable enables -split-sections for relevant parts of the build. Test Plan: validate with both settings of SplitSections Reviewers: dterei, Phyx, austin, simonmar, thomie, bgamari Reviewed By: simonmar, thomie, bgamari Subscribers: hsyl20, erikd, kgardas, thomie Differential Revision: https://phabricator.haskell.org/D1242 GHC Trac Issues: #8405
* Remove unused field in ConDeclJan Stolarek2015-11-111-0/+0
| | | | | | | | | | | | | | | | | We no longer parse old-style GADT syntax but there was some left-over code for emitting deprecation warnings. Updates haddock submodule. Test Plan: ./validate Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1460
* Associate pattern synonyms with types in module exportsMatthew Pickering2015-11-111-0/+0
| | | | | | | | | | | | | | | | | | | | | | This patch implements #10653. It adds the ability to bundle pattern synonyms with type constructors in export lists so that users can treat pattern synonyms more like data constructors. Updates haddock submodule. Test Plan: ./validate Reviewers: goldfire, austin, bgamari Reviewed By: bgamari Subscribers: simonpj, gridaphobe, thomie Differential Revision: https://phabricator.haskell.org/D1258 GHC Trac Issues: #10653
* Build system: use stage0 to build dll-splitThomas Miedema2015-11-081-1/+6
| | | | | | | | | | | | | | | | | When cross-compiling ghc itself, this prevents: "dll-split: cannot execute binary file: Exec format error" Test Plan: * ./configure --target=arm-linux-gnueabihf * DYNAMIC_GHC_PROGRAMS=YES * Stage1Only=NO Reviewers: rwbarton, bgamari, austin Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D1430
* Update process submodule to process-1.4 releaseHerbert Valerio Riedel2015-11-023-2/+2
| | | | | We already used a process-1.4 snapshot with non-bumped version, so this commit is mostly a `.cabal` file upper-bound relaxation change.
* ApiAnnotations: BooleanFormula is not properly LocatedAlan Zimmerman2015-11-011-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment BooleanFormula is defined as data BooleanFormula a = Var a | And [BooleanFormula a] | Or [BooleanFormula a] deriving (Eq, Data, Typeable, Functor, Foldable, Traversable) An API Annotation can only be attached to an item of the form Located a. Replace this with a properly Located version, and attach the appropriate API Annotations to it Updates haddock submodule. Test Plan: ./validate Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D1384 GHC Trac Issues: #11017
* Update process submoduleHerbert Valerio Riedel2015-11-013-2/+2
| | | | | | | | | | This is needed to prepare for #11026 as this update relaxes the upper bounds on `base` to allow for `base-4.9.0.0` This also needs to relax a few upper bounds on process in some cabal files (there will be another process submodule update soon, as a major version bump of process' version is still pending)
* Update array/stm/hpc/haddock submodulesHerbert Valerio Riedel2015-11-011-0/+0
| | | | | This is needed to prepare for #11026 as these updates relax the upper bounds on `base` to allow for `base-4.9.0.0`
* Provide a utility to check API Annotations docsAlan Zimmerman2015-11-012-16/+103
| | | | | | | | | | | | | | | | | | | | | | | A utility to check API Annotations was provided in https://git.haskell.org/ghc.git/commitdiff/43751b2436f370d956d8021b3cdd3 eb77801470b This commit had poor documentation. This patch improves the output generated by the utility as well as supplying better documentation Test Plan: ./validate Reviewers: simonpj, austin, bgamari Reviewed By: austin, bgamari Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D1397 GHC Trac Issues: #10917
* Fix documentation build on windowsTamar Christina2015-10-311-1/+6
| | | | | | | | | | | | | | | | | | | Summary: Fix building new Sphinx documenation on Windows in msys2 using Awson's patch on #11021. Install Sphinx using `pacman -S mingw-w64-$(uname -m)-python2-sphinx` Test Plan: Apply patch and ./validate Reviewers: thomie, bgamari, austin Reviewed By: thomie, bgamari Subscribers: erikd Differential Revision: https://phabricator.haskell.org/D1408 GHC Trac Issues: #11021
* Make ghc-cabal's `System.Directory` import more robustHerbert Valerio Riedel2015-10-311-1/+1
| | | | | | | | Starting with directory-1.2.5 there will be a nameclash with `withCurrentDirectory` and `MIN_VERSION_filepath()` isn't available at bootstrap-time with the current GHC build-system. By using explicit import lists we avoid CPP altogether
* Generate Typeable info at definition sitesBen Gamari2015-10-301-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the second attempt at merging D757. This patch implements the idea floated in Trac #9858, namely that we should generate type-representation information at the data type declaration site, rather than when solving a Typeable constraint. However, this turned out quite a bit harder than I expected. I still think it's the right thing to do, and it's done now, but it was quite a struggle. See particularly * Note [Grand plan for Typeable] in TcTypeable (which is a new module) * Note [The overall promotion story] in DataCon (clarifies existing stuff) The most painful bit was that to generate Typeable instances (ie TyConRepName bindings) for every TyCon is tricky for types in ghc-prim etc: * We need to have enough data types around to *define* a TyCon * Many of these types are wired-in Also, to minimise the code generated for each data type, I wanted to generate pure data, not CAFs with unpackCString# stuff floating about. Performance ~~~~~~~~~~~ Three perf/compiler tests start to allocate quite a bit more. This isn't surprising, because they all allocate zillions of data types, with practically no other code, esp. T1969 * T1969: GHC allocates 19% more * T4801: GHC allocates 13% more * T5321FD: GHC allocates 13% more * T9675: GHC allocates 11% more * T783: GHC allocates 11% more * T5642: GHC allocates 10% more I'm treating this as acceptable. The payoff comes in Typeable-heavy code. Remaining to do ~~~~~~~~~~~~~~~ * I think that "TyCon" and "Module" are over-generic names to use for the runtime type representations used in GHC.Typeable. Better might be "TrTyCon" and "TrModule". But I have not yet done this * Add more info the the "TyCon" e.g. source location where it was defined * Use the new "Module" type to help with Trac Trac #10068 * It would be possible to generate TyConRepName (ie Typeable instances) selectively rather than all the time. We'd need to persist the information in interface files. Lacking a motivating reason I have not done this, but it would not be difficult. Refactoring ~~~~~~~~~~~ As is so often the case, I ended up refactoring more than I intended. In particular * In TyCon, a type *family* (whether type or data) is repesented by a FamilyTyCon * a algebraic data type (including data/newtype instances) is represented by AlgTyCon This wasn't true before; a data family was represented as an AlgTyCon. There are some corresponding changes in IfaceSyn. * Also get rid of the (unhelpfully named) tyConParent. * In TyCon define 'Promoted', isomorphic to Maybe, used when things are optionally promoted; and use it elsewhere in GHC. * Cleanup handling of knownKeyNames * Each TyCon, including promoted TyCons, contains its TyConRepName, if it has one. This is, in effect, the name of its Typeable instance. Updates haddock submodule Test Plan: Let Harbormaster validate Reviewers: austin, hvr, goldfire Subscribers: goldfire, thomie Differential Revision: https://phabricator.haskell.org/D1404 GHC Trac Issues: #9858
* Build system: cabalise deriveConstants + genprimopcodeThomas Miedema2015-10-305-6/+50
| | | | | | | | | This is needed for #10374 (but doesn't fix it yet). Also rename DeriveConstants.hs to Main.hs, because the build system has trouble with Main modules not called Main.hs. Differential Revision: https://phabricator.haskell.org/D1380
* Build system: cleanup a few .cabal filesThomas Miedema2015-10-304-33/+13
|
* Build system: rename runghc.hs to Main.hsThomas Miedema2015-10-303-7/+1
| | | | | The build system has trouble with Main modules not called Main.hs. This change allows a hack in utils/runghc/ghc.mk to be removed.
* Revert "Generate Typeable info at definition sites"Ben Gamari2015-10-291-0/+0
| | | | | | | | This reverts commit bef2f03e4d56d88a7e9752a7afd6a0a35616da6c. This merge was botched Also reverts haddock submodule.
* Generate Typeable info at definition sitesBen Gamari2015-10-291-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements the idea floated in Trac #9858, namely that we should generate type-representation information at the data type declaration site, rather than when solving a Typeable constraint. However, this turned out quite a bit harder than I expected. I still think it's the right thing to do, and it's done now, but it was quite a struggle. See particularly * Note [Grand plan for Typeable] in TcTypeable (which is a new module) * Note [The overall promotion story] in DataCon (clarifies existing stuff) The most painful bit was that to generate Typeable instances (ie TyConRepName bindings) for every TyCon is tricky for types in ghc-prim etc: * We need to have enough data types around to *define* a TyCon * Many of these types are wired-in Also, to minimise the code generated for each data type, I wanted to generate pure data, not CAFs with unpackCString# stuff floating about. Performance ~~~~~~~~~~~ Three perf/compiler tests start to allocate quite a bit more. This isn't surprising, because they all allocate zillions of data types, with practically no other code, esp. T1969 * T3294: GHC allocates 110% more (filed #11030 to track this) * T1969: GHC allocates 30% more * T4801: GHC allocates 14% more * T5321FD: GHC allocates 13% more * T783: GHC allocates 12% more * T9675: GHC allocates 12% more * T5642: GHC allocates 10% more * T9961: GHC allocates 6% more * T9203: Program allocates 54% less I'm treating this as acceptable. The payoff comes in Typeable-heavy code. Remaining to do ~~~~~~~~~~~~~~~ * I think that "TyCon" and "Module" are over-generic names to use for the runtime type representations used in GHC.Typeable. Better might be "TrTyCon" and "TrModule". But I have not yet done this * Add more info the the "TyCon" e.g. source location where it was defined * Use the new "Module" type to help with Trac Trac #10068 * It would be possible to generate TyConRepName (ie Typeable instances) selectively rather than all the time. We'd need to persist the information in interface files. Lacking a motivating reason I have not done this, but it would not be difficult. Refactoring ~~~~~~~~~~~ As is so often the case, I ended up refactoring more than I intended. In particular * In TyCon, a type *family* (whether type or data) is repesented by a FamilyTyCon * a algebraic data type (including data/newtype instances) is represented by AlgTyCon This wasn't true before; a data family was represented as an AlgTyCon. There are some corresponding changes in IfaceSyn. * Also get rid of the (unhelpfully named) tyConParent. * In TyCon define 'Promoted', isomorphic to Maybe, used when things are optionally promoted; and use it elsewhere in GHC. * Cleanup handling of knownKeyNames * Each TyCon, including promoted TyCons, contains its TyConRepName, if it has one. This is, in effect, the name of its Typeable instance. Requires update of the haddock submodule. Differential Revision: https://phabricator.haskell.org/D757
* Pattern synonyms: swap provided/requiredSimon Peyton Jones2015-10-281-0/+0
| | | | | | | | | | | | | | This patch swaps the order of provided and required constraints in a pattern signature, so it now goes pattern P :: req => prov => t1 -> ... tn -> res_ty See the long discussion in Trac #10928. I think I have found all the places, but I could have missed something particularly in comments. There is a Haddock changes; so a submodule update.
* Make worker-wrapper optionalChristiaan Baaij2015-10-271-1/+12
| | | | | | | | | | | | | | | | | | | Add -fworker-wrapper flag which enables the worker-wrapper transformation. It is implied by -O. The expected users of this flag, which includes myself, are GHC API users. In my Haskell-to-Hardware compiler, which uses the GHC API, I have seen no benifits of the worker-wrapper transformation. It does however induce longer compilation times. Further discussion can be seen here: https://mail.haskell.org/pipermail/ghc-devs/2015-October/010096.html Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D1372 GHC Trac Issues: #11020
* Add flag to reverse errors in GHC/GHCiSiddhanathan Shanmugam2015-10-261-0/+7
| | | | | | | | | | | | Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1367 GHC Trac Issues: #10848
* Provide a utility to check API AnnotationsAlan Zimmerman2015-10-254-0/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It is difficult for GHC developers to know if they have broken the API Annotations. This patch provides a utility that can be used as a test to show up errors in the API Annotations. It is based on the current tests for ghc-api/annotations which can parse a file using the just-built GHC API, and check that no annotations are disconnected from the ParsedSource in the output. In addition, it should be able to dump the annotations to a file, so a new feature developer can check that all changes to the parser do provide annotations. Trac ticket: #10917 Test Plan: ./validate Reviewers: hvr, thomie, austin, bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D1368 GHC Trac Issues: #10917
* ghc-pkg: Express return-method in terms of pureHerbert Valerio Riedel2015-10-181-2/+2
|
* Implement DuplicateRecordFieldsAdam Gundry2015-10-162-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements DuplicateRecordFields, the first part of the OverloadedRecordFields extension, as described at https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields/DuplicateRecordFields This includes fairly wide-ranging changes in order to allow multiple records within the same module to use the same field names. Note that it does *not* allow record selector functions to be used if they are ambiguous, and it does not have any form of type-based disambiguation for selectors (but it does for updates). Subsequent parts will make overloading selectors possible using orthogonal extensions, as described on the wiki pages. This part touches quite a lot of the codebase, and requires changes to several GHC API datatypes in order to distinguish between field labels (which may be overloaded) and selector function names (which are always unique). The Haddock submodule has been adapted to compile with the GHC API changes, but it will need further work to properly support modules that use the DuplicateRecordFields extension. Test Plan: New tests added in testsuite/tests/overloadedrecflds; these will be extended once the other parts are implemented. Reviewers: goldfire, bgamari, simonpj, austin Subscribers: sjcjoosten, haggholm, mpickering, bgamari, tibbe, thomie, goldfire Differential Revision: https://phabricator.haskell.org/D761