summaryrefslogtreecommitdiff
path: root/compiler/hsSyn
Commit message (Collapse)AuthorAgeFilesLines
* Fix newtype wrapper for 'PData[s] (Wrap a)' and fix VECTORISE type and ↵Manuel M T Chakravarty2011-11-251-17/+9
| | | | | | | | instance pragmas * Correct usage of new type wrappers from MkId * 'VECTORISE [SCALAR] type T = S' didn't work correctly across module boundaries * Clean up 'VECTORISE SCALAR instance'
* Removing the default grouping clause from the SQL-like comprehension notation ;George Giorgidze2011-11-172-25/+11
|
* Changes to the kind checkerJose Pedro Magalhaes2011-11-162-3/+27
| | | | | | | | | | | | | We now always check against an expected kind. When we really don't know what kind to expect, we match against a new meta kind variable. Also, we are more explicit about tuple sorts: HsUnboxedTuple -> Produced by the parser HsBoxedTuple -> Certainly a boxed tuple HsConstraintTuple -> Certainly a constraint tuple HsBoxedOrConstraintTuple -> Could be a boxed or a constraint tuple. Produced by the parser only, disappears after type checking
* GHC gets a new constraint solver. More efficient and smaller in size.Dimitrios Vytiniotis2011-11-161-5/+12
|
* New kind-polymorphic coreJose Pedro Magalhaes2011-11-118-93/+196
| | | | | | | | | This big patch implements a kind-polymorphic core for GHC. The current implementation focuses on making sure that all kind-monomorphic programs still work in the new core; it is not yet guaranteed that kind-polymorphic programs (using the new -XPolyKinds flag) will work. For more information, see http://haskell.org/haskellwiki/GHC/Kinds
* Warnings appear to already be fixed in hsSyn/HsPat.lhsIan Lynagh2011-11-061-6/+0
|
* Whitespace in hsSyn/HsPat.lhsIan Lynagh2011-11-061-162/+155
|
* Use -fwarn-tabs when validatingIan Lynagh2011-11-049-0/+63
| | | | | We only use it for "compiler" sources, i.e. not for libraries. Many modules have a -fno-warn-tabs kludge for now.
* Overhaul of infrastructure for profiling, coverage (HPC) and breakpointsSimon Marlow2011-11-023-14/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | User visible changes ==================== Profilng -------- Flags renamed (the old ones are still accepted for now): OLD NEW --------- ------------ -auto-all -fprof-auto -auto -fprof-exported -caf-all -fprof-cafs New flags: -fprof-auto Annotates all bindings (not just top-level ones) with SCCs -fprof-top Annotates just top-level bindings with SCCs -fprof-exported Annotates just exported bindings with SCCs -fprof-no-count-entries Do not maintain entry counts when profiling (can make profiled code go faster; useful with heap profiling where entry counts are not used) Cost-centre stacks have a new semantics, which should in most cases result in more useful and intuitive profiles. If you find this not to be the case, please let me know. This is the area where I have been experimenting most, and the current solution is probably not the final version, however it does address all the outstanding bugs and seems to be better than GHC 7.2. Stack traces ------------ +RTS -xc now gives more information. If the exception originates from a CAF (as is common, because GHC tends to lift exceptions out to the top-level), then the RTS walks up the stack and reports the stack in the enclosing update frame(s). Result: +RTS -xc is much more useful now - but you still have to compile for profiling to get it. I've played around a little with adding 'head []' to GHC itself, and +RTS -xc does pinpoint the problem quite accurately. I plan to add more facilities for stack tracing (e.g. in GHCi) in the future. Coverage (HPC) -------------- * derived instances are now coloured yellow if they weren't used * likewise record field names * entry counts are more accurate (hpc --fun-entry-count) * tab width is now correct (markup was previously off in source with tabs) Internal changes ================ In Core, the Note constructor has been replaced by Tick (Tickish b) (Expr b) which is used to represent all the kinds of source annotation we support: profiling SCCs, HPC ticks, and GHCi breakpoints. Depending on the properties of the Tickish, different transformations apply to Tick. See CoreUtils.mkTick for details. Tickets ======= This commit closes the following tickets, test cases to follow: - Close #2552: not a bug, but the behaviour is now more intuitive (test is T2552) - Close #680 (test is T680) - Close #1531 (test is result001) - Close #949 (test is T949) - Close #2466: test case has bitrotted (doesn't compile against current version of vector-space package)
* Minor refactoring onlySimon Peyton Jones2011-11-011-3/+3
|
* Fix warnings and whitespace in HsBinds.Michal Terepeta2011-10-311-203/+198
|
* Fix duplicate type signature error (ticket #5589).Michal Terepeta2011-10-311-11/+18
|
* VECTORISE pragmas for type classes and instancesManuel M T Chakravarty2011-10-311-5/+39
| | | | * Frontend support (not yet used in the vectoriser)
* Tabs -> spacesManuel M T Chakravarty2011-10-311-232/+232
|
* Refactor the way in which type (and other) signatures are renamedSimon Peyton Jones2011-10-211-19/+0
| | | | | | | This was a trickier change than I had anticipated, but I think it's considerably tidier now. Fixes Trac #5533.
* Fully implement for VECTORISE type pragmas (non-SCALAR).Manuel M T Chakravarty2011-10-101-16/+22
|
* Handle newtypes and type functions correctly in FFI types; fixes #3008Ian Lynagh2011-10-013-7/+31
| | | | | | You can now use type functions in FFI types. Newtypes are now only looked through if the constructor is in scope.
* Fix parenthesisation in conversion from TH.Exp to HsExpr.HsExprSimon Peyton Jones2011-09-291-1/+5
| | | | | We need to generate enough parens so that -ddump-splices is correct Haskell. There is certainly further to go.
* Fix scoping for RHS of associated type decls (fixes Trac #5515)Simon Peyton Jones2011-09-291-3/+8
| | | | | | | | | | | We should not allow things like class C a b where type F a :: * instance C (p,q) r where type F (p,q) = r -- No! fvs(rhs) should be a subset -- of fvs(lhs)
* Parenthesise type operators in -ddump-minimal-imports output; trac #4239Ian Lynagh2011-09-171-1/+1
|
* Whitespace only in hsSyn/HsImpExp.lhsIan Lynagh2011-09-171-33/+33
|
* Merge branch 'no-pred-ty'Max Bolingbroke2011-09-096-104/+112
|\ | | | | | | | | | | | | | | | | | | Conflicts: compiler/iface/BuildTyCl.lhs compiler/iface/MkIface.lhs compiler/iface/TcIface.lhs compiler/typecheck/TcTyClsDecls.lhs compiler/types/Class.lhs compiler/utils/Util.lhs
| * Implement -XConstraintKindMax Bolingbroke2011-09-066-104/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Basically as documented in http://hackage.haskell.org/trac/ghc/wiki/KindFact, this patch adds a new kind Constraint such that: Show :: * -> Constraint (?x::Int) :: Constraint (Int ~ a) :: Constraint And you can write *any* type with kind Constraint to the left of (=>): even if that type is a type synonym, type variable, indexed type or so on. The following (somewhat related) changes are also made: 1. We now box equality evidence. This is required because we want to give (Int ~ a) the *lifted* kind Constraint 2. For similar reasons, implicit parameters can now only be of a lifted kind. (?x::Int#) => ty is now ruled out 3. Implicit parameter constraints are now allowed in superclasses and instance contexts (this just falls out as OK with the new constraint solver) Internally the following major changes were made: 1. There is now no PredTy in the Type data type. Instead GHC checks the kind of a type to figure out if it is a predicate 2. There is now no AClass TyThing: we represent classes as TyThings just as a ATyCon (classes had TyCons anyway) 3. What used to be (~) is now pretty-printed as (~#). The box constructor EqBox :: (a ~# b) -> (a ~ b) 4. The type LCoercion is used internally in the constraint solver and type checker to represent coercions with free variables of type (a ~ b) rather than (a ~# b)
* | Implement associated type defaultsMax Bolingbroke2011-09-092-5/+9
|/ | | | | | | | | | | | | | | | | | | Basically, now you can write: class Cls a where type Typ a type Typ a = Just a And now if an instance does not specify an explicit associated type instance, one will be generated afresh based on that default. So for example this instance: instance Cls Int where Will be equivalent to this one: instance Cls Int where type Typ Int = Just Int
* Make Convert.thRdrName give a decent source locations (fixes Trac #5434)Simon Peyton Jones2011-09-021-8/+18
| | | | | thRdrName is used to construct *binders*, and some of them are Exact RdrNames, so we need to give them a decent source location.
* Fix the trimming of bind_fvs (fixes Trac #5439)Simon Peyton Jones2011-09-011-7/+45
| | | | | | | | | For the bind_fvs field of FunBind/PatBind, we need to be careful to keep track of uses of all functions in this module (although not imported ones). Moreover in TcBinds.decideGeneralisationPlan we need to take note of uses of lexically scoped type variables. These two buglets led to a (useful) assertion failure in TcEnv.
* Allow associated types to have fresh parametersSimon Peyton Jones2011-09-012-13/+28
| | | | | | | | | | | | | | | | | This patch allows class C a where type T a b :: * instance C Int type T Int b = b -> b That is, T has a type index 'b' that is not one of the class variables. On the way I did a good deal of refactoring (as usual), especially in TcInstDcls.tcLocalInstDecl1, which checks for consistent instantiation of the class instance and the type instance. Less code, more expressiveness. See Note [Checking consistent instantiation]
* Clean up the handling of the import and :module commands in GHCiSimon Marlow2011-08-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we remembered the whole history of commands and replayed them on every :load/:reload, which lead to some non-linear performance characteristics (#5317). The handling of the implicit Prelude import and the implicit imports of recently loaded modules was also complicated and wrong in various obscure ways. The Prelude import works just like the implicit Prelude import in a Haskell module: it can be overriden with an explicit Prelude import. I have added a new ":show imports" command to show which imports are currently in force. Prelude> :show imports import Prelude -- implicit Prelude> import Prelude () Prelude> :show imports import Prelude () Prelude> map <interactive>:0:1: Not in scope: `map' Prelude> Full documentation in the User's Guide. There are various other little tweaks and improvements, such as when a module is imported with 'as', we now show the 'as' name in the prompt rather than the original name.
* simpleImportDecl: default to unsafe, not safeSimon Marlow2011-08-261-1/+1
|
* Functions and types can now be post-hoc vectorised; i.e., in modules where ↵Manuel M T Chakravarty2011-08-241-12/+0
| | | | | | | | | they are not declared, but only imported - Types already gained this functionality already in a previous commit - This commit adds the capability for functions This is a crucial step towards being able to use the standard Prelude, instead of a special vectorised one.
* Minor wibbles to pretty-printing HsSynSimon Peyton Jones2011-08-232-14/+22
| | | | | Mainly affecting how declarations are printed Ie by default: laid out with no braces
* A batch of changes related to the handling of binders in instance declsSimon Peyton Jones2011-08-221-8/+8
| | | | | | | | | | | | | | | | The issue is that in instnace C T where data S = ... f = ... neither S nor f is really a binder; they are *occurrences*. Moreover Haskell dictates that these particular occurrences are disambiguated by looking at the class whose instance they occur in. Some of this was not handled right for associated types. And RnNames.getLocalNonValBinders was a bit messhy; this patch tidies it up. (And thenM is finally gone from RnSource.)
* Pretty-printing improvements in HsSynSimon Peyton Jones2011-08-222-29/+35
|
* Improve import and export of vectorisation informationManuel M T Chakravarty2011-08-191-5/+6
|
* Add VECTORISE [SCALAR] type pragmaManuel M T Chakravarty2011-08-191-4/+28
| | | | | | | | | - Pragma to determine how a given type is vectorised - At this stage only the VECTORISE SCALAR variant is used by the vectoriser. - '{-# VECTORISE SCALAR type t #-}' implies that 't' cannot contain parallel arrays and may be used in vectorised code. However, its constructors can only be used in scalar code. We use this, e.g., for 'Int'. - May be used on imported types See also http://hackage.haskell.org/trac/ghc/wiki/DataParallel/VectPragma
* Major improvement to pattern bindingsSimon Peyton Jones2011-08-162-21/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes a number of related improvements a) Implements the Haskell Prime semantics for pattern bindings (Trac #2357). That is, a pattern binding p = e is typed just as if it had been written t = e f = case t of p -> f g = case t of p -> g ... etc ... where f,g are the variables bound by p. In paricular it's ok to say (f,g) = (\x -> x, \y -> True) and f and g will get propertly inferred types f :: a -> a g :: a -> Int b) Eliminates the MonoPatBinds flag altogether. (For the moment it is deprecated and has no effect.) Pattern bindings are now generalised as per (a). Fixes Trac #2187 and #4940, in the way the users wanted! c) Improves the OutsideIn algorithm generalisation decision. Given a definition without a type signature (implying "infer the type"), the published algorithm rule is this: - generalise *top-level* functions, and - do not generalise *nested* functions The new rule is - generalise a binding whose free variables have Guaranteed Closed Types - do not generalise other bindings Generally, a top-level let-bound function has a Guaranteed Closed Type, and so does a nested function whose free vaiables are top-level functions, and so on. (However a top-level function that is bitten by the Monomorphism Restriction does not have a GCT.) Example: f x = let { foo y = y } in ... Here 'foo' has no free variables, so it is generalised despite being nested. d) When inferring a type f :: ty for a definition f = e, check that the compiler would accept f :: ty as a type signature for that same definition. The type is rejected precisely when the type is ambiguous. Example: class Wob a b where to :: a -> b from :: b -> a foo x = [x, to (from x)] GHC 7.0 would infer the ambiguous type foo :: forall a b. Wob a b => b -> [b] but that type would give an error whenever it is called; and GHC 7.0 would reject that signature if given by the programmer. The new type checker rejects it up front. Similarly, with the advent of type families, ambiguous types are easy to write by mistake. See Trac #1897 and linked tickets for many examples. Eg type family F a :: * f ::: F a -> Int f x = 3 This is rejected because (F a ~ F b) does not imply a~b. Previously GHC would *infer* the above type for f, but was unable to check it. Now even the inferred type is rejected -- correctly. The main implemenation mechanism is to generalise the abe_wrap field of ABExport (in HsBinds), from [TyVar] to HsWrapper. This beautiful generalisation turned out to make everything work nicely with minimal programming effort. All the work was fiddling around the edges; the core change was easy!
* Fix Trac #5404: looking up signature binders in RnEnvSimon Peyton Jones2011-08-151-11/+2
| | | | See Note [Looking up Exact RdrNames] in RnEnv
* Another run at binders in Template Haskell (fixes Trac #5379)Simon Peyton Jones2011-08-051-4/+5
| | | | | | TH quotation was using mkName rather than newName for top-level definitions, which is plain wrong as #5379 points out.
* Fix a long-standing bug in HsUtils.hsTyClDeclBindersSimon Peyton Jones2011-08-051-3/+17
| | | | | | | | | We were returning the tycon of a type family *instance* as a binder, and it just isn't! Consequential tidy-ups follow. I tripped over this on the way to something else. I'm not sure it was causing a problem, but it is Plainly Wrong.
* Replace use of 'asTypeOf' by type signaturesSimon Peyton Jones2011-08-031-14/+9
| | | | | The type signatures are much clearer, but need ScopedTypeVariables. Happily that is now available in our bootstrap compilers.
* Refactor the imports of InteractiveContextSimon Peyton Jones2011-08-021-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of two fields ic_toplev_scope :: [Module] ic_imports :: [ImportDecl RdrName] we now just have one ic_imports :: [InteractiveImport] with the auxiliary data type data InteractiveImport = IIDecl (ImportDecl RdrName) -- Bring the exports of a particular module -- (filtered by an import decl) into scope | IIModule Module -- Bring into scope the entire top-level envt of -- of this module, including the things imported -- into it. This makes lots of code less confusing. No change in behaviour. It's preparatory to fixing Trac #5147. While I was at I also * Cleaned up the handling of the "implicit" Prelude import by adding a ideclImplicit field to ImportDecl. This significantly reduces plumbing in the handling of the implicit Prelude import * Used record notation consistently for ImportDecl
* Fix comments and documentation on monad comprehensionsSimon Peyton Jones2011-07-271-4/+4
|
* A bit of refactoring on handling HsPar and friendsSimon Peyton Jones2011-07-275-110/+157
| | | | | This relates to Trac #4430 (infix expressions in TH),. Mainly comments but a bit of code wibbling.
* Add support for unresolved infix expressions and patternsReiner Pope2011-07-251-7/+99
|
* Merge branch 'master' of http://darcs.haskell.org/ghcSimon Peyton Jones2011-07-212-5/+4
|\
| * Comments onlySimon Peyton Jones2011-07-201-1/+4
| |
| * Fix #5332 (more): unboxed singleton tuples are fineSimon Peyton Jones2011-07-201-3/+0
| | | | | | | | This patch fixes the unboxed singleton tuples in types and patterns
| * Fix #5332: (# 0 #), unlike ( 0 ), is not the same as 0Ian Lynagh2011-07-191-1/+0
| |
* | Merge branch 'master' of http://darcs.haskell.org/ghcSimon Peyton Jones2011-07-183-5/+10
|\ \ | |/
| * Improve pretty printing of infix HsOpApp (fixes #5318)Simon Peyton Jones2011-07-151-1/+1
| |