summaryrefslogtreecommitdiff
path: root/compiler/deSugar
Commit message (Collapse)AuthorAgeFilesLines
* More hacking on monad-compmonad-compSimon Peyton Jones2011-05-033-874/+809
| | | | | | Lots of refactoring. In particular I have now combined TansformStmt and GroupStmt into a single constructor TransStmt. This gives lots of useful code sharing.
* More on monad-comp; an intermediate state, so don't pullSimon Peyton Jones2011-05-021-2/+6
|
* More hacking on monad-comp; now worksSimon Peyton Jones2011-05-024-205/+96
|
* Simon's hacking on monad-comp; incompleteSimon Peyton Jones2011-04-294-365/+259
|
* Preliminary monad-comprehension patch (Trac #4370)Simon Peyton Jones2011-04-286-55/+407
| | | | | | | | This is the work of Nils Schweinsberg <mail@n-sch.de> It adds the language extension -XMonadComprehensions, which generalises list comprehension syntax [ e | x <- xs] to work over arbitrary monads.
* Fix Trac #5045: add ticks to HsArrFormssimonpj2011-04-191-1/+15
| | | | | I don't know why these were left out. I did the obvious thing... I hope it's right!
* Change the way module initialisation is done (#3252, #4417)Simon Marlow2011-04-122-2/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the code generator generated small code fragments labelled with __stginit_M for each module M, and these performed whatever initialisation was necessary for that module and recursively invoked the initialisation functions for imported modules. This appraoch had drawbacks: - FFI users had to call hs_add_root() to ensure the correct initialisation routines were called. This is a non-standard, and ugly, API. - unless we were using -split-objs, the __stginit dependencies would entail linking the whole transitive closure of modules imported, whether they were actually used or not. In an extreme case (#4387, #4417), a module from GHC might be imported for use in Template Haskell or an annotation, and that would force the whole of GHC to be needlessly linked into the final executable. So now instead we do our initialisation with C functions marked with __attribute__((constructor)), which are automatically invoked at program startup time (or DSO load-time). The C initialisers are emitted into the stub.c file. This means that every time we compile with -prof or -hpc, we now get a stub file, but thanks to #3687 that is now invisible to the user. There are some refactorings in the RTS (particularly for HPC) to handle the fact that initialisers now get run earlier than they did before. The __stginit symbols are still generated, and the hs_add_root() function still exists (but does nothing), for backwards compatibility.
* Renumber TH uniquesIan Lynagh2011-03-291-143/+143
| | | | | | This fixes a couple of duplicates that had crept in, and also renumbers everything so that they are monotonically increasing through the file.
* Whitespace onlyIan Lynagh2011-03-281-17/+17
|
* Add unboxedTupleTName to templateHaskellNamesIan Lynagh2011-03-171-1/+1
|
* Added a VECTORISE pragmaManuel M T Chakravarty2011-02-205-38/+81
| | | | | | | | | | | | | | | - Added a pragma {-# VECTORISE var = exp #-} that prevents the vectoriser from vectorising the definition of 'var'. Instead it uses the binding '$v_var = exp' to vectorise 'var'. The vectoriser checks that the Core type of 'exp' matches the vectorised Core type of 'var'. (It would be quite complicated to perform that check in the type checker as the vectorisation of a type needs the state of the VM monad.) - Added parts of a related VECTORISE SCALAR pragma - Documented -ddump-vect - Added -ddump-vt-trace - Some clean up
* Add unboxed tuple support to Template HaskellIan Lynagh2011-02-101-14/+37
|
* avoid adding HPC ticks to arrow constructs (fixes #1333)Ross Paterson2011-02-021-13/+114
|
* Refine incomplete-pattern checks (Trac #4905)simonpj@microsoft.com2011-01-272-36/+42
| | | | | | | | | | | | | | | The changes are: * New flag -fwarn-incomplete-uni-patterns, which checks for incomplete patterns in (a) lambdas, (b) pattern bindings * New flag is not implied by -W or -Wall (too noisy; and many libraries use incomplete pattern bindings) * Actually do the incomplete-pattern check for pattern bindings (previously simply omitted) * Documentation for new flag
* Do dependency analysis when kind-checking type declarationssimonpj@microsoft.com2011-01-101-1/+1
| | | | | | | | | | | | | | | | | | | | | This patch fixes Trac #4875. The main point is to do dependency analysis on type and class declarations, and kind-check them in dependency order, so as to improve error messages. This patch means that a few programs that would typecheck before won't typecheck any more; but before we were (naughtily) going beyond Haskell 98 without any language-extension flags, and Trac #4875 convinces me that doing so is a Bad Idea. Here's an example that won't typecheck any more data T a b = MkT (a b) type F k = T k Maybe If you look at T on its own you'd default 'a' to kind *->*; and then kind-checking would fail on F. But GHC currently accepts this program beause it looks at the *occurrences* of T.
* Fix Trac #4870: get the inlining for an imported INLINABLE Idsimonpj@microsoft.com2011-01-051-6/+7
| | | | | | We need the unfolding even for a *recursive* function (indeed that's the point) and I was using the wrong function to get it (idUnfolding rather than realIdUnfolding).
* Tidy up rebindable syntax for MDosimonpj@microsoft.com2010-12-223-44/+35
| | | | | | | | | | | | | | | | | | | | For a long time an 'mdo' expression has had a SyntaxTable attached to it. However, we're busy deprecating SyntaxTables in favour of rebindable syntax attached to individual Stmts, and MDoExpr was totally inconsistent with DoExpr in this regard. This patch tidies it all up. Now there's no SyntaxTable on MDoExpr, and 'modo' is generally handled much more like 'do'. There is resulting small change in behaviour: now MonadFix is required only if you actually *use* recursion in mdo. This seems consistent with the implicit dependency analysis that is done for mdo. Still to do: * Deal with #4148 (this patch is on the way) * Get rid of the last remaining SyntaxTable on HsCmdTop
* For single-method classes use newtypessimonpj@microsoft.com2010-11-011-2/+1
| | | | | | This clears up an awkward hack for exprIsConApp_maybe, and works better too. See Note [Single-method classes] in TcInstDcls.
* Fix recursive superclasses (again). Fixes Trac #4809.simonpj@microsoft.com2010-12-131-29/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch finally deals with the super-delicate question of superclases in possibly-recursive dictionaries. The key idea is the DFun Superclass Invariant (see TcInstDcls): In the body of a DFun, every superclass argument to the returned dictionary is either * one of the arguments of the DFun, or * constant, bound at top level To establish the invariant, we add new "silent" superclass argument(s) to each dfun, so that the dfun does not do superclass selection internally. There's a bit of hoo-ha to make sure that we don't print those silent arguments in error messages; a knock on effect was a change in interface-file format. A second change is that instead of the complex and fragile "self dictionary binding" in TcInstDcls and TcClassDcl, using the same mechanism for existential pattern bindings. See Note [Subtle interaction of recursion and overlap] in TcInstDcls and Note [Binding when looking up instances] in InstEnv. Main notes are here: * Note [Silent Superclass Arguments] in TcInstDcls, including the DFun Superclass Invariant Main code changes are: * The code for MkId.mkDictFunId and mkDictFunTy * DFunUnfoldings get a little more complicated; their arguments are a new type DFunArg (in CoreSyn) * No "self" argument in tcInstanceMethod * No special tcSimplifySuperClasss * No "dependents" argument to EvDFunApp IMPORTANT It turns out that it's quite tricky to generate the right DFunUnfolding for a specialised dfun, when you use SPECIALISE INSTANCE. For now I've just commented it out (in DsBinds) but that'll lose some optimisation, and I need to get back to this.
* Fix Trac #4534: renamer bugsimonpj@microsoft.com2010-12-101-9/+8
| | | | | | | | The renamer wasn't attaching the right used-variables to a TransformStmt constructor. The real modification is in RnExpr; the rest is just pretty-printing and white space.
* White space onlysimonpj@microsoft.com2010-12-101-1/+1
|
* Fix the behaviour of :history for ticks surrounding top level functionspepeiborra@gmail.com2010-12-031-1/+4
|
* Fix a recomp bug: make classes/datatypes depend directly on DFuns (#4469)Simon Marlow2010-12-021-1/+1
| | | | | | | | | | | And remove the old mechanism of recording dfun uses separately, because it didn't work. This wiki page describes recompilation avoidance and fingerprinting. I'll update it to describe the new method and what went wrong with the old method: http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/RecompilationAvoidance
* Re-jig simplifySuperClass (again)simonpj@microsoft.com2010-12-021-9/+9
| | | | | | | | | | | | | This fixes the current loop in T3731, and will fix other reported loops. The loops show up when we are generating evidence for superclasses in an instance declaration. The trick is to make the "self" dictionary simplifySuperClass depend *explicitly* on the superclass we are currently trying to build. See Note [Dependencies in self dictionaries] in TcSimplify. That in turn means that EvDFunApp needs a dependency-list, used when chasing dependencies in isGoodRecEv.
* Just some alpha renamingIan Lynagh2010-11-211-8/+8
|
* Fix bug #3165 (:history throws irrefutable pattern failed)pepeiborra@gmail.com2010-11-151-9/+12
| | | | | | | | | I ran across this bug and took the time to fix it, closing a long time due TODO in InteractiveEval.hs Instead of looking around to find the enclosing declaration of a tick, this patch makes use of the information already collected during the coverage desugaring phase
* Add warning for probable identities (fromIntegral and friends)simonpj@microsoft.com2010-11-162-6/+44
| | | | | | | | | | | | | See Trac #4488. The basic idea is to check for fun :: ty -> ty where fun is one of toIntegerName toRationalName fromIntegralName realToFracName There's a (documented) flag to control it -fwarn-identities. Currently -Wall switches it on.
* Remove the now-unused constructor VarPatOutsimonpj@microsoft.com2010-11-053-10/+1
|
* Add rebindable syntax for if-then-elsesimonpj@microsoft.com2010-10-225-16/+28
| | | | | | | | | | | There are two main changes * New LANGUAGE option RebindableSyntax, which implies NoImplicitPrelude * if-the-else becomes rebindable, with function name "ifThenElse" (but case expressions are unaffected) Thanks to Sam Anklesaria for doing most of the work here
* Fix Trac #4396, by localising pattern binders in the desugarersimonpj@microsoft.com2010-10-211-5/+43
| | | | See Note [Localise pattern binders]
* White space onlysimonpj@microsoft.com2010-10-211-3/+3
|
* Improve rule checking, to fix panic Trac #4398simonpj@microsoft.com2010-10-212-84/+86
| | | | Lots of comments with decomposeRuleLhs
* Template Haskell: add view patterns (Trac #2399)Reiner Pope2010-10-101-3/+9
|
* Fix -auto-all: Add SCCs to IDs which have a monotype tooIan Lynagh2010-10-181-4/+6
|
* Interruptible FFI calls with pthread_kill and CancelSynchronousIO. v4Edward Z. Yang2010-09-191-2/+6
| | | | | | | | | | | | | | | | | | | | | | | This is patch that adds support for interruptible FFI calls in the form of a new foreign import keyword 'interruptible', which can be used instead of 'safe' or 'unsafe'. Interruptible FFI calls act like safe FFI calls, except that the worker thread they run on may be interrupted. Internally, it replaces BlockedOnCCall_NoUnblockEx with BlockedOnCCall_Interruptible, and changes the behavior of the RTS to not modify the TSO_ flags on the event of an FFI call from a thread that was interruptible. It also modifies the bytecode format for foreign call, adding an extra Word16 to indicate interruptibility. The semantics of interruption vary from platform to platform, but the intent is that any blocking system calls are aborted with an error code. This is most useful for making function calls to system library functions that support interrupting. There is no support for pre-Vista Windows. There is a partner testsuite patch which adds several tests for this functionality.
* Implement auto-specialisation of imported Idssimonpj@microsoft.com2010-10-073-82/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This big-ish patch arranges that if an Id 'f' is * Type-class overloaded f :: Ord a => [a] -> [a] * Defined with an INLINABLE pragma {-# INLINABLE f #-} * Exported from its defining module 'D' then in any module 'U' that imports D 1. Any call of 'f' at a fixed type will generate (a) a specialised version of f in U (b) a RULE that rewrites unspecialised calls to the specialised on e.g. if the call is (f Int dOrdInt xs) then the specialiser will generate $sfInt :: [Int] -> [Int] $sfInt = <code for f, imported from D, specialised> {-# RULE forall d. f Int d = $sfInt #-} 2. In addition, you can give an explicit {-# SPECIALISE -#} pragma for the imported Id {-# SPECIALISE f :: [Bool] -> [Bool] #-} This too generates a local specialised definition, and the corresponding RULE The new RULES are exported from module 'U', so that any module importing U will see the specialised versions of 'f', and will not re-specialise them. There's a flag -fwarn-auto-orphan that warns you if the auto-generated RULES are orphan rules. It's not in -Wall, mainly to avoid lots of error messages with existing packages. Main implementation changes - A new flag on a CoreRule to say if it was auto-generated. This is persisted across interface files, so there's a small change in interface file format. - Quite a bit of fiddling with plumbing, to get the {-# SPECIALISE #-} pragmas for imported Ids. In particular, a new field tgc_imp_specs in TcGblEnv, to keep the specialise pragmas for imported Ids between the typechecker and the desugarer. - Some new code (although surprisingly little) in Specialise, to deal with calls of imported Ids
* Make warning-freesimonpj@microsoft.com2010-10-061-9/+13
|
* Fix Trac #4371: matching of view patternssimonpj@microsoft.com2010-10-061-83/+94
|
* Remove unused NoMatchContext construtorsimonpj@microsoft.com2010-10-061-1/+0
|
* Fix an egregious bug: INLINE pragmas on monomorphic Ids were being ignoredsimonpj@microsoft.com2010-09-241-80/+5
| | | | | | I had do to some refactoring to make this work nicely but now it does. I can't think how this escaped our attention for so long!
* Remove -fwarn-simple-patterns, and make -fwarn-incomplete-patterns include ↵simonpj@microsoft.com2010-09-221-21/+9
| | | | | | | | lambdas This makes \(x:xs) -> e want when you have -fwarn-incomplete-patterns, which is consistent.
* Add separate functions for querying DynFlag and ExtensionFlag optionsIan Lynagh2010-09-182-2/+2
| | | | and remove the temporary DOpt class workaround.
* Implement INLINABLE pragma simonpj@microsoft.com2010-09-153-17/+27
| | | | Implements Trac #4299. Documentation to come.
* Remove (most of) the FiniteMap wrapperIan Lynagh2010-09-142-11/+13
| | | | | | | | We still have insertList, insertListWith, deleteList which aren't in Data.Map, and foldRightWithKey which works around the fold(r)WithKey addition and deprecation.
* Move error-ids to MkCore (from PrelRules)simonpj@microsoft.com2010-09-145-5/+1
| | | | and adjust imports accordingly
* Super-monster patch implementing the new typechecker -- at lastsimonpj@microsoft.com2010-09-138-243/+457
| | | | | | | | | This major patch implements the new OutsideIn constraint solving algorithm in the typecheker, following our JFP paper "Modular type inference with local assumptions". Done with major help from Dimitrios Vytiniotis and Brent Yorgey.
* Put liftStringName into the known-key namessimonpj@microsoft.com2010-09-061-2/+3
|
* minor fix to commentRoss Paterson2010-08-221-1/+1
|
* fix #3822: desugaring case command in arrow notationRoss Paterson2010-06-151-17/+11
| | | | | | Get the set of free variables from the generated case expression: includes variables in the guards and decls that were missed before, and is also a bit simpler.
* Robustify the treatement of DFunUnfoldingsimonpj@microsoft.com2010-05-311-7/+8
| | | | | | | | | | | | See Note [DFun unfoldings] in CoreSyn. The issue here is that you can't tell how many dictionary arguments a DFun needs just from looking at the Arity of the DFun Id: if the dictionary is represented by a newtype the arity might include the dictionary and value arguments of the (single) method. So we need to record the number of arguments need by the DFun in the DFunUnfolding itself. Details in Note [DFun unfoldings] in CoreSyn