summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Add instantiation in rule checkingwip/impredicativityAlejandro Serrano2015-08-042-5/+6
|
* Fix bugs on implementation of \upsilon typesAlejandro Serrano2015-08-045-22/+29
|
* Revamp part of the impredicativity documentAlejandro Serrano2015-08-031-75/+158
|
* Never generate a `tyvar <~ sigma` constraintAlejandro Serrano2015-08-0117-286/+284
| | | | | | | | | | | | | | | | | This patch changes the generation and canonicalization of <~ constraints, as shown in the document in docs/types. Now, `tyvar <~ sigma` or `tyfam <~ sigma` constraint are not regarded as canonical, and are converted to equalities at canonicalisation time. However, care is taken to not generate those equalities, neither in other canonicalisation steps or in the constraint generation process. This changes allows us to get rid of the `tct_flavor` flag in `TyThing`, which remembered whether certain type was coming from an un-annotated lamda or let. Now, since these constructs get a new fresh variable, the desired constraint with equality is to be generated.
* Better simplification of casts in simple_opt_exprAlejandro Serrano2015-07-301-3/+5
|
* Leave RULEs checking as before impredicativityAlejandro Serrano2015-07-302-44/+4
|
* Do not flatten type families in <~ constraintsAlejandro Serrano2015-07-291-18/+6
|
* Introduce InstanceOfRefl evidence to match descriptionAlejandro Serrano2015-07-296-26/+46
|
* Fix problem in RULES simplificationAlejandro Serrano2015-07-292-14/+22
|
* Change rule for canonicalization of <~Alejandro Serrano2015-07-291-1/+1
| | | | Now, if the LHS is not a forall, we always turn it into ~.
* Instantiation in approximation is now deepAlejandro Serrano2015-07-293-13/+38
| | | | | | | | | | | | If we have a left-over constraint `forall a. Q => (forall b. Q' => t) <~ v` previously it would be approximated to `v ~ [a -> alpha](forall b. Q' => t) /\ [a -> alpha]Q` whereas now it is approximated to `v ~ [a -> alpha, b -> beta]t /\ [a -> alpha]Q /\ [a -> alpha, b -> beta]Q'` This fixes several problems compiling the base Data.Category module.
* Fix problem with double-pass simpleOptAlejandro Serrano2015-07-291-7/+14
|
* Merge remote-tracking branch 'origin/master' into wip/impredicativityAlejandro Serrano2015-07-27337-1963/+5970
|\ | | | | | | | | | | | | | | | | Conflicts: compiler/typecheck/Inst.hs compiler/typecheck/TcBinds.hs compiler/typecheck/TcExpr.hs compiler/typecheck/TcRnTypes.hs compiler/types/Unify.hs
| * Comment tweaks onlyReid Barton2015-07-251-2/+2
| |
| * Add missing parentheses in eqBigNatWord#Reid Barton2015-07-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: I'm pretty sure that parentheses were intended here. But oddly, they make very little difference. The presumably intended expression (sizeofBigNat# bn ==# 1#) `andI#` (bigNatToWord bn `eqWord#` w#) is 1# exactly when bn consists of a single limb equal to w#, clearly. In the original expression sizeofBigNat# bn ==# 1# `andI#` (bigNatToWord bn `eqWord#` w#) the right-hand side of ==# is always 0# or 1#. So it is 1# when bn consists of a single limb equal to w#. It is also 1# when bn has zero limbs and the word past the end of bn does not happen to be equal to w#. So in practice the difference is that nullBigNat was eqBigNatWord# to almost everything, but eqBigNatWord# is never supposed to be called on nullBigNat anyways. Note that even the corrected version might perform an out-of-bounds memory access if passed nullBigNat, because `andI#` is not guaranteed to short-circuit, though in fact GHC does convert isZeroBigNat to a series of branches in my local build. Test Plan: validate Reviewers: hvr, bgamari, goldfire, austin Reviewed By: hvr, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1095
| * Use isTrue# around primitive comparisons in integer-gmpReid Barton2015-07-251-30/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The form case na# ==# nb# of 0# -> ... _ -> ... sometimes generates convoluted assembly, see #10676. timesInt2Integer was the most spectacular offender, especially as it is a rather cheap function overall (no calls to gmp). I checked a few instances and some of the old generated assembly was fine already, but I changed them all for consistency. The new form is also more consistent with use of these primops in general. Test Plan: validate Reviewers: hvr, bgamari, goldfire, austin Reviewed By: hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1094
| * -include-pkg-deps takes only one hyphen.Edward Z. Yang2015-07-251-2/+2
| | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
| * renamer: fix module-level deprecation messageSergei Trofimovich2015-07-255-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Noticed today that deprecation warnings are slightly broken in -HEAD: mtl-2.2.1/Control/Monad/Error/Class.hs:46:1: warning: Module ‘Control.Monad.Trans.Error’ is deprecated: ([", U, s, e, , C, o, n, t, r, o, l, ., M, o, n, a, d, ., T, r, a, n, s, ., E, x, c, e, p, t, , i, n, s, t, e, a, d, "], Use Control.Monad.Trans.Except instead) Commit e6191d1cc37e98785af8b309100ea840084fa3ba slightly changed WarningTxt declaration: -data WarningTxt = WarningTxt (Located SourceText) [Located FastString] - | DeprecatedTxt (Located SourceText) [Located FastString] +data WarningTxt = WarningTxt (Located SourceText) + [Located (SourceText,FastString)] + | DeprecatedTxt (Located SourceText) + [Located (SourceText,FastString)] But 'moduleWarn' function was not updated to do the stripping. Signed-off-by: Sergei Trofimovich <siarheit@google.com> Reviewers: austin, bgamari, hvr, goldfire, rwbarton, alanz Reviewed By: rwbarton, alanz Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1096 GHC Trac Issues: #10313
| * RetainerProfile: Add missing UNTAG_STATIC_LIST_PTRBen Gamari2015-07-241-0/+1
| |
| * Improve instanceCantMatchSimon Peyton Jones2015-07-241-2/+6
| | | | | | | | | | | | | | | | | | | | When staring at instanceCantMatch I realised that it was returning False (safe but inefficient) when it could validly return True, on arguments like [Nothing, Just Int] [Just Bool, Just Bool] This patch makes it a bit cleverer.
| * Refactoring around FunDepsSimon Peyton Jones2015-07-243-86/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This refactoring was triggered by Trac #10675. We were using 'improveClsFD' (previously called 'checkClsFD') for both * Improvement: improving a constraint against top-level instances * Consistency: checking when two top-level instances are consistent Using the same code for both seemed attractive at the time, but it's just too complicated. So I've split it: * Improvement: improveClsFD * Consistency: checkFunDeps Much clearer now!
| * Comments about stricteness of catch#Simon Peyton Jones2015-07-241-15/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In "Improve strictness analysis for exceptions" commit 7c0fff41789669450b02dc1db7f5d7babba5dee6 Author: Simon Peyton Jones <simonpj@microsoft.com> Date: Tue Jul 21 12:28:42 2015 +0100 I made catch# strict in its first argument. But today I found a very old comment suggesting the opposite. I disagree with the old comment, but I've elaborated the Note, which I reproduce here: {- Note [Strictness for mask/unmask/catch] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider this example, which comes from GHC.IO.Handle.Internals: wantReadableHandle3 f ma b st = case ... of DEFAULT -> case ma of MVar a -> ... 0# -> maskAsynchExceptions# (\st -> case ma of MVar a -> ...) The outer case just decides whether to mask exceptions, but we don't want thereby to hide the strictness in 'ma'! Hence the use of strictApply1Dmd. For catch, we know that the first branch will be evaluated, but not necessarily the second. Hence strictApply1Dmd and lazyApply1Dmd Howver, consider catch# (\st -> case x of ...) (..handler..) st We'll see that the entire thing is strict in 'x', so 'x' may be evaluated before the catch#. So fi evaluting 'x' causes a divide-by-zero exception, it won't be caught. This seems acceptable: - x might be evaluated somewhere else outside the catch# anyway - It's an imprecise eception anyway. Synchronous exceptions (in the IO monad) will never move in this way. There was originally a comment "Catch is actually strict in its first argument but we don't want to tell the strictness analyser about that, so that exceptions stay inside it." but tracing it back through the commit logs did not give any rationale. And making catch# lazy has performance costs for everyone.
| * Comments onlySimon Peyton Jones2015-07-241-4/+2
| |
| * Fix line number in T10018 testcaseBen Gamari2015-07-241-1/+1
| |
| * Library names, with Cabal submodule updateEdward Z. Yang2015-07-2313-41/+399
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A library name is a package name, package version, and hash of the version names of all textual dependencies (i.e. packages which were included.) A library name is a coarse approximation of installed package IDs, which are suitable for inclusion in package keys (you don't want to put an IPID in a package key, since it means the key will change any time the source changes.) - We define ShPackageKey, which is the semantic object which is hashed into a PackageKey. You can use 'newPackageKey' to hash a ShPackageKey to a PackageKey - Given a PackageKey, we can lookup its ShPackageKey with 'lookupPackageKey'. The way we can do this is by consulting the 'pkgKeyCache', which records a reverse mapping from every hash to the ShPackageKey. This means that if you load in PackageKeys from external sources (e.g. interface files), you also need to load in a mapping of PackageKeys to their ShPackageKeys so we can populate the cache. - We define a 'LibraryName' which encapsulates the full depenency resolution that Cabal may have selected; this is opaque to GHC but can be used to distinguish different versions of a package. - Definite packages don't have an interesting PackageKey, so we rely on Cabal to pass them to us. - We can pretty-print package keys while displaying the instantiation, but it's not wired up to anything (e.g. the Outputable instance of PackageKey). Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1056 GHC Trac Issues: #10566
| * Add a few comments from SPJ on fixity declarationsBen Gamari2015-07-232-2/+20
| |
| * ghci: fixity declarations for infix data constructors (#10018)Thomas Miedema2015-07-235-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Declaring a custom fixity for an infix data constructor should work: Prelude> data Infix a b = a :@: b; infixl 4 :@: This is a followup to #2947, which handled fixity declarations in ghci statements (e.g. let add = (+); infixl 6 `add`). Support for declarations (data, type, newtype, class, instance, deriving, and foreign) was added to GHCi in #4929. Reviewers: simonpj, austin, thomie Subscribers: thomie, bgamari Differential Revision: https://phabricator.haskell.org/D1028 GHC Trac Issues: #10018
| * Document type functions in the Paterson conditionsSimon Peyton Jones2015-07-231-1/+6
| |
| * Slight refactoring to the fix for #4012Simon Peyton Jones2015-07-233-20/+22
| | | | | | | | Add CoreSyn.chooseOrphanAnchor, and use it
| * rts/sm: Add missing argument names in function definitionsBen Gamari2015-07-231-6/+6
| | | | | | | | | | | | C99 does not allow unnamed parameters in definition argument lists [1]. [1] http://stackoverflow.com/questions/8776810/parameter-name-omitted-c-vs-c
| * DataCon: Fix redundant importBen Gamari2015-07-231-1/+0
| |
| * Parenthesise TypeOperator in import hintsThomas Winant2015-07-234-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a constructor was mistakenly imported directly instead of as a constructor of a data type, a hint will be shown on how to correctly import it. Just like the constructor, the data type should be surrounded in parentheses if it is an operator (TypeOperator in this case). Instead of: error: In module ‘Data.Type.Equality’: ‘Refl’ is a data constructor of ‘:~:’ To import it use ‘import’ Data.Type.Equality( :~:( Refl ) ) or ‘import’ Data.Type.Equality( :~:(..) ) Print: error: In module ‘Data.Type.Equality’: ‘Refl’ is a data constructor of ‘(:~:)’ To import it use ‘import’ Data.Type.Equality( (:~:)( Refl ) ) or ‘import’ Data.Type.Equality( (:~:)(..) ) Test Plan: pass new test Reviewers: austin, bgamari, simonpj Reviewed By: simonpj Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D1093 GHC Trac Issues: #10668
| * Update encoding001 to test the full range of non-surrogate code pointsReid Barton2015-07-232-12/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GHC has used surrogate code points for roundtripping since 7.4. See Note [Roundtripping]. Also, improve the wording of that Note slightly. Test Plan: validate still passes Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1087
| * Accept next-docstrings on GADT constructors.Ben Gamari2015-07-236-7/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Accept next docstrings (`-- | Docstring`) on GADT constructors. I have confirmed that this adds no shift/reduce conflicts. Test Plan: haddockA034 Reviewers: austin, simonpj, simonmar Reviewed By: simonmar Subscribers: Fuuzetsu, simonmar, thomie, mpickering, edsko Differential Revision: https://phabricator.haskell.org/D1086
| * Generate .dyn_o files for .hsig files with -dynamic-tooMichael Smith2015-07-238-1/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With -dynamic-too, .dyn_o files were not being generated for .hsig files. Normally, this is handled in the pipeline; however, the branch for .hsig files called compileEmptyStub directly instead of going through runPipeline. When compiling a Cabal package that included .hsig files, this triggered a linker error later on, as it expected a .dyn_o file to have been generated for each .hsig. The fix is to use runPipeline for .hsig files, just as with .hs files. Alternately, one could duplicate the logic for handling -dynamic-too in the .hsig branch, but simply calling runPipeline ends up being much cleaner. Test Plan: validate Reviewers: austin, ezyang, bgamari, thomie Reviewed By: ezyang, thomie Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1084 GHC Trac Issues: #10660
| * Lexer: support consecutive references to Haddock chunks (#10398)Thomas Miedema2015-07-234-1/+40
| | | | | | | | | | | | | | | | | | | | | | | | Reviewers: austin, bgamari, Fuuzetsu Reviewed By: bgamari Subscribers: thomie, bgamari Differential Revision: https://phabricator.haskell.org/D1025 GHC Trac Issues: #10398
| * Comments onlySimon Peyton Jones2015-07-231-1/+7
| |
| * Fix Trac #10670Simon Peyton Jones2015-07-235-19/+110
| | | | | | | | | | | | In dataConCannotMatch we were using a GADT data con without properly instantiating the existential type variables. The fix is easy, and the code is tighter.
| * Use lookupIfaceTop for loading IfaceDecls.Edward Z. Yang2015-07-223-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: It's shorter! And then when Backpack overrides lookupIfaceTop everyone will see the right information. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1090
| * Some utility functions for testing IfaceType equality.Edward Z. Yang2015-07-222-2/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: These are going to be used by Backpack, but someone else might find them useful. They do the "obvious thing". Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: goldfire, bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1089
| * Export alwaysQualifyPackages and neverQualifyPackages.Edward Z. Yang2015-07-221-0/+1
| | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
| * Give more informative panic for checkFamInstConsistency.Edward Z. Yang2015-07-221-1/+3
| | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
| * Add ExceptionMonad instance for IOEnv.Edward Z. Yang2015-07-221-0/+10
| | | | | | | | Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
| * Switch from recording IsBootInterface to recording full HscSource.Edward Z. Yang2015-07-227-20/+38
| | | | | | | | | | | | Note: ModIface format change is BC, no need to recompile. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
| * Travis: do pass `--quiet` to validateThomas Miedema2015-07-221-3/+1
| | | | | | | | | | | | | | | | It's failing at the moment with "The log length has exceeded the limit of 4 Megabytes". We don't seem to have periods of >10 minutes without output after all, which was the initial reason of not using `--quiet`.
| * Validate: explain THREADS instead of CPUS in --helpThomas Miedema2015-07-222-9/+10
| |
| * Two step allocator for 64-bit systemsGiovanni Campagna2015-07-2215-248/+1030
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The current OS memory allocator conflates the concepts of allocating address space and allocating memory, which makes the HEAP_ALLOCED() implementation excessively complicated (as the only thing it cares about is address space layout) and slow. Instead, what we want is to allocate a single insanely large contiguous block of address space (to make HEAP_ALLOCED() checks fast), and then commit subportions of that in 1MB blocks as we did before. This is currently behind a flag, USE_LARGE_ADDRESS_SPACE, that is only enabled for certain OSes. Test Plan: validate Reviewers: simonmar, ezyang, austin Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D524 GHC Trac Issues: #9706
| * Eliminate zero_static_objects_list()Simon Marlow2015-07-2212-121/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In a workload with a large amount of code, zero_static_objects_list() takes a significant amount of time, and furthermore it is in the single-threaded part of the GC. This patch uses a slightly fiddly scheme for marking objects on the static object lists, using a flag in the low 2 bits that flips between two states to indicate whether an object has been visited during this GC or not. We also have to take into account objects that have not been visited yet, which might appear at any time due to runtime linking. Test Plan: validate Reviewers: austin, bgamari, ezyang, rwbarton Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1076
| * Testsuite: recenter haddock.base allocation numbersThomas Miedema2015-07-221-1/+2
| |
| * Revert "Trac #4945 is working again"Thomas Miedema2015-07-221-1/+1
| | | | | | | | This reverts commit 5d98b6828f65ce6eea45e93880928b7031955d38.