summaryrefslogtreecommitdiff
path: root/ghc/compiler/hsSyn
Commit message (Collapse)AuthorAgeFilesLines
...
* [project @ 2003-05-19 15:10:40 by simonpj]simonpj2003-05-192-2/+3
| | | | | | | | | | | -------------------------- Minor Template Haskell bug -------------------------- This bug meant that spliced-in class declarations yielded a 'op not in scope', where op was the class operation. Thanks to Andre Pang for spotting this. Some consequential tidying up in parsing too.
* [project @ 2003-05-06 10:23:16 by simonpj]simonpj2003-05-061-1/+1
| | | | Formatting only
* [project @ 2003-05-04 13:21:48 by igloo]igloo2003-05-041-2/+5
| | | | Add support for unboxed Ints, Floats and Doubles to Template Haskell.
* [project @ 2003-04-25 20:58:09 by panne]panne2003-04-251-3/+3
| | | | Unbreak 2nd stage
* [project @ 2003-04-22 20:39:59 by igloo]igloo2003-04-221-6/+6
| | | | | | | | Order declarations in reifications in order of source line number. The bugs still there but it bites less often now... Also remove the type parameterisation and do some type renaming as discussed on the template-haskell list.
* [project @ 2003-04-10 14:43:52 by simonpj]simonpj2003-04-101-0/+2
| | | | comments
* [project @ 2003-03-16 14:15:21 by igloo]igloo2003-03-161-3/+6
| | | | Support for contexts on data types and records from Derek Elkins.
* [project @ 2003-02-21 13:27:53 by simonpj]simonpj2003-02-211-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------- Improve the "unused binding" warnings ------------------------------------- We've had a succession of hacks for reporting warnings for unused bindings. Consider module M( f ) where f x = x g x = g x + h x h x = x Here, g mentions itself and h, but is not itself mentioned. So really both g and h are dead code. We've been getting this wrong for ages, and every hack so far has failed on some simple programs. This commit does a much better job. The renamer applied to a bunch of bindings returns a NameSet.DefUses, which is a dependency-ordered lists of def/use pairs. It's documented in NameSet. Given this, we can work out precisely what is not used, in a nice tidy way. It's less convenient in the case of type and class declarations, because the strongly-connected-component analysis can span module boundaries. So things are pretty much as they were for these. As usual, there was a lot of chuffing around tidying things up. I havn't tested it at all thoroughly yet. Various unrelated import-decl-pruning has been done too.
* [project @ 2003-02-21 13:25:17 by simonpj]simonpj2003-02-211-1/+1
| | | | Import pruning
* [project @ 2003-02-20 18:33:50 by simonpj]simonpj2003-02-202-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------- Add Core Notes and the {-# CORE #-} pragma ------------------------------------- This is an idea of Hal Daume's. The key point is that Notes in Core are augmented thus: data Note = SCC CostCentre | ... | CoreNote String -- NEW These notes can be injected via a Haskell-source pragma: f x = ({-# CORE "foo" #-} show) ({-# CORE "bar" #-} x) This wraps a (Note (CoreNote "foo")) around the 'show' variable, and a similar note around the argument to 'show'. These notes are basically ignored by GHC, but are emitted into External Core, where they may convey useful information. Exactly how code involving these notes is munged by the simplifier isn't very well defined. We'll see how it pans out. Meanwhile the impact on the rest of the compiler is minimal.
* [project @ 2003-02-20 18:18:55 by simonpj]simonpj2003-02-201-3/+1
| | | | Import pruning
* [project @ 2003-02-18 16:23:35 by igloo]igloo2003-02-181-3/+15
| | | | | Support strictness annotations on data declarations and support the record and infix constructors. Also tweaked the pretty printer a bit.
* [project @ 2003-02-12 15:01:31 by simonpj]simonpj2003-02-122-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------- Big upheaval to the way that constructors are named ------------------------------------- This commit enshrines the new story for constructor names. We could never really get External Core to work nicely before, but now it does. The story is laid out in detail in the Commentary ghc/docs/comm/the-beast/data-types.html so I will not repeat it here. [Manuel: the commentary isn't being updated, apparently.] However, the net effect is that in Core and in External Core, contructors look like constructors, and the way things are printed is all consistent. It is a fairly pervasive change (which is why it has been so long postponed), but I hope the question is now finally closed. All the libraries compile etc, and I've run many tests, but doubtless there will be some dark corners.
* [project @ 2003-02-06 17:37:50 by simonpj]simonpj2003-02-061-1/+5
| | | | Deal with TForall in cvtType
* [project @ 2003-02-06 17:15:50 by simonpj]simonpj2003-02-061-4/+4
| | | | | | | | | | | | | ------------------------------------- Fix parsing of floating-point constants in External Core ------------------------------------- This fix accidentally made it into the previous (unrelated) commit, so it's really the *previous* change to LexCore you should look at. The fix updates LexCore so that it can parse literals in scientific notation (e.g. 4.3e-3)
* [project @ 2003-02-05 11:39:26 by simonpj]simonpj2003-02-051-0/+1
| | | | Type sigs and comments only
* [project @ 2003-02-04 15:09:38 by simonpj]simonpj2003-02-041-14/+1
| | | | | | | | | | | | | | | | | ------------------------------------- Remove all vestiges of usage analysis ------------------------------------- This commit removes a large blob of usage-analysis-related code, almost all of which was commented out. Sadly, it doesn't look as if Keith is going to have enough time to polish it up, and in any case the actual performance benefits (so far as we can measure them) turned out to be pretty modest (a few percent). So, with regret, I'm chopping it all out. It's still there in the repository if anyone wants go hack on it. And Tobias Gedell at Chalmers is implementing a different analysis, via External Core.
* [project @ 2002-12-18 17:45:30 by igloo]igloo2002-12-181-1/+1
| | | | Context predicates start with a tcon name, not a type variable
* [project @ 2002-12-18 17:28:17 by igloo]igloo2002-12-181-0/+2
| | | | Convert Tup [e] and Pat [p] and e, p respectively.
* [project @ 2002-12-11 14:02:28 by igloo]igloo2002-12-111-1/+1
| | | | Handle bindings to just a pattern variable in cvtd.
* [project @ 2002-12-11 12:35:57 by igloo]igloo2002-12-111-22/+65
| | | | Improved foreign import conversion.
* [project @ 2002-12-10 21:25:07 by igloo]igloo2002-12-101-4/+4
| | | | Use real datatypes for TH Clause and Match
* [project @ 2002-12-10 02:34:21 by igloo]igloo2002-12-101-1/+2
| | | | | Correctly convert expressions from TH datastructures to the internel Hs* datastructures containing right infix operators left-parenthesised.
* [project @ 2002-11-21 09:37:24 by simonpj]simonpj2002-11-211-1/+1
| | | | More wibbles to improve declaration splicing
* [project @ 2002-11-21 09:36:03 by simonpj]simonpj2002-11-211-30/+2
| | | | | | | | | | | | | | | ------------------------------- Fix and tidy the desugaring of pattern-matching in do-notation ------------------------------- In the reorgansiation of HsPat, failureFreePat had become incorrect (due to a catch-all case that caught a constructor that should have been matched). So pattern-match failure in do-notation wasn't handled right. As it turned out, DsExpr.dsDo could be made much simpler and more elegant by using matchSimply instead of matchWrapper, and this had the side benefit of removing the last call to HsPat.failureFreePat. So it's gone!
* [project @ 2002-11-21 03:34:07 by chak]chak2002-11-211-1/+1
| | | | | Convert : Added newly required import of `HsSyn.TySynonym' TcSplice: Adapted `tcRunQ' to new definition of `THSyntax.Q'
* [project @ 2002-11-20 15:43:37 by simonpj]simonpj2002-11-201-0/+3
| | | | | | | | | | | Three Template Haskell improvements a) Add type synonyms to THSyntax (and DsMeta, Convert) b) Make Q into a newtype instead of a type synonym c) Eliminate tiresome and error prone argument to DsMeta.wrapGenSyms and similarly addTyVarBinds
* [project @ 2002-11-08 09:01:06 by simonpj]simonpj2002-11-081-8/+13
| | | | | | | | | | ------------------ More TH stuff (thanks to Ian L) ------------------ * Make TH Literals have an Integer not an Int * Desguar TH 'foreign import' a bit better * Minor documentation changes
* [project @ 2002-11-06 13:10:46 by simonpj]simonpj2002-11-061-1/+11
| | | | | | | | | | | | | ------------------ Template Haskell stuff ------------------ a) Pretty printer for TH (thanks to Ian Lynagh) b) A declaration quote has type Q [Dec], not [Q Dec] as in the paper c) Foreign imports are part of THSyntax, and can be spliced in
* [project @ 2002-10-31 13:13:04 by simonpj]simonpj2002-10-311-1/+1
| | | | Finish TH exprs with type sigs
* [project @ 2002-10-30 13:16:40 by simonpj]simonpj2002-10-301-3/+6
| | | | Add string/rational literals, and e::t form to TH
* [project @ 2002-10-30 11:23:28 by simonpj]simonpj2002-10-301-1/+0
| | | | Remove CrossStage from Convert
* [project @ 2002-10-25 16:54:55 by simonpj]simonpj2002-10-252-2/+1
| | | | Import wibbles
* [project @ 2002-10-24 14:17:46 by simonpj]simonpj2002-10-241-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------------ 1. New try and module and package dependencies 2. OrigNameCache always contains final info ------------------------------------------ These things nearly complete sorting out the incremental linking problem that started us off! 1. This commit separates two kinds of information: (a) HscTypes.Dependencies: What (i) home-package modules, and (ii) other packages this module depends on, transitively. That is, to link the module, it should be enough to link the dependent modules and packages (plus any C stubs etc). Along with this info we record whether the dependent module is (a) a boot interface or (b) an orphan module. So in fact (i) can contain non-home-package modules, namely the orphan ones in other packages (sigh). (b) HscTypes.Usage: What version of imported things were used to actually compile the module. This info is used for recompilation control only. 2. The Finder now returns a correct Module (incl package indicator) first time, so we can install the absolutely final Name in the OrigNameCache when we first come across an occurrence of that name, even if it's only an occurrence in an unfolding in some other interface file. This is much tidier. As a result Module.lhs is much cleaner No DunnoYet No mkVanillaModule ALl very joyful stuff.
* [project @ 2002-10-23 14:30:00 by simonpj]simonpj2002-10-233-42/+44
| | | | | | | | | | | | | | | | | | | | ------------------------------------------------ Allow implicit-parameter bindings anywhere that a normal binding group is allowed. ------------------------------------------------ That is, you can have implicit parameters * in a let binding * in a where clause (but then you can't have non-implicit ones as well) * in a let group in a list comprehension or monad do-notation The implementation is simple: just add IPBinds to the allowable forms of HsBinds, and remove the HsWith expression form altogether. (It now comes in via the HsLet form.) It'a a nice generalisation really. Needs a bit of documentation, which I'll do next.
* [project @ 2002-10-11 16:45:16 by simonpj]simonpj2002-10-111-1/+3
| | | | More reification wibbling; and -ddump-splices
* [project @ 2002-10-11 14:46:02 by simonpj]simonpj2002-10-111-1/+18
| | | | | | | | | | | | | | | ------------------------------------------ Implement reification for Template Haskell ------------------------------------------ This is entirely un-tested, but I don't think it'll break non-TH stuff. Implements reifyDecl T :: Dec -- Data type T reifyDecl C :: Dec -- Class C reifyType f :: Typ -- Function f I hope.
* [project @ 2002-10-09 16:53:10 by simonpj]simonpj2002-10-092-9/+19
| | | | Fix to mdo, plus SrcLocs on splices and brackets
* [project @ 2002-10-09 15:03:48 by simonpj]simonpj2002-10-095-61/+86
| | | | | | | | | | | | | | | | ----------------------------------- Lots more Template Haskell stuff ----------------------------------- At last! Top-level declaration splices work! Syntax is $(f x) not "splice (f x)" as in the paper. Lots jiggling around, particularly with the top-level plumbining. Note the new data type HsDecls.HsGroup.
* [project @ 2002-09-27 12:42:42 by simonpj]simonpj2002-09-271-41/+59
| | | | Wibbles to improve error reporting
* [project @ 2002-09-27 08:20:43 by simonpj]simonpj2002-09-274-37/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | -------------------------------- Implement recursive do-notation -------------------------------- This commit adds recursive do-notation, which Hugs has had for some time. mdo { x <- foo y ; y <- baz x ; return (y,x) } turns into do { (x,y) <- mfix (\~(x,y) -> do { x <- foo y; y <- baz x }) ; return (y,x) } This is all based on work by Levent Erkok and John Lanuchbury. The really tricky bit is in the renamer (RnExpr.rnMDoStmts) where we break things up into minimal segments. The rest is easy, including the type checker. Levent laid the groundwork, and Simon finished it off. Needless to say, I couldn't resist tidying up other stuff, so there's no guaranteed I have not broken something.
* [project @ 2002-09-13 16:06:28 by simonpj]simonpj2002-09-131-3/+3
| | | | wibbles
* [project @ 2002-09-13 15:02:25 by simonpj]simonpj2002-09-1312-733/+974
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -------------------------------------- Make Template Haskell into the HEAD -------------------------------------- This massive commit transfers to the HEAD all the stuff that Simon and Tim have been doing on Template Haskell. The meta-haskell-branch is no more! WARNING: make sure that you * Update your links if you are using link trees. Some modules have been added, some have gone away. * Do 'make clean' in all library trees. The interface file format has changed, and you can get strange panics (sadly) if GHC tries to read old interface files: e.g. ghc-5.05: panic! (the `impossible' happened, GHC version 5.05): Binary.get(TyClDecl): ForeignType * You need to recompile the rts too; Linker.c has changed However the libraries are almost unaltered; just a tiny change in Base, and to the exports in Prelude. NOTE: so far as TH itself is concerned, expression splices work fine, but declaration splices are not complete. --------------- The main change --------------- The main structural change: renaming and typechecking have to be interleaved, because we can't rename stuff after a declaration splice until after we've typechecked the stuff before (and the splice itself). * Combine the renamer and typecheker monads into one (TcRnMonad, TcRnTypes) These two replace TcMonad and RnMonad * Give them a single 'driver' (TcRnDriver). This driver replaces TcModule.lhs and Rename.lhs * The haskell-src library package has a module Language/Haskell/THSyntax which defines the Haskell data type seen by the TH programmer. * New modules: hsSyn/Convert.hs converts THSyntax -> HsSyn deSugar/DsMeta.hs converts HsSyn -> THSyntax * New module typecheck/TcSplice type-checks Template Haskell splices. ------------- Linking stuff ------------- * ByteCodeLink has been split into ByteCodeLink (which links) ByteCodeAsm (which assembles) * New module ghci/ObjLink is the object-code linker. * compMan/CmLink is removed entirely (was out of place) Ditto CmTypes (which was tiny) * Linker.c initialises the linker when it is first used (no need to call initLinker any more). Template Haskell makes it harder to know when and whether to initialise the linker. ------------------------------------- Gathering the LIE in the type checker ------------------------------------- * Instead of explicitly gathering constraints in the LIE tcExpr :: RenamedExpr -> TcM (TypecheckedExpr, LIE) we now dump the constraints into a mutable varabiable carried by the monad, so we get tcExpr :: RenamedExpr -> TcM TypecheckedExpr Much less clutter in the code, and more efficient too. (Originally suggested by Mark Shields.) ----------------- Remove "SysNames" ----------------- Because the renamer and the type checker were entirely separate, we had to carry some rather tiresome implicit binders (or "SysNames") along inside some of the HsDecl data structures. They were both tiresome and fragile. Now that the typechecker and renamer are more intimately coupled, we can eliminate SysNames (well, mostly... default methods still carry something similar). ------------- Clean up HsPat ------------- One big clean up is this: instead of having two HsPat types (InPat and OutPat), they are now combined into one. This is more consistent with the way that HsExpr etc is handled; there are some 'Out' constructors for the type checker output. So: HsPat.InPat --> HsPat.Pat HsPat.OutPat --> HsPat.Pat No 'pat' type parameter in HsExpr, HsBinds, etc Constructor patterns are nicer now: they use HsPat.HsConDetails for the three cases of constructor patterns: prefix, infix, and record-bindings The *same* data type HsConDetails is used in the type declaration of the data type (HsDecls.TyData) Lots of associated clean-up operations here and there. Less code. Everything is wonderful.
* [project @ 2002-09-09 12:57:47 by simonpj]simonpj2002-09-091-1/+4
| | | | | | | | | | | | | | | | -------------------------------- Fix rank-2 pattern-match failure -------------------------------- This fixes the failure when you have a rank-2 type sig matching a data type pattern. Thus data T a = T1 | T2 a f :: (forall x. T x) -> Int f T1 = ... This crashes GHC 5.04
* [project @ 2002-07-16 22:26:49 by lewie]lewie2002-07-161-2/+2
| | | | | Fix typo in explanation of "What AbsBinds means" just to prove that I'm not deadweight on the GHC committers list ;-)
* [project @ 2002-06-18 08:05:44 by simonpj]simonpj2002-06-181-1/+5
| | | | Wibble on printing outmost parens
* [project @ 2002-06-17 15:53:42 by simonpj]simonpj2002-06-171-33/+46
| | | | Fix HnType parenthesisation; fixes rnfail020, tcfail057
* [project @ 2002-06-14 16:19:04 by simonpj]simonpj2002-06-141-8/+13
| | | | Another HsParTy wibble; cures rn018 failure
* [project @ 2002-06-07 07:16:04 by chak]chak2002-06-071-7/+18
| | | | | | | | | | | Fixed handling of infix operators in types: - Pretty printing didn't take nested infix operators into account - Explicit parenthesis were ignored in the fixity parser: * I added a constructor `HsParTy' to `HsType' (in the spirit of `HsPar' in `HsExpr'), which tracks the use of explicit parenthesis * Occurences of `HsParTy' in type-ish things that are not quite types (like context predicates) are removed in `ParseUtils'; all other occurences of `HsParTy' are removed during type checking (just as it works with `HsPar')
* [project @ 2002-06-06 07:48:47 by simonpj]simonpj2002-06-064-17/+29
| | | | Fix bogon in rebindable syntax implementation