summaryrefslogtreecommitdiff
path: root/ghc/compiler/hsSyn/HsBinds.lhs
Commit message (Collapse)AuthorAgeFilesLines
* [project @ 2001-05-01 09:16:55 by qrczak]qrczak2001-05-011-11/+1
| | | | | Inline instance dictionary functions. Remove {-# INLINE instance #-} support and uses.
* [project @ 2001-04-14 22:24:24 by qrczak]qrczak2001-04-141-2/+12
| | | | | Add {-# INLINE instance #-} pragma which ensures that the dictionary function is inlined.
* [project @ 2001-02-26 15:06:57 by simonmar]simonmar2001-02-261-2/+1
| | | | | | | | | | | | | | | | | Implement do-style bindings on the GHCi command line. The syntax for a command-line is exactly that of a do statement, with the following meanings: - `pat <- expr' performs expr, and binds each of the variables in pat. - `let pat = expr; ...' binds each of the variables in pat, doesn't do any evaluation - `expr' behaves as `it <- expr' if expr is IO-typed, or `let it = expr' followed by `print it' otherwise.
* [project @ 2000-12-20 11:02:17 by simonpj]simonpj2000-12-201-5/+2
| | | | Add comments and tidy
* [project @ 2000-11-24 17:02:01 by simonpj]simonpj2000-11-241-12/+9
| | | | | | | | | | | | | 1. Make the new version machinery work. I think it does now! 2. Consequence of (1): Move the generation of default method names to one place (namely in RdrHsSyn.mkClassOpSigDM 3. Major clean up on HsDecls.TyClDecl These big constructors should have been records ages ago, and they are now. At last.
* [project @ 2000-11-10 15:12:50 by simonpj]simonpj2000-11-101-5/+7
| | | | | | | | | | | | | | 1. Outputable.PprStyle now carries a bit more information In particular, the printing style tells whether to print a name in unqualified form. This used to be embedded in a Name, but since Names now outlive a single compilation unit, that's no longer appropriate. So now the print-unqualified predicate is passed in the printing style, not embedded in the Name. 2. I tidied up HscMain a little. Many of the showPass messages have migraged into the repective pass drivers
* [project @ 2000-10-23 09:03:26 by simonpj]simonpj2000-10-231-1/+1
| | | | Mainly renamer
* [project @ 2000-10-12 15:17:55 by simonmar]simonmar2000-10-121-1/+2
| | | | isUnboundName moved
* [project @ 2000-10-03 08:43:00 by simonpj]simonpj2000-10-031-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -------------------------------------- Adding generics SLPJ Oct 2000 -------------------------------------- This big commit adds Hinze/PJ-style generic class definitions, based on work by Andrei Serjantov. For example: class Bin a where toBin :: a -> [Int] fromBin :: [Int] -> (a, [Int]) toBin {| Unit |} Unit = [] toBin {| a :+: b |} (Inl x) = 0 : toBin x toBin {| a :+: b |} (Inr y) = 1 : toBin y toBin {| a :*: b |} (x :*: y) = toBin x ++ toBin y fromBin {| Unit |} bs = (Unit, bs) fromBin {| a :+: b |} (0:bs) = (Inl x, bs') where (x,bs') = fromBin bs fromBin {| a :+: b |} (1:bs) = (Inr y, bs') where (y,bs') = fromBin bs fromBin {| a :*: b |} bs = (x :*: y, bs'') where (x,bs' ) = fromBin bs (y,bs'') = fromBin bs' Now we can say simply instance Bin a => Bin [a] and the compiler will derive the appropriate code automatically. (About 9k lines of diffs. Ha!) Generic related things ~~~~~~~~~~~~~~~~~~~~~~ * basicTypes/BasicTypes: The EP type (embedding-projection pairs) * types/TyCon: An extra field in an algebraic tycon (genInfo) * types/Class, and hsSyn/HsBinds: Each class op (or ClassOpSig) carries information about whether it a) has no default method b) has a polymorphic default method c) has a generic default method There's a new data type for this: Class.DefMeth * types/Generics: A new module containing good chunk of the generic-related code It has a .hi-boot file (alas). * typecheck/TcInstDcls, typecheck/TcClassDcl: Most of the rest of the generics-related code * hsSyn/HsTypes: New infix type form to allow types of the form data a :+: b = Inl a | Inr b * parser/Parser.y, Lex.lhs, rename/ParseIface.y: Deal with the new syntax * prelude/TysPrim, TysWiredIn: Need to generate generic stuff for the wired-in TyCons * rename/RnSource RnBinds: A rather gruesome hack to deal with scoping of type variables from a generic patterns. Details commented in the ClassDecl case of RnSource.rnDecl. Of course, there are many minor renamer consequences of the other changes above. * lib/std/PrelBase.lhs Data type declarations for Unit, :+:, :*: Slightly unrelated housekeeping ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * hsSyn/HsDecls: ClassDecls now carry the Names for their implied declarations (superclass selectors, tycon, etc) in a list, rather than laid out one by one. This simplifies code between the parser and the type checker. * prelude/PrelNames, TysWiredIn: All the RdrNames are now together in PrelNames. * utils/ListSetOps: Add finite mappings based on equality and association lists (Assoc a b) Move stuff from List.lhs that is related
* [project @ 2000-09-28 13:04:14 by simonpj]simonpj2000-09-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------ Mainly PredTypes (28 Sept 00) ------------------------------------ Three things in this commit: 1. Main thing: tidy up PredTypes 2. Move all Keys into PrelNames 3. Check for unboxed tuples in function args 1. Tidy up PredTypes ~~~~~~~~~~~~~~~~~~~~ The main thing in this commit is to modify the representation of Types so that they are a (much) better for the qualified-type world. This should simplify Jeff's life as he proceeds with implicit parameters and functional dependencies. In particular, PredType, introduced by Jeff, is now blessed and dignified with a place in TypeRep.lhs: data PredType = Class Class [Type] | IParam Name Type Consider these examples: f :: (Eq a) => a -> Int g :: (?x :: Int -> Int) => a -> Int h :: (r\l) => {r} => {l::Int | r} Here the "Eq a" and "?x :: Int -> Int" and "r\l" are all called *predicates*, and are represented by a PredType. (We don't support TREX records yet, but the setup is designed to expand to allow them.) In addition, Type gains an extra constructor: data Type = .... | PredTy PredType so that PredType is injected directly into Type. So the type p => t is represented by PredType p `FunTy` t I have deleted the hackish IPNote stuff; predicates are dealt with entirely through PredTys, not through NoteTy at all. 2. Move Keys into PrelNames ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is just a housekeeping operation. I've moved all the pre-assigned Uniques (aka Keys) from Unique.lhs into PrelNames.lhs. I've also moved knowKeyRdrNames from PrelInfo down into PrelNames. This localises in PrelNames lots of stuff about predefined names. Previously one had to alter three files to add one, now only one. 3. Unboxed tuples ~~~~~~~~~~~~~~~~~~ Add a static check for unboxed tuple arguments. E.g. data T = T (# Int, Int #) is illegal
* [project @ 2000-08-01 09:08:25 by simonpj]simonpj2000-08-011-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Simon's Marktoberdorf Commits 1. Tidy up the renaming story for "system binders", such as dictionary functions, default methods, constructor workers etc. These are now documented in HsDecls. The main effect of the change, apart from tidying up, is to make the *type-checker* (instead of the renamer) generate names for dict-funs and default-methods. This is good because Sergei's generic-class stuff generates new classes at typecheck time. 2. Fix the CSE pass so it does not require the no-shadowing invariant. Keith discovered that the simplifier occasionally returns a result with shadowing. After much fiddling around (which has improved the code in the simplifier a bit) I found that it is nearly impossible to arrange that it really does do no-shadowing. So I gave up and fixed the CSE pass (which is the only one to rely on it) instead. 3. Fix a performance bug in the simplifier. The change is in SimplUtils.interestingArg. It computes whether an argment should be considered "interesting"; if a function is applied to an interesting argument, we are more likely to inline that function. Consider this case let x = 3 in f x The 'x' argument was considered "uninteresting" for a silly reason. Since x only occurs once, it was unconditionally substituted, but interestingArg didn't take account of that case. Now it does. I also made interestingArg a bit more liberal. Let's see if we get too much inlining now. 4. In the occurrence analyser, we were choosing a bad loop breaker. Here's the comment that's now in OccurAnal.reOrderRec score ((bndr, rhs), _, _) | exprIsTrivial rhs = 3 -- Practically certain to be inlined -- Used to have also: && not (isExportedId bndr) -- But I found this sometimes cost an extra iteration when we have -- rec { d = (a,b); a = ...df...; b = ...df...; df = d } -- where df is the exported dictionary. Then df makes a really -- bad choice for loop breaker I also increased the score for bindings with a non-functional type, so that dictionaries have a better chance of getting inlined early 5. Add a hash code to the InScopeSet (and make it properly abstract) This should make uniqAway a lot more robust. Simple experiments suggest that uniqAway no longer gets into the long iteration chains that it used to. 6. Fix a bug in the inliner that made the simplifier tend to get into a loop where it would keep iterating ("4 iterations, bailing out" message). In SimplUtils.mkRhsTyLam we float bindings out past a big lambda, thus: x = /\ b -> let g = \x -> f x x in E becomes g* = /\a -> \x -> f x x x = /\ b -> let g = g* b in E It's essential that we don't simply inling g* back into the RHS of g, else we will be back to square 1. The inliner is meant not to do this because there's no benefit to the inlining, but the size calculation was a little off in CoreUnfold. 7. In SetLevels we were bogus-ly building a Subst with an empty in-scope set, so a WARNING popped up when compiling some modules. (knights/ChessSetList was the example that tickled it.) Now in fact the warning wasn't an error, but the Right Thing to do is to carry down a proper Subst in SetLevels, so that is what I have now done. It is very little more expensive.
* [project @ 2000-07-11 16:12:11 by simonmar]simonmar2000-07-111-5/+0
| | | | remove unused imports
* [project @ 2000-05-25 12:41:14 by simonpj]simonpj2000-05-251-62/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ~~~~~~~~~~~~ Apr/May 2000 ~~~~~~~~~~~~ This is a pretty big commit! It adds stuff I've been working on over the last month or so. DO NOT MERGE IT WITH 4.07! Interface file formats have changed a little; you'll need to make clean before remaking. Simon PJ Recompilation checking ~~~~~~~~~~~~~~~~~~~~~~ Substantial improvement in recompilation checking. The version management is now entirely internal to GHC. ghc-iface.lprl is dead! The trick is to generate the new interface file in two steps: - first convert Types etc to HsTypes etc, and thereby build a new ParsedIface - then compare against the parsed (but not renamed) version of the old interface file Doing this meant adding code to convert *to* HsSyn things, and to compare HsSyn things for equality. That is the main tedious bit. Another improvement is that we now track version info for fixities and rules, which was missing before. Interface file reading ~~~~~~~~~~~~~~~~~~~~~~ Make interface files reading more robust. * If the old interface file is unreadable, don't fail. [bug fix] * If the old interface file mentions interfaces that are unreadable, don't fail. [bug fix] * When we can't find the interface file, print the directories we are looking in. [feature] Type signatures ~~~~~~~~~~~~~~~ * New flag -ddump-types to print type signatures Type pruning ~~~~~~~~~~~~ When importing data T = T1 A | T2 B | T3 C it seems excessive to import the types A, B, C as well, unless the constructors T1, T2 etc are used. A,B,C might be more types, and importing them may mean reading more interfaces, and so on. So the idea is that the renamer will just import the decl data T unless one of the constructors is used. This turns out to be quite easy to implement. The downside is that we must make sure the constructors are always available if they are really needed, so I regard this as an experimental feature. Elimininate ThinAir names ~~~~~~~~~~~~~~~~~~~~~~~~~ Eliminate ThinAir.lhs and all its works. It was always a hack, and now the desugarer carries around an environment I think we can nuke ThinAir altogether. As part of this, I had to move all the Prelude RdrName defns from PrelInfo to PrelMods --- so I renamed PrelMods as PrelNames. I also had to move the builtinRules so that they are injected by the renamer (rather than appearing out of the blue in SimplCore). This is if anything simpler. Miscellaneous ~~~~~~~~~~~~~ * Tidy up the data types involved in Rules * Eliminate RnEnv.better_provenance; use Name.hasBetterProv instead * Add Unique.hasKey :: Uniquable a => a -> Unique -> Bool It's useful in a lot of places * Fix a bug in interface file parsing for __U[!]
* [project @ 2000-05-23 11:35:36 by simonpj]simonpj2000-05-231-5/+9
| | | | | | | | | | | | | | | | | | | | | | | *** MERGE WITH 4.07 (once I've checked it works) *** * Fix result type signatures. Note that a consequential change is that an ordinary binding with a variable on the left f = e is now treated as a FunMonoBind, not a PatMonoBind. This makes a few things a bit simpler (eg rnMethodBinds) * Fix warnings for unused imports. This meant moving where provenances are improved in RnNames. Move mkExportAvails from RnEnv to RnNames. * Print module names right (small change in Module.lhs and Rename.lhs) * Remove a few unused bindings * Add a little hack to let us print info about join points that turn out not to be let-no-escaped. The idea is to call them "$j" and report any such variables that are not let-no-escaped. * Some small things aiming towards -ddump-types (harmless but incomplete)
* [project @ 2000-04-03 09:52:28 by simonpj]simonpj2000-04-031-13/+88
| | | | | | | | | | | | | | | | | | | * Make it so that recursive newtype declarations don't send GHC into an infinite loop. newtype T = MkT T This happened because Type.repType looked throught newtypes, and that never stopped! Now TcTyDecls.mkNewTyConRep does the job more carefully, and the result is cached in the TyCon itself. * Improve the handling of type signatures & pragmas. Previously a mis-placed (say) SPECIALISE instance pragmas could be silently ignored. Both these changes involved moving quite a lot of stuff between modules.
* [project @ 2000-03-23 17:45:17 by simonpj]simonpj2000-03-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This utterly gigantic commit is what I've been up to in background mode in the last couple of months. Originally the main goal was to get rid of Con (staturated constant applications) in the CoreExpr type, but one thing led to another, and I kept postponing actually committing. Sorry. Simon, 23 March 2000 I've tested it pretty thoroughly, but doubtless things will break. Here are the highlights * Con is gone; the CoreExpr type is simpler * NoRepLits have gone * Better usage info in interface files => less recompilation * Result type signatures work * CCall primop is tidied up * Constant folding now done by Rules * Lots of hackery in the simplifier * Improvements in CPR and strictness analysis Many bug fixes including * Sergey's DoCon compiles OK; no loop in the strictness analyser * Volker Wysk's programs don't crash the CPR analyser I have not done much on measuring compilation times and binary sizes; they could have got worse. I think performance has got significantly better, though, in most cases. Removing the Con form of Core expressions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The big thing is that For every constructor C there are now *two* Ids: C is the constructor's *wrapper*. It evaluates and unboxes arguments before calling $wC. It has a perfectly ordinary top-level defn in the module defining the data type. $wC is the constructor's *worker*. It is like a primop that simply allocates and builds the constructor value. Its arguments are the actual representation arguments of the constructor. Its type may be different to C, because: - useless dict args are dropped - strict args may be flattened For every primop P there is *one* Id, its (curried) Id Neither contructor worker Id nor the primop Id have a defminition anywhere. Instead they are saturated during the core-to-STG pass, and the code generator generates code for them directly. The STG language still has saturated primops and constructor applications. * The Const type disappears, along with Const.lhs. The literal part of Const.lhs reappears as Literal.lhs. Much tidying up in here, to bring all the range checking into this one module. * I got rid of NoRep literals entirely. They just seem to be too much trouble. * Because Con's don't exist any more, the funny C { args } syntax disappears from inteface files. Parsing ~~~~~~~ * Result type signatures now work f :: Int -> Int = \x -> x -- The Int->Int is the type of f g x y :: Int = x+y -- The Int is the type of the result of (g x y) Recompilation checking and make ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * The .hi file for a modules is not touched if it doesn't change. (It used to be touched regardless, forcing a chain of recompilations.) The penalty for this is that we record exported things just as if they were mentioned in the body of the module. And the penalty for that is that we may recompile a module when the only things that have changed are the things it is passing on without using. But it seems like a good trade. * -recomp is on by default Foreign declarations ~~~~~~~~~~~~~~~~~~~~ * If you say foreign export zoo :: Int -> IO Int then you get a C produre called 'zoo', not 'zzoo' as before. I've also added a check that complains if you export (or import) a C procedure whose name isn't legal C. Code generation and labels ~~~~~~~~~~~~~~~~~~~~~~~~~~ * Now that constructor workers and wrappers have distinct names, there's no need to have a Foo_static_closure and a Foo_closure for constructor Foo. I nuked the entire StaticClosure story. This has effects in some of the RTS headers (i.e. s/static_closure/closure/g) Rules, constant folding ~~~~~~~~~~~~~~~~~~~~~~~ * Constant folding becomes just another rewrite rule, attached to the Id for the PrimOp. To achieve this, there's a new form of Rule, a BuiltinRule (see CoreSyn.lhs). The prelude rules are in prelude/PrelRules.lhs, while simplCore/ConFold.lhs has gone. * Appending of constant strings now works, using fold/build fusion, plus the rewrite rule unpack "foo" c (unpack "baz" c n) = unpack "foobaz" c n Implemented in PrelRules.lhs * The CCall primop is tidied up quite a bit. There is now a data type CCall, defined in PrimOp, that packages up the info needed for a particular CCall. There is a new Id for each new ccall, with an big "occurrence name" {__ccall "foo" gc Int# -> Int#} In interface files, this is parsed as a single Id, which is what it is, really. Miscellaneous ~~~~~~~~~~~~~ * There were numerous places where the host compiler's minInt/maxInt was being used as the target machine's minInt/maxInt. I nuked all of these; everything is localised to inIntRange and inWordRange, in Literal.lhs * Desugaring record updates was broken: it didn't generate correct matches when used withe records with fancy unboxing etc. It now uses matchWrapper. * Significant tidying up in codeGen/SMRep.lhs * Add __word, __word64, __int64 terminals to signal the obvious types in interface files. Add the ability to print word values in hex into C code. * PrimOp.lhs is no longer part of a loop. Remove PrimOp.hi-boot* Types ~~~~~ * isProductTyCon no longer returns False for recursive products, nor for unboxed products; you have to test for these separately. There's no reason not to do CPR for recursive product types, for example. Ditto splitProductType_maybe. Simplification ~~~~~~~~~~~~~~~ * New -fno-case-of-case flag for the simplifier. We use this in the first run of the simplifier, where it helps to stop messing up expressions that the (subsequent) full laziness pass would otherwise find float out. It's much more effective than previous half-baked hacks in inlining. Actually, it turned out that there were three places in Simplify.lhs that needed to know use this flag. * Make the float-in pass push duplicatable bindings into the branches of a case expression, in the hope that we never have to allocate them. (see FloatIn.sepBindsByDropPoint) * Arrange that top-level bottoming Ids get a NOINLINE pragma This reduced gratuitous inlining of error messages. But arrange that such things still get w/w'd. * Arrange that a strict argument position is regarded as an 'interesting' context, so that if we see foldr k z (g x) then we'll be inclined to inline g; this can expose a build. * There was a missing case in CoreUtils.exprEtaExpandArity that meant we were missing some obvious cases for eta expansion Also improve the code when handling applications. * Make record selectors (identifiable by their IdFlavour) into "cheap" operations. [The change is a 2-liner in CoreUtils.exprIsCheap] This means that record selection may be inlined into function bodies, which greatly improves the arities of overloaded functions. * Make a cleaner job of inlining "lone variables". There was some distributed cunning, but I've centralised it all now in SimplUtils.analyseCont, which analyses the context of a call to decide whether it is "interesting". * Don't specialise very small functions in Specialise.specDefn It's better to inline it. Rather like the worker/wrapper case. * Be just a little more aggressive when floating out of let rhss. See comments with Simplify.wantToExpose A small change with an occasional big effect. * Make the inline-size computation think that case x of I# x -> ... is *free*. CPR analysis ~~~~~~~~~~~~ * Fix what was essentially a bug in CPR analysis. Consider letrec f x = let g y = let ... in f e1 in if ... then (a,b) else g x g has the CPR property if f does; so when generating the final annotated RHS for f, we must use an envt in which f is bound to its final abstract value. This wasn't happening. Instead, f was given the CPR tag but g wasn't; but of course the w/w pass gives rotten results in that case!! (Because f's CPR-ness relied on g's.) On they way I tidied up the code in CprAnalyse. It's quite a bit shorter. The fact that some data constructors return a constructed product shows up in their CPR info (MkId.mkDataConId) not in CprAnalyse.lhs Strictness analysis and worker/wrapper ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * BIG THING: pass in the demand to StrictAnal.saExpr. This affects situations like f (let x = e1 in (x,x)) where f turns out to have strictness u(SS), say. In this case we can mark x as demanded, and use a case expression for it. The situation before is that we didn't "know" that there is the u(SS) demand on the argument, so we simply computed that the body of the let expression is lazy in x, and marked x as lazily-demanded. Then even after f was w/w'd we got let x = e1 in case (x,x) of (a,b) -> $wf a b and hence let x = e1 in $wf a b I found a much more complicated situation in spectral/sphere/Main.shade, which improved quite a bit with this change. * Moved the StrictnessInfo type from IdInfo to Demand. It's the logical place for it, and helps avoid module loops * Do worker/wrapper for coerces even if the arity is zero. Thus: stdout = coerce Handle (..blurg..) ==> wibble = (...blurg...) stdout = coerce Handle wibble This is good because I found places where we were saying case coerce t stdout of { MVar a -> ... case coerce t stdout of { MVar b -> ... and the redundant case wasn't getting eliminated because of the coerce.
* [project @ 2000-02-25 14:55:31 by panne]panne2000-02-251-22/+27
| | | | | | | | Deprecations of variables now works, although the source location is not yet reported correctly and the code needs some cleanup. Added a new flag -fwarn-deprecations to the set of standard warnings. The syntax of deprecations has been extended to deprecate types, classes, or even constructors, although this does not work yet.
* [project @ 2000-02-20 17:51:30 by panne]panne2000-02-201-14/+22
| | | | Get deprecation info out of the renamer again
* [project @ 2000-02-17 14:47:21 by panne]panne2000-02-171-3/+4
| | | | | | Result of my daily DEPRECATED-hour: Now it's possible to use the pragma without harm, but nothing spectacular happens yet, only the usual renamer checks (duplication, var in scope).
* [project @ 2000-02-16 12:57:39 by panne]panne2000-02-161-1/+1
| | | | Fixed pretty printing of DEPRECATED
* [project @ 2000-02-15 22:18:16 by panne]panne2000-02-151-2/+12
| | | | | | | | | | | | | | | | | | | | First steps towards DEPRECATED before Rosebank (12yrs) takes its toll. Nothing very functional yet, but at least hsc can be compiled and it still compiles the Prelude. Parsing the pragma turned out to be a little bit more complicated than expected, here the comment from Parser.y: The place for module deprecation is really too restrictive, but if it was allowed at its natural place just before 'module', we get an ugly s/r conflict with the second alternative. Another solution would be the introduction of a new pragma DEPRECATED_MODULE, but this is not very nice, either, and DEPRECATED is only expected to be used by people who really know what they are doing. :-) Net result: Module deprecation is allowed exactly behind the module's name and nowhere else. I probably have to think a little bit more about this some day...
* [project @ 1999-12-06 15:38:05 by simonpj]simonpj1999-12-061-3/+18
| | | | | | | Some minor tidying-up that should remove an occurrence of an empty Let Rec that confused CoreLint.dumpLoc. Simon
* [project @ 1999-11-29 17:34:14 by simonpj]simonpj1999-11-291-5/+7
| | | | | | | | | | | | | | | | | | | | Make it so that a class decl generates default method decls for every method, not just for the ones that the user supplies default-methods for. GHC will never call these default-default methods, because when it finds an instance decl with no defn for a method, *and* the class decl doesn't have a user-programmed default method, it whips up a new default method for that instance decl so that the error message is more informative than the default-default method would be. But Hugs isn't so smart, and wants to call something from the class decl. This change required fiddling with more than I expected. Sigh. Simon
* [project @ 1999-11-01 17:09:54 by simonpj]simonpj1999-11-011-11/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A regrettably-gigantic commit that puts in place what Simon PJ has been up to for the last month or so, on and off. The basic idea was to restore unfoldings to *occurrences* of variables without introducing a space leak. I wanted to make sure things improved relative to 4.04, and that proved depressingly hard. On the way I discovered several quite serious bugs in the simplifier. Here's a summary of what's gone on. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * No commas between for-alls in RULES. This makes the for-alls have the same syntax as in types. * Arrange that simplConArgs works in one less pass than before. This exposed a bug: a bogus call to completeBeta. * Add a top-level flag in CoreUnfolding, used in callSiteInline * Extend w/w to use etaExpandArity, so it does eta/coerce expansion * Implement inline phases. The meaning of the inline pragmas is described in CoreUnfold.lhs. You can say things like {#- INLINE 2 build #-} to mean "inline build in phase 2" * Don't float anything out of an INLINE. Don't float things to top level unless they also escape a value lambda. [see comments with SetLevels.lvlMFE Without at least one of these changes, I found that {-# INLINE concat #-} concat = __inline (/\a -> foldr (++) []) was getting floated to concat = __inline( /\a -> lvl a ) lvl = ...inlined version of foldr... Subsequently I found that not floating constants out of an INLINE gave really bad code like __inline (let x = e in \y -> ...) so I now let things float out of INLINE * Implement the "reverse-mapping" idea for CSE; actually it turned out to be easier to implement it in SetLevels, and may benefit full laziness too. * It's a good idea to inline inRange. Consider index (l,h) i = case inRange (l,h) i of True -> l+i False -> error inRange itself isn't strict in h, but if it't inlined then 'index' *does* become strict in h. Interesting! * Big change to the way unfoldings and occurrence info is propagated in the simplifier The plan is described in Subst.lhs with the Subst type Occurrence info is now in a separate IdInfo field than user pragmas * I found that (coerce T (coerce S (\x.e))) y didn't simplify in one round. First we get to (\x.e) y and only then do the beta. Solution: cancel the coerces in the continuation * Amazingly, CoreUnfold wasn't counting the cost of a function an application. * Disable rules in initial simplifier run. Otherwise full laziness doesn't get a chance to lift out a MFE before a rule (e.g. fusion) zaps it. queens is a case in point * Improve float-out stuff significantly. The big change is that if we have \x -> ... /\a -> ...let p = ..a.. in let q = ...p... where p's rhs doesn't x, we abstract a from p, so that we can get p past x. (We did that before.) But we also substitute (p a) for p in q, and then we can do the same thing for q. (We didn't do that, so q got stuck.) This is much better. It involves doing a substitution "as we go" in SetLevels, though.
* [project @ 1999-06-22 16:32:42 by simonpj]simonpj1999-06-221-0/+8
| | | | Add HsBinds.isPragSig
* [project @ 1999-06-08 16:46:44 by simonpj]simonpj1999-06-081-1/+1
| | | | Small fixes, including a significant full-laziness bug in OccurAnal
* [project @ 1999-05-18 15:03:54 by simonpj]simonpj1999-05-181-14/+13
| | | | RULES-NOTES
* [project @ 1999-04-27 17:33:49 by sof]sof1999-04-271-5/+7
| | | | | | | | | | | | | | | | | | | | | Renamer changes: - for a toplevel type signature f :: ty the name 'f' refers to a local definition of 'f' - i.e., don't report 'f' as clashing with any imported 'f's. - tidied up the handling of fixity declarations - misplaced fixity declarations inside class decls, e.g., class F a where infix 9 `f` g :: a -> Int are now caught and reported as errors. Robustified the renaming of class decls.
* [project @ 1999-01-27 14:51:14 by simonpj]simonpj1999-01-271-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Finally! This commits the ongoing saga of Simon's hygiene sweep FUNCTIONALITY ~~~~~~~~~~~~~ a) The 'unused variable' warnings from the renamer work. b) Better error messages here and there, esp type checker c) Fixities for Haskell 98 (maybe I'd done that before) d) Lazy reporting of name clashes for Haskell 98 (ditto) HYGIENE ~~~~~~~ a) type OccName has its own module. OccNames are represented by a single FastString, not three as in the last round. This string is held in Z-encoded form; a decoding function decodes for printing in user error messages. There's a nice tight encoding for (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) b) type Module is a proper ADT, in module OccName c) type RdrName is a proper ADT, in its own module d) type Name has a new, somwhat tidier, representation e) much grunting in the renamer to get Provenances right. This makes error messages look better (no spurious qualifiers)
* [project @ 1998-12-18 17:40:31 by simonpj]simonpj1998-12-181-42/+57
| | | | | | | | | | | | | | | | | | | | | Another big commit from Simon. Actually, the last one didn't all go into the main trunk; because of a CVS glitch it ended up in the wrong branch. So this commit includes: * Scoped type variables * Warnings for unused variables should work now (they didn't before) * Simplifier improvements: - Much better treatment of strict arguments - Better treatment of bottoming Ids - No need for w/w split for fns that are merely strict - Fewer iterations needed, I hope * Less gratuitous renaming in interface files and abs C * OccName is a separate module, and is an abstract data type I think the whole Prelude and Exts libraries compile correctly. Something isn't quite right about typechecking existentials though.
* [project @ 1998-12-02 13:17:09 by simonm]simonm1998-12-021-6/+10
| | | | Move 4.01 onto the main trunk.
* [project @ 1998-05-22 15:23:11 by simonm]simonm1998-05-221-5/+12
| | | | | | | | | | | | | Add NOINLINE pragma. - add new type of inline info: IDontWantToBeINLINEd - hopefully get the interactions between IMustNotBeINLINEd (which is used by the simplifier to ensure termination when simplifying recursive binding groups) and IDontWantToBeINLINEd. - no need to pass NOINLINE across modules, we just make sure that any function marked as NOLINE doesn't get an unfolding in the interface.
* [project @ 1998-04-06 18:38:36 by sof]sof1998-04-061-6/+17
| | | | Misc changes by Simon to emit and handle cross-module specialisations
* [project @ 1998-02-03 17:13:54 by simonm]simonm1998-02-031-2/+1
| | | | | | | | - Fixes for bootstrapping with 3.01. - Use 'official' extension interfaces rather than internal prelude modules (such as ArrBase) where possible. - Remove some cruft. - Delete some unused imports found by '-fwarn-unused-imports'.
* [project @ 1998-01-08 18:03:08 by simonm]simonm1998-01-081-99/+76
| | | | | | | | | | | | | | | | | | | The Great Multi-Parameter Type Classes Merge. Notes from Simon (abridged): * Multi-parameter type classes are fully implemented. * Error messages from the type checker should be noticeably improved * Warnings for unused bindings (-fwarn-unused-names) * many other minor bug fixes. Internally there are the following changes * Removal of Haskell 1.2 compatibility. * Dramatic clean-up of the PprStyle stuff. * The type Type has been substantially changed. * The dictionary for each class is represented by a new data type for that purpose, rather than by a tuple.
* [project @ 1997-09-24 09:08:21 by simonm]simonm1997-09-241-6/+0
| | | | Remove deforester
* [project @ 1997-07-05 03:02:04 by sof]sof1997-07-051-1/+1
| | | | Changes through ID4
* [project @ 1997-06-20 00:33:36 by simonpj]simonpj1997-06-201-3/+3
| | | | More small changes to 2.04
* [project @ 1997-06-18 23:52:36 by simonpj]simonpj1997-06-181-10/+8
| | | | A raft of small bug-fixes to 2.05 by SLPJ
* [project @ 1997-06-06 22:27:06 by sof]sof1997-06-061-3/+6
| | | | last minute 2.04 fixes
* [project @ 1997-06-05 20:59:36 by sof]sof1997-06-051-2/+8
| | | | import updates
* [project @ 1997-05-26 04:42:21 by sof]sof1997-05-261-60/+34
| | | | removed : collectTopBinders, collectMonoBinders (now in HsSyn); improved ppr; updated imports
* [project @ 1997-05-19 00:12:10 by sof]sof1997-05-191-158/+118
| | | | 2.04 changes
* [project @ 1997-03-14 07:52:06 by simonpj]simonpj1997-03-141-13/+39
| | | | Major update to more-or-less 2.02
* [project @ 1997-01-07 01:17:30 by simonpj]simonpj1997-01-071-4/+4
| | | | Bug fixes to pragmas
* [project @ 1996-12-19 09:10:02 by simonpj]simonpj1996-12-191-50/+38
| | | | SLPJ new renamer and lots more
* [project @ 1996-06-26 10:26:00 by partain]partain1996-06-261-1/+1
| | | | SLPJ 1.3 changes through 96/06/25
* [project @ 1996-06-05 06:44:31 by partain]partain1996-06-051-2/+2
| | | | SLPJ changes through 960604
* [project @ 1996-04-20 10:37:06 by partain]partain1996-04-201-9/+9
| | | | SLPJ 1.3 changes through 960419
* [project @ 1996-04-09 10:27:46 by partain]partain1996-04-091-3/+5
| | | | Sansom 1.3 changes through 960408