- 25 Jun, 2001 1 commit
-
-
simonpj authored
---------------------------------- Fix a predicate-simplification bug ---------------------------------- Fixes a bug pointed out by Marcin data R = R {f :: Int} foo:: (?x :: Int) => R -> R foo r = r {f = ?x} Test.hs:4: Could not deduce `?x :: Int' from the context () arising from use of implicit parameter `?x' at Test.hs:4 In the record update: r {f = ?x} In the definition of `foo': r {f = ?x} The predicate simplifier was declining to 'inherit' an implicit parameter. This is right for a let-binding, but wrong for an expression binding. For example, a simple expression type signature: (?x + 1) :: Int This was rejected because the ?x constraint could not be floated out -- but that's wrong for expressions.
-
- 03 May, 2001 3 commits
-
-
simonpj authored
**** MERGE WITH 5.00 BRANCH ******** -------------------------------- Monomorphism restriction for implicit parameters -------------------------------- This commit tidies up the way in which monomorphic bindings are dealt with, incidentally fixing a bug to do with implicit parameters. The tradeoffs concerning monomorphism and implicit paramters are now documented in TcSimplify.lhs, and all the strategic choices are made there (rather than in TcBinds where they were before). I've continued with choice (B) -- which Jeff first implemented -- because that's what Hugs does, lacking any other consensus.
-
simonpj authored
------------------------------------------------ Dramatically improve the error messages arising from failed unifications triggered by 'improvement' ------------------------------------------------ A bit more plumbing in FunDeps, and consequential wibbles elsewhere Changes this: Couldn't match `Int' against `[(String, Int)]' Expected type: Int Inferred type: [(String, Int)] to this: Foo.hs:8: Couldn't match `Int' against `[(String, Int)]' Expected type: Int Inferred type: [(String, Int)] When using functional dependencies to combine ?env :: Int, arising from a type signature at Foo.hs:7 ?env :: [(String, Int)], arising from use of implicit parameter `?env' at Foo.hs:8 When generalising the types for ident
-
simonpj authored
**** MERGE WITH 5.00 BRANCH ******** -------------------------------- Fix a bad implicit parameter bug -------------------------------- TcSimplify.tcSimplifyIPs was just completely wrong; it wasn't doing improvement properly nor binding values properly. Sigh. To make this work nicely I added Inst.instName :: Inst -> Name
-
- 30 Apr, 2001 1 commit
-
-
simonpj authored
Add comments
-
- 12 Apr, 2001 1 commit
-
-
lewie authored
Don't use the same simplify code for both restricted and unrestricted bindings. In particular, a restricted binding shouldn't try to capture implicit params.
-
- 05 Apr, 2001 1 commit
-
-
simonpj authored
Improve error reporting
-
- 13 Mar, 2001 1 commit
-
-
simonpj authored
---------------- Nuke ClassContext ---------------- This commit tidies up a long-standing inconsistency in GHC. The context of a class or instance decl used to be restricted to predicates of the form C t1 .. tn with type ClassContext = [(Class,[Type])] but everywhere else in the compiler we used type ThetaType = [PredType] where PredType can be any sort of constraint (= predicate). The inconsistency actually led to a crash, when compiling class (?x::Int) => C a where {} I've tidied all this up by nuking ClassContext altogether, and using PredType throughout. Lots of modified files, but all in more-or-less trivial ways. I've also added a check that the context of a class or instance decl doesn't include a non-inheritable predicate like (?x::Int). Other things * rename constructor 'Class' from type TypeRep.Pred to 'ClassP' (makes it easier to grep for) * rename constructor HsPClass => HsClassP HsPIParam => HsIParam
-
- 28 Feb, 2001 1 commit
-
-
simonpj authored
Improve rule matching When doing constraint simplification on the LHS of a rule, we *don't* want to do superclass commoning up. Consider fromIntegral :: (Integral a, Num b) => a -> b {-# RULES "foo" fromIntegral = id :: Int -> Int #-} Here, a=b=Int, and Num Int is a superclass of Integral Int. But we *dont* want to get forall dIntegralInt. fromIntegral Int Int dIntegralInt (scsel dIntegralInt) = id Int because the scsel (super class selection) will mess up matching. Instead we want forall dIntegralInt, dNumInt. fromIntegral Int Int dIntegralInt dNumInt = id Int TcSimplify.tcSimplifyToDicts is the relevant function, but I had to generalise the main simplification loop a little (adding the type WantSCs).
-
- 26 Feb, 2001 1 commit
-
-
simonmar authored
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.
-
- 20 Feb, 2001 1 commit
-
-
simonpj authored
Typechecking [TcModule, TcBinds, TcHsSyn, TcInstDcls, TcSimplify] ~~~~~~~~~~~~ * Fix a bug in TcSimplify that broke functional dependencies. Interleaving unification and context reduction is trickier than I thought. Comments in the code amplify. * Fix a functional-dependency bug, that meant that this pgm: class C a b | a -> b where f :: a -> b g :: (C a b, Eq b) => a -> Bool g x = f x == f x gave an ambiguity error report. I'm afraid I've forgotten what the problem was. * Correct the implementation of the monomorphism restriction, in TcBinds.generalise. This fixes Marcin's bug report: test1 :: Eq a => a -> b -> b test1 x y = y test2 = test1 (3::Int) Previously we were erroneously inferring test2 :: () -> () * Make the "unf_env" that is looped round in TcModule go round in a big loop, not just round tcImports. This matters when we have mutually recursive modules, so that the Ids bound in the source code may appear in the imports. Sigh. But no big deal. It does mean that you have to be careful not to call isLocalId, isDataConId etc, because they consult the IdInfo of an Id, which in turn may be determined by the loop-tied unf_env.
-
- 30 Jan, 2001 1 commit
-
-
simonpj authored
More on functional dependencies My last commit allowed this: instance C a b => C [a] [b] where ... if we have class C a b | a -> b This commit completes the change, by making the improvement stages improve only the 'shape' of the second argument of C. I also had to change the iteration in TcSimplify -- see the comments in TcSimplify.inferLoop.
-
- 29 Jan, 2001 1 commit
-
-
simonpj authored
Fix superclass bug in context reduction (gave infinite loops before!)
-
- 26 Jan, 2001 1 commit
-
-
qrczak authored
Fix typos in comments.
-
- 25 Jan, 2001 1 commit
-
-
simonpj authored
------------------------------------ Mainly FunDeps (23 Jan 01) ------------------------------------ This commit re-engineers the handling of functional dependencies. A functional dependency is no longer an Inst; instead, the necessary dependencies are snaffled out of their Class when necessary. As part of this exercise I found that I had to re-work how to do generalisation in a binding group. There is rather exhaustive documentation on the new Plan at the top of TcSimplify. ****************** WARNING: I have compiled all the libraries with this new compiler and all looks well, but I have not run many programs. Things may break. Let me know if so. ****************** The main changes are these: 1. typecheck/TcBinds and TcSimplify have a lot of changes due to the new generalisation and context reduction story. There are extensive comments at the start of TcSimplify 2. typecheck/TcImprove is removed altogether. Instead, improvement is interleaved with context reduction (until a fixpoint is reached). All this is done in TcSimplify. 3. types/FunDeps has new exports * 'improve' does improvement, returning a list of equations * 'grow' and 'oclose' close a list of type variables wrt a set of PredTypes, but in slightly different ways. Comments in file. 4. I improved the way in which we check that main::IO t. It's tidier now. In addition * typecheck/TcMatches: a) Tidy up, introducing a common function tcCheckExistentialPat b) Improve the typechecking of parallel list comprehensions, which wasn't quite right before. (see comments with tcStmts) WARNING: (b) is untested! Jeff, you might want to check. * Numerous other incidental changes in the typechecker * Manuel found that rules don't fire well when you have partial applications from overloading. For example, we may get f a (d::Ord a) = let m_g = g a d in \y :: a -> ...(m_g (h y))... The 'method' m_g doesn't get inlined because (g a d) might be a redex. Yet a rule that looks like g a d (h y) = ... won't fire because that doesn't show up. One way out would be to make the rule matcher a bit less paranoid about duplicating work, but instead I've added a flag -fno-method-sharing which controls whether we generate things like m_g in the first place. It's not clear that they are a win in the first place. The flag is actually consulted in Inst.tcInstId
-
- 03 Jan, 2001 1 commit
-
-
simonpj authored
Remove bogus zonkInst
-
- 14 Nov, 2000 1 commit
-
-
simonpj authored
Compiles now
-
- 13 Nov, 2000 1 commit
-
-
simonmar authored
merge rev. 1.46.2.3 from ghc-4-07-branch (fix line numbers in defaulting warnings).
-
- 10 Nov, 2000 1 commit
-
-
simonpj authored
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
-
- 23 Oct, 2000 1 commit
-
-
sewardj authored
Track renaming of typecheck/TcInstUtil to types/InstEnv.
-
- 17 Oct, 2000 1 commit
-
-
simonmar authored
Flags hacking: - `dopt_GlasgowExts' is now written `dopt Opt_GlasgowExts' - convert all the warning options into DynFlags
-
- 16 Oct, 2000 1 commit
-
-
sewardj authored
Mostly typechecker stuff.
-
- 12 Oct, 2000 1 commit
-
-
simonpj authored
Simons work, mainly on the type checker
-
- 03 Oct, 2000 1 commit
-
-
simonpj authored
-------------------------------------- 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
-
- 22 Sep, 2000 1 commit
-
-
simonpj authored
-------------------------------------------------- Tidying up HsLit, and making it possible to define your own numeric library Simon PJ 22 Sept 00 -------------------------------------------------- ** NOTE: I did these changes on the aeroplane. They should compile, and the Prelude still compiles OK, but it's entirely possible that I've broken something The original reason for this many-file but rather shallow commit is that it's impossible in Haskell to write your own numeric library. Why? Because when you say '1' you get (Prelude.fromInteger 1), regardless of what you hide from the Prelude, or import from other libraries you have written. So the idea is to extend the -fno-implicit-prelude flag so that in addition to no importing the Prelude, you can rebind fromInteger -- Applied to literal constants fromRational -- Ditto negate -- Invoked by the syntax (-x) the (-) used when desugaring n+k patterns After toying with other designs, I eventually settled on a simple, crude one: rather than adding a new flag, I just extended the semantics of -fno-implicit-prelude so that uses of fromInteger, fromRational and negate are all bound to "whatever is in scope" rather than "the fixed Prelude functions". So if you say {-# OPTIONS -fno-implicit-prelude #-} module M where import MyPrelude( fromInteger ) x = 3 the literal 3 will use whatever (unqualified) "fromInteger" is in scope, in this case the one gotten from MyPrelude. On the way, though, I studied how HsLit worked, and did a substantial tidy up, deleting quite a lot of code along the way. In particular. * HsBasic.lhs is renamed HsLit.lhs. It defines the HsLit type. * There are now two HsLit types, both defined in HsLit. HsLit for non-overloaded literals (like 'x') HsOverLit for overloaded literals (like 1 and 2.3) * HsOverLit completely replaces Inst.OverloadedLit, which disappears. An HsExpr can now be an HsOverLit as well as an HsLit. * HsOverLit carries the Name of the fromInteger/fromRational operation, so that the renamer can help with looking up the unqualified name when -fno-implicit-prelude is on. Ditto the HsExpr for negation. It's all very tidy now. * RdrHsSyn contains the stuff that handles -fno-implicit-prelude (see esp RdrHsSyn.prelQual). RdrHsSyn also contains all the "smart constructors" used by the parser when building HsSyn. See for example RdrHsSyn.mkNegApp (previously the renamer (!) did the business of turning (- 3#) into -3#). * I tidied up the handling of "special ids" in the parser. There's much less duplication now. * Move Sven's Horner stuff to the desugarer, where it belongs. There's now a nice function DsUtils.mkIntegerLit which brings together related code from no fewer than three separate places into one single place. Nice! * A nice tidy-up in MatchLit.partitionEqnsByLit became possible. * Desugaring of HsLits is now much tidier (DsExpr.dsLit) * Some stuff to do with RdrNames is moved from ParseUtil.lhs to RdrHsSyn.lhs, which is where it really belongs. * I also removed many unnecessary imports from modules quite a bit of dead code in divers places
-
- 14 Jul, 2000 2 commits
-
-
lewie authored
Functional Dependencies were not getting simplified away when the dictionary that generated them was simplified by instance resolution. Fixed.
-
simonpj authored
This commit completely re-does the kind-inference mechanism. Previously it was inter-wound with type inference, but that was always hard to understand, and it finally broke when we started checking for ambiguity when type-checking a type signature (details irrelevant). So now kind inference is more clearly separated, so that it never takes place at the same time as type inference. The biggest change is in TcTyClsDecls, which does the kind inference for a group of type and class declarations. It now contains comments to explain how it all works. There are also comments in TypeRep which describes the slightly tricky way in which we deal with the fact that kind 'type' (written '*') actually has 'boxed type' and 'unboxed type' as sub-kinds. The whole thing is a bit of a hack, because we don't really have sub-kinding, but it's less of a hack than before. A lot of general tidying up happened at the same time. In particular, I removed some dead code here and there
-
- 11 Jul, 2000 1 commit
-
-
simonmar authored
remove unused imports
-
- 07 Jul, 2000 1 commit
-
-
simonpj authored
This commit moves the instance environment out of the Class data structure, where it was immutable, to part of the type-checker environment. This change is absolutely essential as part of our move to GHCi, and I think it's also going to be necessary for Andrei's work on generic functions. As part of this change, we can remove a) types/InstEnv.* (thereby also removing a hi-boot loop) b) a tc-fixpoint-loop in TcModule Both of these are worthwhile simplifications.
-
- 22 Jun, 2000 1 commit
-
-
simonpj authored
*** NO NEED TO MERGE WITH 4.07 *** (but it would do no harm) * Improve an error message when overlapping instance declarations are present. Carl Witty reported this infelicitous message. The problem arises for this code: class Foo a class (Foo a) => Bar a data Dat a = Dat instance Foo (Dat a) instance Foo (Dat Integer) instance Bar (Dat a) The instance decl for Bar should say instance Foo (Dat a) => Bar (Dat a) because the overlapping instance decls for Foo can't be resolved (or at least might vary depending on how a is instantiated).
-
- 31 May, 2000 1 commit
-
-
lewie authored
Cleanup pass on functional dependencies. Most noticeably, make it so that signatures involving classes with functional dependencies work. Also, Fundeps are now properly handled by the simplifier, resolving problems where the fundeps were sometimes being discarded too early, and sometimes hanging around too long. Took out the early ambiguity testing in the renamer, because that's too early (you don't know the fundeps yet). Now, the ambiguity test happens in the typechecker. Functional Dependencies should now be up to snuff with Mark's paper, however, the derived instances and superclass extensions found in hugs are still not in there. It would be nice if this were merged into 4.07. I have diffs against the 4.07 tree in case it's too thorny working around Simon's big commit.
-
- 14 May, 2000 1 commit
-
-
lewie authored
Wobble. Fine tuning tcSimplifyAndCheck a bit further (wrt implicit params). The key is that a method that doesn't constrain a local tyvar, but does has implicit params, needs to be reduced further.
-
- 13 May, 2000 1 commit
-
-
lewie authored
A clean-up pass on fundeps and implicit params. Haven't yet incorporated changes from Hugs/GHC meeting yet, tho. - Fixed up several places in Type.lhs where IPNotes were probably being incorrectly handled. Strongly suggests a better solution should be implemented for marking implicit params than piggybacking on NoteTys. - tcSimplifyAndCheck was handling implicit params incorrectly (holding on to them when it should have been booting them out to frees). - Improved improvement WRT type signatures (the signature is now taken into account when improving). - Added improvement when matching against local polymorphic types.
-
- 27 Mar, 2000 1 commit
-
-
simonpj authored
Improve the error messages given when a definition isn't polymorphic enough. In paticular, for this program: let v = runST (newSTRef True) in runST (readSTRef v) we get the message Inferred type is less polymorphic than expected Quantified type variable `s' escapes It is reachable from the type variable(s) `a' which are free in the signature Signature type: forall s. ST s a Type to generalise: ST s (STRef s Bool) When checking an expression type signature In the first argument of `runST', namely `(newSTRef True)' In the right-hand side of a pattern binding: runST (newSTRef True)
-
- 23 Mar, 2000 1 commit
-
-
simonpj authored
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.
-
- 02 Mar, 2000 1 commit
-
-
lewie authored
Further refine and fix how `with' partitions the LIE. Also moved the partitioning function from Inst to TcSimplify. Fixed layout bug with `with'. Fixed another wibble w/ importing defs w/ implicit params. Make 4-tuples outputable (a convenience in debugging measure).
-
- 28 Feb, 2000 1 commit
-
-
lewie authored
Fix signatures w/ implicit parameter types in them (in particular, correctly handle the case where there are no type variables). Also made a few more things Outputable. Nuke outdated comment in Parser.y.
-
- 09 Feb, 2000 1 commit
-
-
lewie authored
Misc. fixes to implicit parameters support.
-
- 28 Jan, 2000 1 commit
-
-
lewie authored
First pass at implicit parameters. Honest, I didn't really go in *intending* to modify every file in the typechecker... ;-) The breadth of the change is partly due to generalizing contexts so that they are not hardwired to be (Class, [Type]) pairs. See types/Type.lhs for details (look for PredType).
-
- 06 Dec, 1999 1 commit
-
-
lewie authored
Fixed a FunDep leak in tcSimplifyToDicts (they weren't being filtered out), and fixed bug in instance improvement (matching wasn't being done correctly for polymorphic instances).
-