1. 18 Aug, 2000 1 commit
  2. 16 Aug, 2000 1 commit
    • simonmar's avatar
      [project @ 2000-08-16 13:28:25 by simonmar] · 66644baa
      simonmar authored
      Don't just pick the back edges ({-# SOURCE #-} imports) when
      collecting the list of imports for module initialisation.  It's
      entirely possible that a module is only reachable from Main via {-#
      SOURCE #-} imports.
      66644baa
  3. 07 Aug, 2000 1 commit
    • qrczak's avatar
      [project @ 2000-08-07 23:37:19 by qrczak] · 4b172698
      qrczak authored
      Now Char, Char#, StgChar have 31 bits (physically 32).
      "foo"# is still an array of bytes.
      
      CharRep represents 32 bits (on a 64-bit arch too). There is also
      Int8Rep, used in those places where bytes were originally meant.
      readCharArray, indexCharOffAddr etc. still use bytes. Storable and
      {I,M}Array use wide Chars.
      
      In future perhaps all sized integers should be primitive types. Then
      some usages of indexing primops scattered through the code could
      be changed to then-available Int8 ones, and then Char variants of
      primops could be made wide (other usages that handle text should use
      conversion that will be provided later).
      
      I/O and _ccall_ arguments assume ISO-8859-1. UTF-8 is internally used
      for string literals (only).
      
      Z-encoding is ready for Unicode identifiers.
      
      Ranges of intlike and charlike closures are more easily configurable.
      
      I've probably broken nativeGen/MachCode.lhs:chrCode for Alpha but I
      don't know the Alpha assembler to fix it (what is zapnot?). Generally
      I'm not sure if I've done the NCG changes right.
      
      This commit breaks the binary compatibility (of course).
      
      TODO:
      * is* and to{Lower,Upper} in Char (in progress).
      * Libraries for text conversion (in design / experiments),
        to be plugged to I/O and a higher level foreign library.
      * PackedString.
      * StringBuffer and accepting source in encodings other than ISO-8859-1.
      4b172698
  4. 02 Aug, 2000 1 commit
    • rrt's avatar
      [project @ 2000-08-02 14:13:26 by rrt] · 567b2505
      rrt authored
      Many fixes to DLLisation. These were previously covered up because code was
      leaking into the import libraries for DLLs, so the fact that some symbols
      were thought of as local rather than in another DLL wasn't a problem.
      
      The main problems addressed by this commit are:
      
      1. Fixes RTS symbols working properly when DLLised. They didn't before.
      2. Uses NULL instead of stg_error_entry, because DLL entry points can't be
         used as static initialisers.
      3. PrelGHC.hi-boot changed to be in package RTS, and export of PrelNum and
         PrelErr moved to PrelBase, so that references to primops & the like
         are cross-DLL as they should be.
      4. Pass imports around as Modules rather than ModuleNames, so that
         ModuleInitLabels can be checked to see if they're in a DLL or not.
      567b2505
  5. 01 Aug, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-08-01 09:08:25 by simonpj] · fe69f3c1
      simonpj authored
      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.
      fe69f3c1
  6. 14 Jul, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-07-14 08:17:36 by simonpj] · 77a8c0db
      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
      77a8c0db
  7. 11 Jul, 2000 1 commit
  8. 07 Jul, 2000 1 commit
  9. 06 Jul, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-07-06 16:31:45 by simonpj] · 525898a9
      simonpj authored
      * Improve the warning "M is imported but nothing from it is used"
        In particular, don't warn if some instances from it are imported.
      
        It's pretty much impossible to do the Right Thing always.
        A comment in Rename.lhs says
      	-- NOTE: Consider
      	--	      module This
      	--		import M ()
      	--
      	--	 The import M() is not *necessarily* redundant, even if
      	-- 	 we suck in no instance decls from M (e.g. it contains
      	--	 no instance decls, or This contains no code).  It may be
      	--	 that we import M solely to ensure that M's orphan instance
      	--	 decls (or those in its imports) are visible to people who
      	--	 import This.  Sigh.
      	--	 There's really no good way to detect this, so the error message
      	--	 in RnEnv.warnUnusedModules is weakened instead
      
      * Minor comment changes to RnIfaces.lhs
      
      * Use NameEnv instead of UFM in TcEnv (tidy up only)
      525898a9
  10. 25 May, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-05-25 12:41:14 by simonpj] · 495ef8bd
      simonpj authored
      ~~~~~~~~~~~~
      		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[!]
      495ef8bd
  11. 22 May, 2000 1 commit
  12. 13 Apr, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-04-13 11:56:35 by simonpj] · 9579283c
      simonpj authored
      Add support for 'packages'.
      
      * A package is a group of modules.
      
      * A package has a name (e.g. std)
      
      * A package is built into a single library (Unix; e.g. libHSstd.a)
                             or a single DLL     (Windows; e.g. HSstd.dll)
      
      * The '-package-name foo' flag tells GHC that the module being compiled
        is destined for package foo.
      
      * The '-package foo' flag tells GHC to make available modules
        from package 'foo'.  It replaces '-syslib foo' which is now deprecated.
      
      * Cross-package references cost an extra indirection in Windows,
        but not Unix
      
      * GHC does not maintain detailed cross-package dependency information.
        It does remember which modules in other packages the current module
        depends on, but not which things within those imported things.
      
      
      All of this tidies up the Prelude enormously.  The Prelude and
      Standard Libraries are built into a singl package called 'std'.  (This
      is a change; the library is now called libHSstd.a instead of libHS.a)
      9579283c
  13. 05 Apr, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-04-05 16:25:51 by simonpj] · d4e0a55c
      simonpj authored
      * Add new flag -fddump-minimal-imports, which dumps a file
        M.imports that contains the (allegedly) minimal bunch of
        imports that make the system work.
        It's done by Rename.printMinimalImports
      
      * Extend foreign import/export to handle
      	* Booleans
      	* newtypes
        as requested by the FFI team
      
      * Tidy up DsCCall quite a bit
        Remove maybeBoxedPrimTy from TcHsSyn
      d4e0a55c
  14. 23 Mar, 2000 2 commits
    • simonpj's avatar
      [project @ 2000-03-23 17:45:17 by simonpj] · 111cee3f
      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.
      111cee3f
    • sewardj's avatar
      [project @ 2000-03-23 12:22:04 by sewardj] · 1e5271f1
      sewardj authored
      In interface files, don't forget to mention the names of modules imported
      via hi-boot files.  This is needed so that Hugs can use the import decls
      in interface files to safely overestimate the dependency sets which it will
      encounter when linking object code.
      1e5271f1
  15. 02 Mar, 2000 2 commits
  16. 25 Feb, 2000 2 commits
    • panne's avatar
      [project @ 2000-02-25 15:06:30 by panne] · 5e95eb49
      panne authored
      *ahem*  Re-enable -fwarn-unused-binds and -fwarn-unused-imports...  :-}
      5e95eb49
    • panne's avatar
      [project @ 2000-02-25 14:55:31 by panne] · f83a5a68
      panne authored
      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.
      f83a5a68
  17. 20 Feb, 2000 1 commit
  18. 17 Feb, 2000 1 commit
    • panne's avatar
      [project @ 2000-02-17 14:47:21 by panne] · 48eec568
      panne authored
      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).
      48eec568
  19. 15 Feb, 2000 1 commit
    • panne's avatar
      [project @ 2000-02-15 22:18:16 by panne] · 06619533
      panne authored
      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...
      06619533
  20. 20 Dec, 1999 1 commit
    • simonpj's avatar
      [project @ 1999-12-20 10:34:27 by simonpj] · e921b2e3
      simonpj authored
      This commit implements a substantial re-organisation of the Prelude
      It also fixes a couple of small renamer bugs that were reported recently
      	(notably, Sven pointed out that we weren't reporting
      	unused imports properly)
      
      My original goal was to get rid of all "orphan" modules (i.e. ones
      with instance decls that don't belong either to a tycon or a class
      defined in the same module).  This should reduce the number of
      interface files that have to be read when compiling small Haskell
      modules.
      
      But like most expeditions into the Prelude Swamp, it spiraled out
      of control.  The result is quite satisfactory, though.
      
      	GONE AWAY:	PrelCCall, PrelNumExtra
      
      	NEW:		PrelReal, PrelFloat, PrelByteArr, PrelNum.hi-boot
      
      (The extra PrelNum.hi-boot is because of a tiresome thin-air Id, addr2Integer,
      which used to be in PrelBase.)
      
      Quite a lot of types have moved from one module to another,
      which entails some changes to part of the compiler (PrelInfo, PrelMods) etc,
      and there are a few places in the RTS includes and even in the driver
      that know about these home modules (alas).
      
      So the rough structure is as follows, in (linearised) dependency order
      	[this list now appears in PrelBase.lhs]
      
      PrelGHC		Has no implementation.  It defines built-in things, and
      		by importing it you bring them into scope.
      		The source file is PrelGHC.hi-boot, which is just
      		copied to make PrelGHC.hi
      
      		Classes: CCallable, CReturnable
      
      PrelBase	Classes: Eq, Ord, Functor, Monad
      		Types:   list, (), Int, Bool, Ordering, Char, String
      
      PrelTup		Types: tuples, plus instances for PrelBase classes
      
      PrelShow	Class: Show, plus instances for PrelBase/PrelTup types
      
      PrelEnum	Class: Enum,  plus instances for PrelBase/PrelTup types
      
      PrelMaybe	Type: Maybe, plus instances for PrelBase classes
      
      PrelNum		Class: Num, plus instances for Int
      		Type:  Integer, plus instances for all classes so far (Eq, Ord, Num, Show)
      
      		Integer is needed here because it is mentioned in the signature
      		of 'fromInteger' in class Num
      
      PrelReal	Classes: Real, Integral, Fractional, RealFrac
      			 plus instances for Int, Integer
      		Types:  Ratio, Rational
      			plus intances for classes so far
      
      		Rational is needed here because it is mentioned in the signature
      		of 'toRational' in class Real
      
      Ix		Classes: Ix, plus instances for Int, Bool, Char, Integer, Ordering, tuples
      
      PrelArr		Types: Array, MutableArray, MutableVar
      
      		Does *not* contain any ByteArray stuff (see PrelByteArr)
      		Arrays are used by a function in PrelFloat
      
      PrelFloat	Classes: Floating, RealFloat
      		Types:   Float, Double, plus instances of all classes so far
      
      		This module contains everything to do with floating point.
      		It is a big module (900 lines)
      		With a bit of luck, many modules can be compiled without ever reading PrelFloat.hi
      
      PrelByteArr	Types: ByteArray, MutableByteArray
      
      		We want this one to be after PrelFloat, because it defines arrays
      		of unboxed floats.
      
      
      Other Prelude modules are much easier with fewer complex dependencies.
      e921b2e3
  21. 09 Dec, 1999 1 commit
    • simonpj's avatar
      [project @ 1999-12-09 12:30:56 by simonpj] · 39262efa
      simonpj authored
      A bunch of small changes in the way that usage information
      is generated to stuff into interface files.  I'm not certain
      anything was really wrong before, but it's tidier now, and
      there are slightly fewer dependencies generated.  Main
      differences are in RnIfaces.getImportVersions
      
      I also made the check for orphan rules a bit cleverer
      (Rename.isOrphanDecl) so that we get fewer spurious orphan modules.
      
      Simon
      39262efa
  22. 06 Dec, 1999 1 commit
    • simonpj's avatar
      [project @ 1999-12-06 11:54:56 by simonpj] · fbdd694d
      simonpj authored
      Fix a major bug in exporting unfoldings involving existentials.
      
      Change core printing so that we put an '@' before type
      variables in case patterns.  This only affects existentials.
      
      	case x of
      	  C @ a x y -> ...
      
      Here 'a' is an existentially quantified type variable, and the
      '@' signifies this.  We continue to omit kinds and type on case-bound
      variables; the type checker can fill them in.
      
      The reason for this change is that type variables and term variables
      live in a different name space, so we need to know which name space
      is  involved when binding one.  How this ever worked I will never know.
      
      
      While I was at it, I also arranged that -ddump-rn prints out whatever
      it has even if it finds errors.  Adding -dppr-debug prints even the
      unfoldings on imported things.
      
      Simon
      fbdd694d
  23. 30 Nov, 1999 1 commit
    • lewie's avatar
      [project @ 1999-11-30 16:10:07 by lewie] · e1e1d020
      lewie authored
      First bits o' functional dependencies - just the syntax and related
      datatypes, plus started moving some of the static checks from the
      renamer (where we don't know about fundeps) to later in the typechecker.
      e1e1d020
  24. 29 Nov, 1999 1 commit
    • simonpj's avatar
      [project @ 1999-11-29 17:34:14 by simonpj] · e1a4f2a5
      simonpj authored
      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
      e1a4f2a5
  25. 17 Sep, 1999 1 commit
    • simonpj's avatar
      [project @ 1999-09-17 09:15:22 by simonpj] · 731f53de
      simonpj authored
      This bunch of commits represents work in progress on inlining and
      worker/wrapper stuff.
      
      Currently, I think it makes the compiler slightly worse than 4.04, for
      reasons I don't yet understand.  But it means that Simon and I can
      both peer at what is going on.
      
      * Substantially improve handling of coerces in worker/wrapper
      
      * exprIsDupable for an application (f e1 .. en) wasn't calling exprIsDupable
        on the arguments!!  So applications with few, but large, args were being dupliated.
      
      * sizeExpr on an application wasn't doing a nukeScrutDiscount on the arg of
        an application!!  So bogus discounts could accumulate from arguments!
      
      * Improve handling of INLINE pragmas in calcUnfoldingGuidance.  It was really
        wrong before
      731f53de
  26. 06 Jul, 1999 1 commit
    • simonpj's avatar
      [project @ 1999-07-06 16:45:31 by simonpj] · 9d38678e
      simonpj authored
      All Simon's recent tuning changes.  Rough summary follows:
      
      * Fix Kevin Atkinson's cant-find-instance bug.  Turns out that Rename.slurpSourceRefs
        needs to repeatedly call getImportedInstDecls, and then go back to slurping
        source-refs.  Comments with Rename.slurpSourceRefs.
      
      * Add a case to Simplify.mkDupableAlt for the quite-common case where there's
        a very simple alternative, in which case there's no point in creating a
        join-point binding.
      
      * Fix CoreUtils.exprOkForSpeculation so that it returns True of (==# a# b#).
        This lack meant that
      	case ==# a# b# of { True -> x; False -> x }
        was not simplifying
      
      * Make float-out dump bindings at the top of a function argument, as
        at the top of a let(rec) rhs.  See notes with FloatOut.floatRhs
      
      * Make the ArgOf case of mkDupableAlt generate a OneShot lambda.
        This gave a noticeable boost to spectral/boyer2
      
      
      * Reduce the number of coerces, using worker/wrapper stuff.
        The main idea is in WwLib.mkWWcoerce.  The gloss is that we must do
        the w/w split even for small non-recursive things.  See notes with
        WorkWrap.tryWw.
      
      * This further complicated getWorkerId, so I finally bit the bullet and
        make the workerInfo field of the IdInfo work properly, including
        under substitutions.  Death to getWorkerId.  Kevin Glynn will be happy.
      
      * Make all lambdas over realWorldStatePrimTy
        into one-shot lambdas.  This is a GROSS HACK.
      
      * Also make the occurrence analyser aware of one-shot lambdas.
      
      * Make various Prelude things into INLINE, so that foldr doesn't
        get inlined in their body, so that the caller gets the benefit
        of fusion.  Notably in PrelArr.lhs.
      9d38678e
  27. 05 Jul, 1999 1 commit
    • simonpj's avatar
      [project @ 1999-07-05 15:30:25 by simonpj] · 8ae0e52a
      simonpj authored
      Make sure that instance gates have their home modules
      loaded by RnIfaces.getImportedInstDecls.  This was causing
      Kevin Atkinson's missing-instance bug.
      8ae0e52a
  28. 30 Jun, 1999 1 commit
  29. 28 Jun, 1999 1 commit
  30. 25 Jun, 1999 1 commit
  31. 17 Jun, 1999 1 commit
  32. 28 May, 1999 1 commit
    • simonpj's avatar
      [project @ 1999-05-28 08:07:52 by simonpj] · 00eefb90
      simonpj authored
      Make the renamer so that the class ops on the LEFT HAND SIDE
      of the bindings of an instance decl count as free variables
      of that declaration.  E.g.
      
      	instance Foo [a] where
      	  op x  = ...
      	  bop y = ...
      
      Here, 'op' and 'bop' are now counted as free variables of
      the decl.
      
      This is vital, because the class decl for Foo might be imported,
      and look like this:
      
      	class Foo a where
      	  op  :: a -> S
      	  bop :: T -> a
      
      and these might happen to be the only mentions of S and T
      in the program.  Then we need to treat S and T as instance
      gates for the purpose of hauling in further instance decls,
      and the Right Way to do that is to announce that 'op' and
      'bop' have been mentioned.
      
      I also removed the (now obselete) rn_omit field in the
      monad.
      00eefb90
  33. 24 May, 1999 1 commit
  34. 21 May, 1999 1 commit
  35. 18 May, 1999 2 commits
    • simonpj's avatar
      [project @ 1999-05-18 15:19:15 by simonpj] · 927b3cbb
      simonpj authored
      Renamer changes
      		~~~~~~~~~~~~~~~
      
      [The real commit preceded this, but had the stupid message "msg_rn"
       because I used "cvs commit -m" instead of "cvs commit -F"]
      
      Fairly substantial changes to the renamer:
      
      * opt_PruneTyDecls is gone, gone, gone. Hurrah.  Ditto the 'deferred
        data decls' which was a bug farm.
      
        Instead, the compiler slurps in the transitive closure of all type
        declarations.  It is nevertheless still parsimonious about slurping
        in instance decls and rewrite rules.
      
      * The renamer now uses the usage information stored in each interface
        file to figure out whether to look for A.hi or A.hi-boot when looking
        for a declaration for A.f (say).
      
      * Because of the above, there are no "A!f" symbols in interface files any more.
        However, the header of the interface file does contain a "!" to indicate
        that the mdoule contains "orphan" instance decls or rewrite rules.
      	__interface Foo 3 ! 403 where
      
        Likewise, the usage info contains a "!" to indicate that the module
        mentioned has orphans:
      	import Foo 3 ! :: a 1 b 7 ;
      
      * The renamer now only reads an interface looking for fixities if it
        finds an occurrence of an operator from that module.  (Previously
        it pessimistically read the home modlese of all in-scope variables.)
      
      * Some flags have changed to more consistent names:
      	-ddump-rn-stats		(was -dshow-rn-stats)
      	-ddump-rn-trace		(was -dshow-rn-trace)
      
      * Exports now come before imports in interface files.  (This was an
        un-forced change.)
      
      * The usage info is now explicit when a module imports the whole of another:
      	import M 3 ;		-- Imports the whole of M
      	import M 3 :: a 2 b 7 ;	-- Imports M.a, M.b
      	import M 3 :: ;		-- Imports nothing from M
        The last one is still vital to record that this module depends indirectly
        on M, even though it didn't use anything from M directly.
      
      * The renamer warns if you import {- SOURCE -} unnecessarily.
      927b3cbb
    • simonpj's avatar
      [project @ 1999-05-18 14:56:06 by simonpj] · 0d8269cc
      simonpj authored
      msg_rn
      0d8269cc
  36. 27 Apr, 1999 1 commit
    • sof's avatar
      [project @ 1999-04-27 17:33:49 by sof] · 90c0b29e
      sof authored
      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.
      90c0b29e