1. 22 Oct, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-10-22 14:31:09 by simonmar] · 948e7f38
      simonmar authored
      - In GHCi & Template Haskell, give a warning for things mentioned
        on the command line that we don't recognise, and then ignore them.
        In batch mode, these are still passed to the linker as before.
      
      - Clean up & rename the filename-suffix recognising functions in
        DriverPhases. There's probably a better place for these, but I've left
        them where they are for now.
      948e7f38
  2. 09 Oct, 2003 1 commit
    • simonpj's avatar
      [project @ 2003-10-09 11:58:39 by simonpj] · 98688c6e
      simonpj authored
      -------------------------
      		GHC heart/lung transplant
      		-------------------------
      
      This major commit changes the way that GHC deals with importing
      types and functions defined in other modules, during renaming and
      typechecking.  On the way I've changed or cleaned up numerous other
      things, including many that I probably fail to mention here.
      
      Major benefit: GHC should suck in many fewer interface files when
      compiling (esp with -O).  (You can see this with -ddump-rn-stats.)
      
      It's also some 1500 lines of code shorter than before.
      
      **	So expect bugs!  I can do a 3-stage bootstrap, and run
      **	the test suite, but you may be doing stuff I havn't tested.
      ** 	Don't update if you are relying on a working HEAD.
      
      
      In particular, (a) External Core and (b) GHCi are very little tested.
      
      	But please, please DO test this version!
      
      
      	------------------------
      		Big things
      	------------------------
      
      Interface files, version control, and importing declarations
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      * There is a totally new data type for stuff that lives in interface files:
      	Original names			IfaceType.IfaceExtName
      	Types				IfaceType.IfaceType
      	Declarations (type,class,id)	IfaceSyn.IfaceDecl
      	Unfoldings			IfaceSyn.IfaceExpr
        (Previously we used HsSyn for type/class decls, and UfExpr for unfoldings.)
        The new data types are in iface/IfaceType and iface/IfaceSyn.  They are
        all instances of Binary, so they can be written into interface files.
        Previous engronkulation concering the binary instance of RdrName has
        gone away -- RdrName is not an instance of Binary any more.  Nor does
        Binary.lhs need to know about the ``current module'' which it used to,
        which made it specialised to GHC.
      
        A good feature of this is that the type checker for source code doesn't
        need to worry about the possibility that we might be typechecking interface
        file stuff.  Nor does it need to do renaming; we can typecheck direct from
        IfaceSyn, saving a whole pass (module TcIface)
      
      * Stuff from interface files is sucked in *lazily*, rather than being eagerly
        sucked in by the renamer. Instead, we use unsafeInterleaveIO to capture
        a thunk for the unfolding of an imported function (say).  If that unfolding
        is every pulled on, TcIface will scramble over the unfolding, which may
        in turn pull in the interface files of things mentioned in the unfolding.
      
        The External Package State is held in a mutable variable so that it
        can be side-effected by this lazy-sucking-in process (which may happen
        way later, e.g. when the simplifier runs).   In effect, the EPS is a kind
        of lazy memo table, filled in as we suck things in.  Or you could think
        of it as a global symbol table, populated on demand.
      
      * This lazy sucking is very cool, but it can lead to truly awful bugs. The
        intent is that updates to the symbol table happen atomically, but very bad
        things happen if you read the variable for the table, and then force a
        thunk which updates the table.  Updates can get lost that way. I regret
        this subtlety.
      
        One example of the way it showed up is that the top level of TidyPgm
        (which updates the global name cache) to be much more disciplined about
        those updates, since TidyPgm may itself force thunks which allocate new
        names.
      
      * Version numbering in interface files has changed completely, fixing
        one major bug with ghc --make.  Previously, the version of A.f changed
        only if A.f's type and unfolding was textually different.  That missed
        changes to things that A.f's unfolding mentions; which was fixed by
        eagerly sucking in all of those things, and listing them in the module's
        usage list.  But that didn't work with --make, because they might have
        been already sucked in.
      
        Now, A.f's version changes if anything reachable from A.f (via interface
        files) changes.  A module with unchanged source code needs recompiling
        only if the versions of any of its free variables changes. [This isn't
        quite right for dictionary functions and rules, which aren't mentioned
        explicitly in the source.  There are extensive comments in module MkIface,
        where all version-handling stuff is done.]
      
      * We don't need equality on HsDecls any more (because they aren't used in
        interface files).  Instead we have a specialised equality for IfaceSyn
        (eqIfDecl etc), which uses IfaceEq instead of Bool as its result type.
        See notes in IfaceSyn.
      
      * The horrid bit of the renamer that tried to predict what instance decls
        would be needed has gone entirely.  Instead, the type checker simply
        sucks in whatever instance decls it needs, when it needs them.  Easy!
      
        Similarly, no need for 'implicitModuleFVs' and 'implicitTemplateHaskellFVs'
        etc.  Hooray!
      
      
      Types and type checking
      ~~~~~~~~~~~~~~~~~~~~~~~
      * Kind-checking of types is far far tidier (new module TcHsTypes replaces
        the badly-named TcMonoType).  Strangely, this was one of my
        original goals, because the kind check for types is the Right Place to
        do type splicing, but it just didn't fit there before.
      
      * There's a new representation for newtypes in TypeRep.lhs.  Previously
        they were represented using "SourceTypes" which was a funny compromise.
        Now they have their own constructor in the Type datatype.  SourceType
        has turned back into PredType, which is what it used to be.
      
      * Instance decl overlap checking done lazily.  Consider
      	instance C Int b
      	instance C a Int
        These were rejected before as overlapping, because when seeking
        (C Int Int) one couldn't tell which to use.  But there's no problem when
        seeking (C Bool Int); it can only be the second.
      
        So instead of checking for overlap when adding a new instance declaration,
        we check for overlap when looking up an Inst.  If we find more than one
        matching instance, we see if any of the candidates dominates the others
        (in the sense of being a substitution instance of all the others);
        and only if not do we report an error.
      
      
      
      	------------------------
      	     Medium things
      	------------------------
      
      * The TcRn monad is generalised a bit further.  It's now based on utils/IOEnv.lhs,
        the IO monad with an environment.  The desugarer uses the monad too,
        so that anything it needs can get faulted in nicely.
      
      * Reduce the number of wired-in things; in particular Word and Integer
        are no longer wired in.  The latter required HsLit.HsInteger to get a
        Type argument.  The 'derivable type classes' data types (:+:, :*: etc)
        are not wired in any more either (see stuff about derivable type classes
        below).
      
      * The PersistentComilerState is now held in a mutable variable
        in the HscEnv.  Previously (a) it was passed to and then returned by
        many top-level functions, which was painful; (b) it was invariably
        accompanied by the HscEnv.  This change tidies up top-level plumbing
        without changing anything important.
      
      * Derivable type classes are treated much more like 'deriving' clauses.
        Previously, the Ids for the to/from functions lived inside the TyCon,
        but now the TyCon simply records their existence (with a simple boolean).
        Anyone who wants to use them must look them up in the environment.
      
        This in turn makes it easy to generate the to/from functions (done
        in types/Generics) using HsSyn (like TcGenDeriv for ordinary derivings)
        instead of CoreSyn, which in turn means that (a) we don't have to figure
        out all the type arguments etc; and (b) it'll be type-checked for us.
        Generally, the task of generating the code has become easier, which is
        good for Manuel, who wants to make it more sophisticated.
      
      * A Name now says what its "parent" is. For example, the parent of a data
        constructor is its type constructor; the parent of a class op is its
        class.  This relationship corresponds exactly to the Avail data type;
        there may be other places we can exploit it.  (I made the change so that
        version comparison in interface files would be a bit easier; but in
        fact it tided up other things here and there (see calls to
        Name.nameParent).  For example, the declaration pool, of declararations
        read from interface files, but not yet used, is now keyed only by the 'main'
        name of the declaration, not the subordinate names.
      
      * New types OccEnv and OccSet, with the usual operations.
        OccNames can be efficiently compared, because they have uniques, thanks
        to the hashing implementation of FastStrings.
      
      * The GlobalRdrEnv is now keyed by OccName rather than RdrName.  Not only
        does this halve the size of the env (because we don't need both qualified
        and unqualified versions in the env), but it's also more efficient because
        we can use a UniqFM instead of a FiniteMap.
      
        Consequential changes to Provenance, which has moved to RdrName.
      
      * External Core remains a bit of a hack, as it was before, done with a mixture
        of HsDecls (so that recursiveness and argument variance is still inferred),
        and IfaceExprs (for value declarations).  It's not thoroughly tested.
      
      
      	------------------------
      	     Minor things
      	------------------------
      
      * DataCon fields dcWorkId, dcWrapId combined into a single field
        dcIds, that is explicit about whether the data con is a newtype or not.
        MkId.mkDataConWorkId and mkDataConWrapId are similarly combined into
        MkId.mkDataConIds
      
      * Choosing the boxing strategy is done for *source* type decls only, and
        hence is now in TcTyDecls, not DataCon.
      
      * WiredIn names are distinguished by their n_sort field, not by their location,
        which was rather strange
      
      * Define Maybes.mapCatMaybes :: (a -> Maybe b) -> [a] -> [b]
        and use it here and there
      
      * Much better pretty-printing of interface files (--show-iface)
      
      Many, many other small things.
      
      
      	------------------------
      	     File changes
      	------------------------
      * New iface/ subdirectory
      * Much of RnEnv has moved to iface/IfaceEnv
      * MkIface and BinIface have moved from main/ to iface/
      * types/Variance has been absorbed into typecheck/TcTyDecls
      * RnHiFiles and RnIfaces have vanished entirely.  Their
        work is done by iface/LoadIface
      * hsSyn/HsCore has gone, replaced by iface/IfaceSyn
      * typecheck/TcIfaceSig has gone, replaced by iface/TcIface
      * typecheck/TcMonoType has been renamed to typecheck/TcHsType
      * basicTypes/Var.hi-boot and basicTypes/Generics.hi-boot have gone altogether
      98688c6e
  3. 23 Sep, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-09-23 14:32:57 by simonmar] · abbc5a0b
      simonmar authored
      - Convert many of the optimisation options into dynamic options (that is,
        they can be mentioned in {-# OPTIONS #-} pragmas).
      
      - Add a new way to specify constructor-field unboxing on a selective
        basis.  To tell the compiler to unbox a constructor field, do this:
      
            data T = T !!Int
      
        and GHC will store that field unboxed if possible.  If it isn't possible
        (say, because the field has a sum type) then the annotation is ignored.
      
        The -funbox-strict-fields flag is now a dynamic flag, and has the same
        effect as replacing all the '!' annotations with '!!'.
      abbc5a0b
  4. 23 Jul, 2003 2 commits
  5. 18 Jul, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-07-18 13:18:06 by simonmar] · 2d532e45
      simonmar authored
      Revision to the filename policy changes of yesterday.  This fixes the
      broken stage2 and library builds.
      
      The new story is this:
      
        A Haskell source filename should take the form
      
      	<path>/<basename>.<extension>
      
        where
      
      	<path>      is any directory
      	<basename>  is the name of the module, with dots replaced by slashes.
      	<extension> is ".hs" or ".lhs".
      
        given a source filename in this form, GHC will produce object and
        interface files named respectively:
      
              <hidir>/<basename>.<hisuf>
      	<odir>/<basename>.<osuf>
      
        where
      
      	<hidir>   is the value of the -hidir flag, if one was given, or
      		  the value of <path> from the source file otherwise.
      
      	<odir>    the same, for the -odir flag.
      
              <osuf>	  the object suffix (settable with the -osuf flag)
      	<hisuf>   the hi suffix (settable with the -hisuf flag)
      
      For example, if I have a module A.B.C, in source file foo/A/B/C.hs,
      then GHC will create foo/A/B/C.hi and foo/A/B/C.o.
      
      If GHC is given a source filename which is *not* of the form
      <path>/<basename>.<extension>, then it uses a different strategy.
      This happens if the filename does not follow the module name.  In this
      case, GHC will set <path> to be the directory in which the source file
      resides, and <basename> to the module name with dots replaced by
      slashes, and then use the rules above.
      
      For example, if we put module A.B.C in foo/bar/baz.hs, then GHC will
      produce foo/bar/A/B/C.o and foo/bar/A/B/C.hi.
      2d532e45
  6. 17 Jul, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-07-17 12:04:50 by simonmar] · 6677029a
      simonmar authored
      Filename-related cleanup & fixes
      --------------------------------
      
      This commit rationalises some of our filename policies.  The new story
      is this:
      
        When compiling a Haskell module A.B.C:
      
          The object file is placed in <obj-path>/A/B/C.o
          The interface file is placed in <hi-path>/A/B/C.hi
      
          Where <objpath> is
      	- the argument of the -odir flag, if one was given
      	- the element of the search path in which the source file was found,
      	  when in --make mode.
      	- "." otherwise.
      
          Where <hipath> is
      	- the argument of the -hidir flag, if one was given
      	- the element of the search path in which the source file was found,
      	  when in --make mode.
      	- "." otherwise.
      
      NOTE, in particular, that the name of the source file has no bearing
      on the name of the object or interface file any more.  This is a
      nchange from the previous semantics, where the name of the object file
      would, under certain circumstances, follow the name of the source file.
      
      eg. before, if you said
      
      	ghc -c dir/foo.hs
      
      you would get dir/foo.o.  Now, you get something like Main.o,
      depending on what module is in foo.hs.  This means that the driver
      pipeline machinery now needs to pass around a Maybe ModLocation, which
      is filled in by the Hsc phase and used later on to figure out the name
      of the object file (this was fairly painful, but seems to be the only
      way to get the right behaviour).
      6677029a
  7. 16 Jul, 2003 1 commit
  8. 27 Jun, 2003 1 commit
    • sof's avatar
      [project @ 2003-06-27 18:28:31 by sof] · 9e6162f9
      sof authored
      Do as for one-shot linking and implicitly supply packages 'base' and
      'haskell98' when piecing together a DLL.
      
      Merge to STABLE.
      9e6162f9
  9. 13 Jun, 2003 1 commit
  10. 06 Jun, 2003 1 commit
  11. 05 Jun, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-06-05 10:11:22 by simonmar] · 2ce1b8d7
      simonmar authored
      - Fix a couple of bugs in yesterday's pipeline cleanup.
      
      - Do some more tidying: share the code for filename generation between
        the two entry points to HscMain, and also share some of the other
        machinery in the Hsc phase.  This fixes some wibbles (things that
        were done in --make mode but not in one-shot, and vice-versa).
      
        One thing that works now is that if you say 'ghc -keep-hc-files Foo.hs',
        then it automatically switches to -fvia-C mode to generate the .hc file.
      2ce1b8d7
  12. 04 Jun, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-06-04 15:47:58 by simonmar] · 70b6c54b
      simonmar authored
      Grrr, started off making a small bugfix and ended up doing a major
      cleanup operartion.
      
      Anyway, the problem was that -odir wasn't putting the object files in
      the right place when the module in question has a hierarchical name.
      This was due to the object filename being generated in two different
      places: once by the compilation pipeline machinery, and again in the
      Finder.  It now works properly when --make is used; I haven't managed
      to fix it for one-shot compilations though (some replumbing is
      needed).
      
      While I was here, I cleaned up the compilation pipeline machinery
      somewhat.  The previous scheme of generating a data structure
      representing the phases that need to be executed before actually
      executing them was wrong because the structure of the pipeline can
      change while it is being executed (eg. if we see {-# OPTIONS -fasm #-}
      during the CPP phase).  There were various hacks to deal with this,
      but it turned out to be quite messy.
      
      So the new story is that each compilation phase returns the name of
      the next phase to execute, and also figures out which file to put its
      output in.  This unfortunately means that the knowledge about what
      phases are done in what order is now spread throughout the module, but
      there are fewer hacks at the higher levels, and overall it seems to be
      an improvement.
      70b6c54b
  13. 03 Jun, 2003 1 commit
  14. 30 May, 2003 1 commit
    • wolfgang's avatar
      [project @ 2003-05-30 22:29:41 by wolfgang] · 44ff8384
      wolfgang authored
      MacOS X:
      pass the -framework option and its parameter as two separate arguments,
      i.e. ["-framework", "Foo"] instead of ["-framework Foo"].
      This is necessary because all options passed to gcc are now quoted
      (since rev. 1.88 of SysTools.lhs), and "-framework Foo" is not a valid
      option (while "-framework" "Foo" is).
      
      MERGE TO STABLE
      44ff8384
  15. 03 Mar, 2003 1 commit
  16. 06 Jan, 2003 1 commit
    • simonpj's avatar
      [project @ 2003-01-06 15:16:33 by simonpj] · 392095c9
      simonpj authored
      --------------------------------
      	Make ModLocation have a FilePath
      	instead of (Maybe FilePath) for
      	the object-file location
      	--------------------------------
      
      This generally tides things up, and makes ml_obj_file more like
      ml_hi_file.
      
      Furthermore the ml_obj_file field gets filled in even when we
      initially expect just an .hi file.  This is important for Template
      Haskell.
      392095c9
  17. 18 Dec, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-12-18 16:29:25 by simonmar] · 854ab9a4
      simonmar authored
      "Auto" packages.
      
      The big change here is that it is no longer necessary to explicitly
      say '-package X' on the command line if X is a package containing
      hierarchical Haskell modules.  All packages marked "auto" contribute
      to the import path, so their modules are always available.  At link
      time, the compiler knows which packages are actually used by the
      program, and it links in only those libraries needed.
      
      There's one exception: one-shot linking.  If you link a program using
      
          ghc -o prog A.o B.o ...
      
      then you need to explicitly add -package flags for each package
      required (except base & haskell98) because the compiler has no
      information about the package dependencies in this case.
      
      Package configs have a new field: auto, which is either True or False.
      Non-auto packages must be mentioned on the command-line as usual.
      Non-auto packages are still required for:
      
        - non-hierarchical libraries (to avoid polluting the module namespace)
      
        - packages with no Haskell content
      
        - if you want more than one version of a package, or packages
          providing overlapping functionality where the user must decide
          which one to use.
      
      Doc changes to follow...
      854ab9a4
  18. 17 Dec, 2002 1 commit
  19. 12 Dec, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-12-12 17:36:16 by simonmar] · b3016a12
      simonmar authored
      A modification to the way we build link lines.
      
      Currently the link line is constructed like this, for packages p1, p2 etc.:
      
        libraries p1 ++ extra_libs p1 ++
        libraries p2 ++ extra_libs p2 ++
        ...
        extra_ld_opts p1 ++
        extra_ld_opts p2 ++
        ..
      
      This change makes it follow this pattern:
      
        libraries p1 ++ extra_libs p1 ++ extra_ld_opts p1 ++
        libraries p2 ++ extra_libs p2 ++ extra_ld_opts p2 ++
        ...
      
      which seems more useful: in particular it means that using foo-config
      (eg. gtk-config) to populate extra_ld_opts should now work properly,
      and extra_libs is no longer strictly speaking needed (you can just use
      -l options in extra_ld_opts and get the same effect).
      
      Also:
      
        - There's now no difference between -l<lib> and -optl-l<lib>
        - GHCi grabs libs from extra_ld_opts as well as extra_libs
      b3016a12
  20. 24 Oct, 2002 1 commit
    • simonpj's avatar
      [project @ 2002-10-24 14:17:46 by simonpj] · e0445ffa
      simonpj authored
      ------------------------------------------
      	1. New try and module and package dependencies
      	2. OrigNameCache always contains final info
      	------------------------------------------
      
      These things nearly complete sorting out the incremental
      linking problem that started us off!
      
      1. This commit separates two kinds of information:
      
        (a) HscTypes.Dependencies:
      	What (i)  home-package modules, and
      	     (ii) other packages
            this module depends on, transitively.
      
            That is, to link the module, it should be enough
            to link the dependent modules and packages (plus
            any C stubs etc).
      
            Along with this info we record whether the dependent module
            is (a) a boot interface or (b) an orphan module.  So in
            fact (i) can contain non-home-package modules, namely the
            orphan ones in other packages (sigh).
      
        (b) HscTypes.Usage:
            What version of imported things were used to
            actually compile the module.  This info is used for
            recompilation control only.
      
      
      
      2. The Finder now returns a correct Module (incl package indicator)
      first time, so we can install the absolutely final Name in the
      OrigNameCache when we first come across an occurrence of that name,
      even if it's only an occurrence in an unfolding in some other interface
      file.  This is much tidier.
      
      As a result Module.lhs is much cleaner
      	No DunnoYet
      	No mkVanillaModule
      ALl very joyful stuff.
      e0445ffa
  21. 17 Oct, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-10-17 14:26:16 by simonmar] · 06575d67
      simonmar authored
      Finder overhaul.
      
      The finder had got pretty complicated; this commit is mainly a
      cleanup, with one new feature:
      
        - the finder has a cache (again).  The cache may be flushed by
          calling flushFinderCache, which actually only flushes home modules
          from the cache, because package modules are assumed not to move.
          This change is apropos of some other changes which will result in
          the finder being called more often, so we think a cache is going
          to be worthwhile.
      
      Also a couple of bugs were fixed:
      
        - the field ml_hi_file in a ModLocation is now *always* the name
          of the .hi file.  If you need a .hi-boot file, you have to make
          it up by changing the suffix of ml_hi_file.  (DriverMkDepend and
          RnHiFiles do this).  This was the cause of a bug, but I can't
          remember the details.
      
        - The -odir flag now works in a more reasonable way: hierarchical
          modules get put in subdirectories of the -odir directory.  eg.
          if your module is A.B.C, and -odir D is specified, then the object
          will be D/A/B/C.o; previously it would have been D/C.o.
      06575d67
  22. 15 Oct, 2002 2 commits
  23. 13 Sep, 2002 1 commit
    • simonpj's avatar
      [project @ 2002-09-13 15:02:25 by simonpj] · 9af77fa4
      simonpj authored
      --------------------------------------
      	Make Template Haskell into the HEAD
      	--------------------------------------
      
      This massive commit transfers to the HEAD all the stuff that
      Simon and Tim have been doing on Template Haskell.  The
      meta-haskell-branch is no more!
      
      WARNING: make sure that you
      
        * Update your links if you are using link trees.
          Some modules have been added, some have gone away.
      
        * Do 'make clean' in all library trees.
          The interface file format has changed, and you can
          get strange panics (sadly) if GHC tries to read old interface files:
          e.g.  ghc-5.05: panic! (the `impossible' happened, GHC version 5.05):
      	  Binary.get(TyClDecl): ForeignType
      
        * You need to recompile the rts too; Linker.c has changed
      
      
      However the libraries are almost unaltered; just a tiny change in
      Base, and to the exports in Prelude.
      
      
      NOTE: so far as TH itself is concerned, expression splices work
      fine, but declaration splices are not complete.
      
      
      		---------------
      		The main change
      		---------------
      
      The main structural change: renaming and typechecking have to be
      interleaved, because we can't rename stuff after a declaration splice
      until after we've typechecked the stuff before (and the splice
      itself).
      
      * Combine the renamer and typecheker monads into one
      	(TcRnMonad, TcRnTypes)
        These two replace TcMonad and RnMonad
      
      * Give them a single 'driver' (TcRnDriver).  This driver
        replaces TcModule.lhs and Rename.lhs
      
      * The haskell-src library package has a module
      	Language/Haskell/THSyntax
        which defines the Haskell data type seen by the TH programmer.
      
      * New modules:
      	hsSyn/Convert.hs 	converts THSyntax -> HsSyn
      	deSugar/DsMeta.hs 	converts HsSyn -> THSyntax
      
      * New module typecheck/TcSplice type-checks Template Haskell splices.
      
      		-------------
      		Linking stuff
      		-------------
      
      * ByteCodeLink has been split into
      	ByteCodeLink	(which links)
      	ByteCodeAsm	(which assembles)
      
      * New module ghci/ObjLink is the object-code linker.
      
      * compMan/CmLink is removed entirely (was out of place)
        Ditto CmTypes (which was tiny)
      
      * Linker.c initialises the linker when it is first used (no need to call
        initLinker any more).  Template Haskell makes it harder to know when
        and whether to initialise the linker.
      
      
      	-------------------------------------
      	Gathering the LIE in the type checker
      	-------------------------------------
      
      * Instead of explicitly gathering constraints in the LIE
      	tcExpr :: RenamedExpr -> TcM (TypecheckedExpr, LIE)
        we now dump the constraints into a mutable varabiable carried
        by the monad, so we get
      	tcExpr :: RenamedExpr -> TcM TypecheckedExpr
      
        Much less clutter in the code, and more efficient too.
        (Originally suggested by Mark Shields.)
      
      
      		-----------------
      		Remove "SysNames"
      		-----------------
      
      Because the renamer and the type checker were entirely separate,
      we had to carry some rather tiresome implicit binders (or "SysNames")
      along inside some of the HsDecl data structures.  They were both
      tiresome and fragile.
      
      Now that the typechecker and renamer are more intimately coupled,
      we can eliminate SysNames (well, mostly... default methods still
      carry something similar).
      
      		-------------
      		Clean up HsPat
      		-------------
      
      One big clean up is this: instead of having two HsPat types (InPat and
      OutPat), they are now combined into one.  This is more consistent with
      the way that HsExpr etc is handled; there are some 'Out' constructors
      for the type checker output.
      
      So:
      	HsPat.InPat	--> HsPat.Pat
      	HsPat.OutPat	--> HsPat.Pat
      	No 'pat' type parameter in HsExpr, HsBinds, etc
      
      	Constructor patterns are nicer now: they use
      		HsPat.HsConDetails
      	for the three cases of constructor patterns:
      		prefix, infix, and record-bindings
      
      	The *same* data type HsConDetails is used in the type
      	declaration of the data type (HsDecls.TyData)
      
      Lots of associated clean-up operations here and there.  Less code.
      Everything is wonderful.
      9af77fa4
  24. 29 Aug, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-08-29 15:44:11 by simonmar] · ce9687a5
      simonmar authored
      Housekeeping:
      
        - The main goal is to remove dependencies on hslibs for a
          bootstrapped compiler, leaving only a requirement that the
          packages base, haskell98 and readline are built in stage 1 in
          order to bootstrap.  We're almost there: Posix is still required
          for signal handling, but all other dependencies on hslibs are now
          gone.
      
          Uses of Addr and ByteArray/MutableByteArray array are all gone
          from the compiler.  PrimPacked defines the Ptr type for GHC 4.08
          (which didn't have it), and it defines simple BA and MBA types to
          replace uses of ByteArray and MutableByteArray respectively.
      
        - Clean up import lists.  HsVersions.h now defines macros for some
          modules which have moved between GHC versions.  eg. one now
          imports 'GLAEXTS' to get at unboxed types and primops in the
          compiler.
      
          Many import lists have been sorted as per the recommendations in
          the new style guidelines in the commentary.
      
      I've built the compiler with GHC 4.08.2, 5.00.2, 5.02.3, 5.04 and
      itself, and everything still works here.  Doubtless I've got something
      wrong, though.
      ce9687a5
  25. 29 Jul, 2002 2 commits
    • simonmar's avatar
      [project @ 2002-07-29 11:22:31 by simonmar] · 94f8d8ae
      simonmar authored
      Back out previous commit; -static is on by default and we don't want
      to always pass -static to the linker.
      94f8d8ae
    • simonmar's avatar
      [project @ 2002-07-29 10:42:29 by simonmar] · 157cecc7
      simonmar authored
      Add -static to the linker command line when -static is passed to GHC.
      
      At some point we might want a way to say that Haskell libraries should
      be linked statically but everything else should be linked as normal,
      but since we aren't really supporting dynamic Haskell libraries at
      this time, we don't need to address that yet.
      157cecc7
  26. 03 Jul, 2002 1 commit
  27. 27 Jun, 2002 1 commit
  28. 12 Jun, 2002 1 commit
    • wolfgang's avatar
      [project @ 2002-06-12 22:04:25 by wolfgang] · 643a2f70
      wolfgang authored
      Added support for Frameworks on MacOS X.
      *) On MacOS X, two additional command-line options are supported:
      -framework <FRAMEWORK>    link with framework, gets passed on to ld
      -framework-path <PATH>    gets passed on to ld as "-F<PATH>". (-F is already taken for GHC).
      *) Two corresponding additional options for package.conf files:
      framework_dirs
      extra_frameworks
      These options are allowed on any platform. They are ignored everywhere except on MacOS X.
      *) ghc-pkg no longer uses Read. Instead, it uses a Happy parser. ghc/utils/ghc-pkg/ParsePkgConfLite.y is basically a copy of ghc/compiler/main/ParsePkgConf.y. "Light" refers to the fact that it doesn't depend on other GHC modules and has less sophisticated error reporting.
      *) Frameworks will need some additional work for GHCi.
      643a2f70
  29. 01 May, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-05-01 09:30:04 by simonmar] · dd9e1672
      simonmar authored
      - When converting ModuleNames to Modules for use in the the module
        initialisation code, look them up in the IfaceTable(s) instead of
        calling findModule again.  They are guaranteed to be in either
        the HomeIfaceTable or the PackageIfaceTable after the renamer,
        so this saves some trips to the filesystem.  Also, move this
        code earlier in the compilation cycle to avoid holding on to the
        renamed syntax for too long (not sure if this makes a difference or
        not, but it definitely looked space-leakish before).
      
      - remove Util.unJust, it is a duplicate of Maybes.expectJust
      dd9e1672
  30. 11 Apr, 2002 1 commit
    • simonpj's avatar
      [project @ 2002-04-11 12:03:29 by simonpj] · a7b95beb
      simonpj authored
      -------------------
      	Mainly derived Read
      	-------------------
      
      This commit is a tangle of several things that somehow got wound up
      together, I'm afraid.
      
      
      The main course
      ~~~~~~~~~~~~~~~
      Replace the derived-Read machinery with Koen's cunning new parser
      combinator library.   The result should be
      	* much smaller code sizes from derived Read
      	* faster execution of derived Read
      
      WARNING: I have not thoroughly tested this stuff; I'd be glad if you did!
      	 All the hard work is done, but there may be a few nits.
      
      The Read class gets two new methods, not exposed
      in the H98 inteface of course:
        class Read a where
          readsPrec    :: Int -> ReadS a
          readList     :: ReadS [a]
          readPrec     :: ReadPrec a		-- NEW
          readListPrec :: ReadPrec [a]	-- NEW
      
      There are the following new libraries:
      
        Text.ParserCombinators.ReadP		Koens combinator parser
        Text.ParserCombinators.ReadPrec	Ditto, but with precedences
      
        Text.Read.Lex				An emasculated lexical analyser
      					that provides the functionality
      					of H98 'lex'
      
      TcGenDeriv is changed to generate code that uses the new libraries.
      The built-in instances of Read (List, Maybe, tuples, etc) use the new
      libraries.
      
      
      Other stuff
      ~~~~~~~~~~~
      1. Some fixes the the plumbing of external-core generation. Sigbjorn
      did most of the work earlier, but this commit completes the renaming and
      typechecking plumbing.
      
      2. Runtime error-generation functions, such as GHC.Err.recSelErr,
      GHC.Err.recUpdErr, etc, now take an Addr#, pointing to a UTF8-encoded
      C string, instead of a Haskell string.  This makes the *calls* to these
      functions easier to generate, and smaller too, which is a good thing.
      
      In particular, it means that MkId.mkRecordSelectorId doesn't need to
      be passed "unpackCStringId", which was GRUESOME; and that in turn means
      that tcTypeAndClassDecls doesn't need to be passed unf_env, which is
      a very worthwhile cleanup.   Win/win situation.
      
      3.  GHC now faithfully translates do-notation using ">>" for statements
      with no binding, just as the report says.  While I was there I tidied
      up HsDo to take a list of Ids instead of 3 (but now 4) separate Ids.
      Saves a bit of code here and there.  Also introduced Inst.newMethodFromName
      to package a common idiom.
      a7b95beb
  31. 05 Apr, 2002 1 commit
  32. 29 Mar, 2002 1 commit
    • sof's avatar
      [project @ 2002-03-29 21:39:36 by sof] · 76293b14
      sof authored
      Front end for External Core.
      
      Initial go at implementing a Core front end
      (enabled via -fcore); work in progress (renamer
      is currently not willing to slurp in & resolve
      imports.)
      76293b14
  33. 12 Mar, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-03-12 10:41:48 by simonmar] · 44aa6bcb
      simonmar authored
      When deciding whether the source for a module is unchanged, don't look
      at the file referred to in the argument of '-o' unless it really is
      the object file for this compilation (it might be the binary instead).
      
      MERGE TO STABLE
      44aa6bcb
  34. 27 Feb, 2002 1 commit
  35. 18 Feb, 2002 1 commit
    • sewardj's avatar
      [project @ 2002-02-18 12:41:01 by sewardj] · 45ddebc0
      sewardj authored
      Make foreign export dynamic work in GHCi.  Main changes:
      
      * Allow literal labels to propagate through the bytecode generator
        and eventually be linked by the runtime linker.
      
      * Minor mods to driver plumbing so that GHCi produces the relevant
        *_stub.[ch] files, compiles them with gcc, and loads the resulting .o's
      
      * Dereference the stable pointer in the generated C stub, rather
        than passing it to a Haskell-world helper.  This seems simpler and
        removes the need to have a H-world helper, which in turn means the
        stub .o doesn't refer to any H-world entities.  This is important
        because our linker can't deal with mutual recursion between
        BCOs and loaded objects.
      
      Still ToDo:
      
      * Make it thread/GC safe.  (Sigbjorn?)
      
      * Get rid of the bits of code in DsForeign which generate the
        Haskell helper.  I had a go but it wasn't obvious how to do it,
        so have deferred.
      45ddebc0
  36. 13 Feb, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-02-13 10:40:24 by simonmar] · 9f66c841
      simonmar authored
      Fixes to SplitObjs: we now put the split object files in a
      subdirectory M_split/ rather than just M/, because the latter
      interacts badly with our hierarchical module structure.
      9f66c841
  37. 08 Feb, 2002 1 commit